net_namespace.h (efd7ef1c1929d7a0329d4349252863c04d6f1729) | net_namespace.h (0c5c9fb55106333e773de8c9dd321fa8240caeb3) |
---|---|
1/* 2 * Operations on the network namespace 3 */ 4#ifndef __NET_NET_NAMESPACE_H 5#define __NET_NET_NAMESPACE_H 6 7#include <linux/atomic.h> 8#include <linux/workqueue.h> --- 217 unchanged lines hidden (view full) --- 226{ 227 return 1; 228} 229 230#define net_drop_ns NULL 231#endif 232 233 | 1/* 2 * Operations on the network namespace 3 */ 4#ifndef __NET_NET_NAMESPACE_H 5#define __NET_NET_NAMESPACE_H 6 7#include <linux/atomic.h> 8#include <linux/workqueue.h> --- 217 unchanged lines hidden (view full) --- 226{ 227 return 1; 228} 229 230#define net_drop_ns NULL 231#endif 232 233 |
234typedef struct { |
|
234#ifdef CONFIG_NET_NS | 235#ifdef CONFIG_NET_NS |
236 struct net *net; 237#endif 238} possible_net_t; |
|
235 | 239 |
236static inline void write_pnet(struct net **pnet, struct net *net) | 240static inline void write_pnet(possible_net_t *pnet, struct net *net) |
237{ | 241{ |
238 *pnet = net; | 242#ifdef CONFIG_NET_NS 243 pnet->net = net; 244#endif |
239} 240 | 245} 246 |
241static inline struct net *read_pnet(struct net * const *pnet) | 247static inline struct net *read_pnet(const possible_net_t *pnet) |
242{ | 248{ |
243 return *pnet; 244} 245 | 249#ifdef CONFIG_NET_NS 250 return pnet->net; |
246#else | 251#else |
247 248#define write_pnet(pnet, net) do { (void)(net);} while (0) 249#define read_pnet(pnet) (&init_net) 250 | 252 return &init_net; |
251#endif | 253#endif |
254} |
|
252 253#define for_each_net(VAR) \ 254 list_for_each_entry(VAR, &net_namespace_list, list) 255 256#define for_each_net_rcu(VAR) \ 257 list_for_each_entry_rcu(VAR, &net_namespace_list, list) 258 259#ifdef CONFIG_NET_NS --- 110 unchanged lines hidden --- | 255 256#define for_each_net(VAR) \ 257 list_for_each_entry(VAR, &net_namespace_list, list) 258 259#define for_each_net_rcu(VAR) \ 260 list_for_each_entry_rcu(VAR, &net_namespace_list, list) 261 262#ifdef CONFIG_NET_NS --- 110 unchanged lines hidden --- |