diff options
| author | Eric W. Biederman <[email protected]> | 2015-03-12 04:06:44 +0000 |
|---|---|---|
| committer | David S. Miller <[email protected]> | 2015-03-12 18:39:40 +0000 |
| commit | 0c5c9fb55106333e773de8c9dd321fa8240caeb3 (patch) | |
| tree | da550b771a52ba583eb97c1ad00fffbf3ae17f73 /net/openvswitch/datapath.h | |
| parent | net: Kill hold_net release_net (diff) | |
| download | kernel-0c5c9fb55106333e773de8c9dd321fa8240caeb3.tar.gz kernel-0c5c9fb55106333e773de8c9dd321fa8240caeb3.zip | |
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" <[email protected]>
Acked-by: Eric Dumazet <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'net/openvswitch/datapath.h')
| -rw-r--r-- | net/openvswitch/datapath.h | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/net/openvswitch/datapath.h b/net/openvswitch/datapath.h index 3ece94563079..4ec4a480b147 100644 --- a/net/openvswitch/datapath.h +++ b/net/openvswitch/datapath.h @@ -84,10 +84,8 @@ struct datapath { /* Stats. */ struct dp_stats_percpu __percpu *stats_percpu; -#ifdef CONFIG_NET_NS /* Network namespace ref. */ - struct net *net; -#endif + possible_net_t net; u32 user_features; }; |
