summaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
diff options
context:
space:
mode:
authorEric W. Biederman2015-03-12 05:06:44 +0100
committerDavid S. Miller2015-03-12 19:39:40 +0100
commit0c5c9fb55106333e773de8c9dd321fa8240caeb3 (patch)
treeda550b771a52ba583eb97c1ad00fffbf3ae17f73 /include/net/sock.h
parentnet: Kill hold_net release_net (diff)
downloadkernel-qcow2-linux-0c5c9fb55106333e773de8c9dd321fa8240caeb3.tar.gz
kernel-qcow2-linux-0c5c9fb55106333e773de8c9dd321fa8240caeb3.tar.xz
kernel-qcow2-linux-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" <ebiederm@xmission.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sock.h')
-rw-r--r--include/net/sock.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 95b2c1c220f9..9411c3421dd3 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -190,9 +190,7 @@ struct sock_common {
struct hlist_nulls_node skc_portaddr_node;
};
struct proto *skc_prot;
-#ifdef CONFIG_NET_NS
- struct net *skc_net;
-#endif
+ possible_net_t skc_net;
#if IS_ENABLED(CONFIG_IPV6)
struct in6_addr skc_v6_daddr;