Subject: Re: [PATCH v3] net: #ifdef inet_bind_bucket::ib_net

From: Eric Dumazet <[email-masked]>
Date: Fri, 14 Nov 2008 00:09:47 +0100

Alexey Dobriyan a écrit :
> On Wed, Nov 12, 2008 at 04:24:23AM -0800, David Miller wrote:
>> From: Alexey Dobriyan <[email-masked]>
>> Date: Wed, 12 Nov 2008 15:24:48 +0300
>>
>>> +static inline void ib_net_set(struct inet_bind_bucket *ib, struct net *net)
>>> +{
>>> +#ifdef CONFIG_NET_NS
>>> +   ib->ib_net = net;
>>> +#endif
>>> +}
>>> +
>> It's basically read_pnet() hidden behind another name.
>> And you'll add new "aliases" for read_pnet() over and over
>> again.
>>
>> That makes no sense to me.
> 
> It also make no sense to expose write_pnet() for one(!) user and
> simultaneously hide read_pnet() under ib_net() as committed patches do.
> 
> Something is wrong with read_pnet() as nobody suggested to mass use it
> or send a patch doing it.

I did. My plan is to zap all superflous #ifdef CONFIG_NET_NS if possible.

> 
> 
>         #ifdef CONFIG_NET_NS
>                 ib->ib_net = net;
>         #endif
> 
> It's _obvious_ from this code that it's a C assignment or nop. It's also
> obvious depending on what config option.
> 
>         write_pnet(&ib->ib_net, net);
> 
> What is & operator doing here? Is it important? '&' is syntaxic noise.
> 
> And netns assignments are exactly this: assigment or a nop.

You obviously didnt read my patches.

How do you want to implement a C function that can write to ib->ib_net ?

Yes, I prefer a function over a macro, as most kernel developpers,
for obvious reasons.

Only sane way is :

static inline void write_pnet(struct net **pnet, struct net *net)
{
	*pnet = net;
}

and call write_pnet(&ip->ib_net, net);

Strange, this is what I did.

Take the time to read the patch, please.

Thank you