[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1426135075.11398.144.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Wed, 11 Mar 2015 21:37:55 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: "Eric W. Biederman" <ebiederm@...ssion.com>
Cc: David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
salo@...gle.com
Subject: Re: [PATCH net-next 2/2] net: Introduce possible_net_t
On Wed, 2015-03-11 at 23:06 -0500, Eric W. Biederman wrote:
> Having to say
> > #ifdef CONFIG_NET_NS
> > struct net *net;
> > #endif
>
> in structures is a little bit wordy and a little bit error prone.
>
> Instead it is possible to say:
> > typedef struct {
> > #ifdef CONFIG_NET_NS
> > struct net *net;
> > #endif
> > } possible_net_t;
>
> And then in a header say:
>
> > possible_net_t net;
>
> Which is cleaner and easier to use and easier to test, as the
> possible_net_t is always there no matter what the compile options.
>
> Further this allows read_pnet and write_pnet to be functions in all
> cases which is better at catching typos.
>
> This change adds possible_net_t, updates the definitions of read_pnet
> and write_pnet, updates optional struct net * variables that
> write_pnet uses on to have the type possible_net_t, and finally fixes
> up the b0rked users of read_pnet and write_pnet.
>
> Signed-off-by: "Eric W. Biederman" <ebiederm@...ssion.com>
> ---
>
> When I was testing this caught all three locations Eric Dumazet needed
> to add write_pnet as compile errors with network namespaces enabled.
Acked-by: Eric Dumazet <edumazet@...gle.com>
Only concern is the typedef possible_net_t : It seems number of uses
should be rather small, and we probably could use the "struct
possible_net" instead, to please Linus ;)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists