1 #include <linux/version.h>
2 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
4 #include <linux/sched.h>
5 #include <net/net_namespace.h>
6 #include <net/netns/generic.h>
8 /* This trivial implementation assumes that there is only a single pernet
9 * generic device registered and that the caller is well behaved. It only
10 * weakly attempts to check that these conditions are true. */
12 static bool device_registered;
15 int register_pernet_gen_device(int *id, struct pernet_operations *ops)
17 BUG_ON(device_registered);
20 device_registered = true;
22 if (ops->init == NULL)
24 return ops->init(NULL);
27 void unregister_pernet_gen_device(int id, struct pernet_operations *ops)
29 device_registered = false;
34 int net_assign_generic(struct net *net, int id, void *data)
42 void *net_generic(struct net *net, int id)
49 #endif /* kernel < 2.6.26 */