aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/net/net_namespace.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 700c53a3c6fa..319557789a40 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -192,6 +192,24 @@ static inline void release_net(struct net *net)
192} 192}
193#endif 193#endif
194 194
195#ifdef CONFIG_NET_NS
196
197static inline void write_pnet(struct net **pnet, struct net *net)
198{
199 *pnet = net;
200}
201
202static inline struct net *read_pnet(struct net * const *pnet)
203{
204 return *pnet;
205}
206
207#else
208
209#define write_pnet(pnet, net) do { (void)(net);} while (0)
210#define read_pnet(pnet) (&init_net)
211
212#endif
195 213
196#define for_each_net(VAR) \ 214#define for_each_net(VAR) \
197 list_for_each_entry(VAR, &net_namespace_list, list) 215 list_for_each_entry(VAR, &net_namespace_list, list)