diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2015-03-12 00:06:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-12 14:39:40 -0400 |
commit | 0c5c9fb55106333e773de8c9dd321fa8240caeb3 (patch) | |
tree | da550b771a52ba583eb97c1ad00fffbf3ae17f73 /net/ipv4/ipmr.c | |
parent | efd7ef1c1929d7a0329d4349252863c04d6f1729 (diff) |
net: Introduce possible_net_t
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@xmission.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ipmr.c')
-rw-r--r-- | net/ipv4/ipmr.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 9d78427652d2..5b188832800f 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -73,9 +73,7 @@ | |||
73 | 73 | ||
74 | struct mr_table { | 74 | struct mr_table { |
75 | struct list_head list; | 75 | struct list_head list; |
76 | #ifdef CONFIG_NET_NS | 76 | possible_net_t net; |
77 | struct net *net; | ||
78 | #endif | ||
79 | u32 id; | 77 | u32 id; |
80 | struct sock __rcu *mroute_sk; | 78 | struct sock __rcu *mroute_sk; |
81 | struct timer_list ipmr_expire_timer; | 79 | struct timer_list ipmr_expire_timer; |