Subject: Re: Full story on PFIL_HOOKS rearrangement
To: Aidan Cully <aidan@kublai.com>
From: Jason R Thorpe <thorpej@zembu.com>
List: tech-net
Date: 11/11/2000 07:35:08
On Fri, Nov 10, 2000 at 10:50:34PM -0500, Aidan Cully wrote:
> I note that I'm not a kernel or networking guy, and acknowledge that
> in practice this probably won't lose, but it strikes me as a mistake
> to create a void * key by typecasting integers... It looks like the
> void *'s are supposed to be globally unique? Taking the address of
> a kernel variable buys you that automatically, but by using integers,
> you'd need to verify each time you added a new integer key that it
> doesn't clash with old keys. Like I say, I acknowledge that it likely
> won't be a problem (since you'll probably stick to address families,
> when using integer keys), but it still bothers me.
>
> Any reason not to do
> extern int _pfil_inet4_key;
> #define PFIL_INET4_KEY ((void *) &_pfil_inet4_key)
> and similar for INET6?
There's a method to my madness :-)
It's all a matter of convention...
...if the only integers you use are address families, the you're okay.
Actually referencing an external symbol is a lose, from a modular
point of view.
--
-- Jason R. Thorpe <thorpej@zembu.com>