]> git.openfabrics.org - ~emulex/for-vlad/compat.git/commitdiff
Add initial backport support for network namespaces
authorLuis R. Rodriguez <lrodriguez@atheros.com>
Tue, 12 Jan 2010 00:17:04 +0000 (16:17 -0800)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Tue, 12 Jan 2010 00:18:37 +0000 (16:18 -0800)
We simply declare the overly used init_net sprinkled all over
the kernel, and declare its. All other code should that uses
network namespaces should be ifdef'd for now as well as
inclusion of net/net_namespace.h as we do not backport
the network namespace implemetnation at all, we simply
try to nullify its effect.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
compat/compat-2.6.24.c
include/linux/compat-2.6.24.h
include/linux/compat-2.6.26.h

index 347f6f7d65fe528707c1d4636a8c6dcdcf997dec..31a9212f84e12b32aa2b58d856617d64f6cc99f9 100644 (file)
 
 #include <net/arp.h>
 
+/*
+ * We simply won't use it though, just declare it for our wrappers and
+ * for usage with tons of code that makes mention to it.
+ */
+struct net init_net;
+EXPORT_SYMBOL(init_net);
+
 /* Part of net/ethernet/eth.c as of 2.6.24 */
 char *print_mac(char *buf, const u8 *addr)
 {
index ac9489f7fe122b95ef6bfbe235fbb57759626a7f..246156c2692105d52a519bf2de104db1e92df972 100644 (file)
 
 #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
 
+struct proc_dir_entry;
+struct net_device;
+struct net {
+       atomic_t                count;          /* To decided when the network
+                                                *  namespace should be freed.
+                                                */
+       atomic_t                use_count;      /* To track references we
+                                                * destroy on demand
+                                                */
+       struct list_head        list;           /* list of network namespaces */
+       struct work_struct      work;           /* work struct for freeing */
+
+       struct proc_dir_entry   *proc_net;
+       struct proc_dir_entry   *proc_net_stat;
+       struct proc_dir_entry   *proc_net_root;
+
+       struct net_device       *loopback_dev;          /* The loopback */
+
+       struct list_head        dev_base_head;
+       struct hlist_head       *dev_name_head;
+       struct hlist_head       *dev_index_head;
+};
+
+#ifdef CONFIG_NET
+/* Init's network namespace */
+extern struct net init_net;
+#define INIT_NET_NS(net_ns) .net_ns = &init_net,
+#else
+#define INIT_NET_NS(net_ns)
+#endif
+
 /* Added on 2.6.24 in include/linux/types.h by Al viro on commit 142956af */
 typedef unsigned long               uintptr_t;
 
index b7c3b05793cf0cf246c910716980bded43fb753c..0ea99b1503a7adb5a7e6d2ed605f8f6d663499ac 100644 (file)
@@ -11,7 +11,9 @@
 #include <linux/kernel.h>
 #include <linux/jiffies.h>
 #include <net/sock.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
 #include <net/net_namespace.h>
+#endif
 
 /* These jiffie helpers added as of 2.6.26 */