diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-06-01 02:51:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-02 08:16:23 -0400 |
commit | c2d9ba9bce8d7323ca96f239e1f505c14d6244fb (patch) | |
tree | 7a184eefa2e48e6aa15cdf3aefb6ccf2fb834320 /include | |
parent | c6b20d941b08941bece53bc3d857beb1fb25fffc (diff) |
net: CONFIG_NET_NS reduction
Use read_pnet() and write_pnet() to reduce number of ifdef CONFIG_NET_NS
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/netdevice.h | 6 | ||||
-rw-r--r-- | include/net/cfg80211.h | 15 | ||||
-rw-r--r-- | include/net/genetlink.h | 15 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack.h | 6 | ||||
-rw-r--r-- | include/net/sock.h | 10 |
5 files changed, 8 insertions, 44 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index a24916156f4e..bd6b75317d5f 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -1087,11 +1087,7 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev, | |||
1087 | static inline | 1087 | static inline |
1088 | struct net *dev_net(const struct net_device *dev) | 1088 | struct net *dev_net(const struct net_device *dev) |
1089 | { | 1089 | { |
1090 | #ifdef CONFIG_NET_NS | 1090 | return read_pnet(&dev->nd_net); |
1091 | return dev->nd_net; | ||
1092 | #else | ||
1093 | return &init_net; | ||
1094 | #endif | ||
1095 | } | 1091 | } |
1096 | 1092 | ||
1097 | static inline | 1093 | static inline |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index b44a2e5321a3..e7ebeb8bdf71 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -1330,26 +1330,15 @@ struct wiphy { | |||
1330 | char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); | 1330 | char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); |
1331 | }; | 1331 | }; |
1332 | 1332 | ||
1333 | #ifdef CONFIG_NET_NS | ||
1334 | static inline struct net *wiphy_net(struct wiphy *wiphy) | ||
1335 | { | ||
1336 | return wiphy->_net; | ||
1337 | } | ||
1338 | |||
1339 | static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) | ||
1340 | { | ||
1341 | wiphy->_net = net; | ||
1342 | } | ||
1343 | #else | ||
1344 | static inline struct net *wiphy_net(struct wiphy *wiphy) | 1333 | static inline struct net *wiphy_net(struct wiphy *wiphy) |
1345 | { | 1334 | { |
1346 | return &init_net; | 1335 | return read_pnet(&wiphy->_net); |
1347 | } | 1336 | } |
1348 | 1337 | ||
1349 | static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) | 1338 | static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) |
1350 | { | 1339 | { |
1340 | write_pnet(&wiphy->_net, net); | ||
1351 | } | 1341 | } |
1352 | #endif | ||
1353 | 1342 | ||
1354 | /** | 1343 | /** |
1355 | * wiphy_priv - return priv from wiphy | 1344 | * wiphy_priv - return priv from wiphy |
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index eb551baafc04..f7dcd2c70412 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
@@ -68,26 +68,15 @@ struct genl_info { | |||
68 | #endif | 68 | #endif |
69 | }; | 69 | }; |
70 | 70 | ||
71 | #ifdef CONFIG_NET_NS | ||
72 | static inline struct net *genl_info_net(struct genl_info *info) | 71 | static inline struct net *genl_info_net(struct genl_info *info) |
73 | { | 72 | { |
74 | return info->_net; | 73 | return read_pnet(&info->_net); |
75 | } | 74 | } |
76 | 75 | ||
77 | static inline void genl_info_net_set(struct genl_info *info, struct net *net) | 76 | static inline void genl_info_net_set(struct genl_info *info, struct net *net) |
78 | { | 77 | { |
79 | info->_net = net; | 78 | write_pnet(&info->_net, net); |
80 | } | 79 | } |
81 | #else | ||
82 | static inline struct net *genl_info_net(struct genl_info *info) | ||
83 | { | ||
84 | return &init_net; | ||
85 | } | ||
86 | |||
87 | static inline void genl_info_net_set(struct genl_info *info, struct net *net) | ||
88 | { | ||
89 | } | ||
90 | #endif | ||
91 | 80 | ||
92 | /** | 81 | /** |
93 | * struct genl_ops - generic netlink operations | 82 | * struct genl_ops - generic netlink operations |
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index bde095f7e845..bbfdd9453087 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
@@ -152,11 +152,7 @@ extern struct net init_net; | |||
152 | 152 | ||
153 | static inline struct net *nf_ct_net(const struct nf_conn *ct) | 153 | static inline struct net *nf_ct_net(const struct nf_conn *ct) |
154 | { | 154 | { |
155 | #ifdef CONFIG_NET_NS | 155 | return read_pnet(&ct->ct_net); |
156 | return ct->ct_net; | ||
157 | #else | ||
158 | return &init_net; | ||
159 | #endif | ||
160 | } | 156 | } |
161 | 157 | ||
162 | /* Alter reply tuple (maybe alter helper). */ | 158 | /* Alter reply tuple (maybe alter helper). */ |
diff --git a/include/net/sock.h b/include/net/sock.h index ca241ea14875..3461e5d1e9ad 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1724,19 +1724,13 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e | |||
1724 | static inline | 1724 | static inline |
1725 | struct net *sock_net(const struct sock *sk) | 1725 | struct net *sock_net(const struct sock *sk) |
1726 | { | 1726 | { |
1727 | #ifdef CONFIG_NET_NS | 1727 | return read_pnet(&sk->sk_net); |
1728 | return sk->sk_net; | ||
1729 | #else | ||
1730 | return &init_net; | ||
1731 | #endif | ||
1732 | } | 1728 | } |
1733 | 1729 | ||
1734 | static inline | 1730 | static inline |
1735 | void sock_net_set(struct sock *sk, struct net *net) | 1731 | void sock_net_set(struct sock *sk, struct net *net) |
1736 | { | 1732 | { |
1737 | #ifdef CONFIG_NET_NS | 1733 | write_pnet(&sk->sk_net, net); |
1738 | sk->sk_net = net; | ||
1739 | #endif | ||
1740 | } | 1734 | } |
1741 | 1735 | ||
1742 | /* | 1736 | /* |