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>
Showing
- include/linux/netdevice.h 2 additions, 6 deletionsinclude/linux/netdevice.h
- include/net/cfg80211.h 1 addition, 3 deletionsinclude/net/cfg80211.h
- include/net/genetlink.h 1 addition, 3 deletionsinclude/net/genetlink.h
- include/net/inet_hashtables.h 1 addition, 3 deletionsinclude/net/inet_hashtables.h
- include/net/ip_vs.h 4 additions, 4 deletionsinclude/net/ip_vs.h
- include/net/neighbour.h 2 additions, 6 deletionsinclude/net/neighbour.h
- include/net/net_namespace.h 13 additions, 10 deletionsinclude/net/net_namespace.h
- include/net/netfilter/nf_conntrack.h 2 additions, 3 deletionsinclude/net/netfilter/nf_conntrack.h
- include/net/sock.h 1 addition, 3 deletionsinclude/net/sock.h
- include/net/xfrm.h 2 additions, 6 deletionsinclude/net/xfrm.h
- net/9p/trans_fd.c 2 additions, 2 deletionsnet/9p/trans_fd.c
- net/ipv4/ipmr.c 1 addition, 3 deletionsnet/ipv4/ipmr.c
- net/ipv6/addrlabel.c 2 additions, 6 deletionsnet/ipv6/addrlabel.c
- net/ipv6/ip6mr.c 1 addition, 3 deletionsnet/ipv6/ip6mr.c
- net/openvswitch/datapath.h 1 addition, 3 deletionsnet/openvswitch/datapath.h
- net/packet/internal.h 1 addition, 3 deletionsnet/packet/internal.h
Loading
Please register or sign in to comment