1 #ifndef __NET_NET_NAMESPACE_WRAPPER_H
2 #define __NET_NET_NAMESPACE_WRAPPER_H 1
4 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
5 /* <net/net_namespace.h> exists, go ahead and include it. */
6 #include_next <net/net_namespace.h>
8 /* No network namespace support. */
11 static inline struct net *hold_net(struct net *net)
16 static inline void release_net(struct net *net)
20 #define __net_init __init
21 #define __net_exit __exit
24 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
27 int net_eq(const struct net *net1, const struct net *net2)
33 int net_eq(const struct net *net1, const struct net *net2)
37 #endif /* CONFIG_NET_NS */
40 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
43 static inline void write_pnet(struct net **pnet, struct net *net)
48 static inline struct net *read_pnet(struct net * const *pnet)
55 #define write_pnet(pnet, net) do { (void)(net); } while (0)
57 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
58 #define read_pnet(pnet) (&init_net)
60 #define read_pnet(pnet) (NULL)
63 #endif /* CONFIG_NET_NS */
66 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
67 #define pernet_operations rpl_pernet_operations
68 struct pernet_operations {
69 int (*init)(struct net *net);
70 void (*exit)(struct net *net);
75 extern int rpl_register_pernet_gen_device(struct rpl_pernet_operations *ops);
76 extern void rpl_unregister_pernet_gen_device(struct rpl_pernet_operations *ops);
78 #define register_pernet_device rpl_register_pernet_gen_device
79 #define unregister_pernet_device rpl_unregister_pernet_gen_device
83 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
85 #define for_each_net(net) { net = NULL; }
89 #endif /* net/net_namespace.h wrapper */