aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-06-01 02:51:19 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-02 08:16:23 -0400
commitc2d9ba9bce8d7323ca96f239e1f505c14d6244fb (patch)
tree7a184eefa2e48e6aa15cdf3aefb6ccf2fb834320 /include/net
parentc6b20d941b08941bece53bc3d857beb1fb25fffc (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/net')
-rw-r--r--include/net/cfg80211.h15
-rw-r--r--include/net/genetlink.h15
-rw-r--r--include/net/netfilter/nf_conntrack.h6
-rw-r--r--include/net/sock.h10
4 files changed, 7 insertions, 39 deletions
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
1334static inline struct net *wiphy_net(struct wiphy *wiphy)
1335{
1336 return wiphy->_net;
1337}
1338
1339static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
1340{
1341 wiphy->_net = net;
1342}
1343#else
1344static inline struct net *wiphy_net(struct wiphy *wiphy) 1333static inline struct net *wiphy_net(struct wiphy *wiphy)
1345{ 1334{
1346 return &init_net; 1335 return read_pnet(&wiphy->_net);
1347} 1336}
1348 1337
1349static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 1338static 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
72static inline struct net *genl_info_net(struct genl_info *info) 71static 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
77static inline void genl_info_net_set(struct genl_info *info, struct net *net) 76static 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
82static inline struct net *genl_info_net(struct genl_info *info)
83{
84 return &init_net;
85}
86
87static 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
153static inline struct net *nf_ct_net(const struct nf_conn *ct) 153static 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
1724static inline 1724static inline
1725struct net *sock_net(const struct sock *sk) 1725struct 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
1734static inline 1730static inline
1735void sock_net_set(struct sock *sk, struct net *net) 1731void 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/*