]> git.openfabrics.org - ~emulex/for-vlad/old/compat.git/commitdiff
compat: backport net_ns_type_operations
authorHauke Mehrtens <hauke@hauke-m.de>
Tue, 17 Aug 2010 18:32:32 +0000 (20:32 +0200)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Tue, 17 Aug 2010 22:01:07 +0000 (15:01 -0700)
net_ns_type_operations needs to be exported. This only works for kernel
>= 2.6.35 because struct kobj_ns_type_operations was introduced in
kernel 2.6.35.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
compat/Makefile
compat/compat-2.6.37.c [new file with mode: 0644]
include/linux/compat-2.6.37.h

index bcd8fe76df0b369cd7c424ac6a5b330df6837b40..b067be2723353649a28c60cc59d50e98c8693130 100644 (file)
@@ -27,3 +27,4 @@ compat-$(CONFIG_COMPAT_KERNEL_31) += compat-2.6.31.o
 compat-$(CONFIG_COMPAT_KERNEL_32) += compat-2.6.32.o
 compat-$(CONFIG_COMPAT_KERNEL_33) += compat-2.6.33.o
 compat-$(CONFIG_COMPAT_KERNEL_35) += compat-2.6.35.o
+compat-$(CONFIG_COMPAT_KERNEL_37) += compat-2.6.37.o
diff --git a/compat/compat-2.6.37.c b/compat/compat-2.6.37.c
new file mode 100644 (file)
index 0000000..655b92f
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2010    Hauke Mehrtens <hauke@hauke-m.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Compatibility file for Linux wireless for kernels 2.6.37.
+ */
+
+#include <linux/compat.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
+
+#include <linux/netdevice.h>
+#include <net/sock.h>
+#include <linux/nsproxy.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
+static const void *net_current_ns(void)
+{
+       return current->nsproxy->net_ns;
+}
+
+static const void *net_initial_ns(void)
+{
+       return &init_net;
+}
+
+static const void *net_netlink_ns(struct sock *sk)
+{
+       return sock_net(sk);
+}
+
+struct kobj_ns_type_operations net_ns_type_operations = {
+       .type = KOBJ_NS_TYPE_NET,
+       .current_ns = net_current_ns,
+       .netlink_ns = net_netlink_ns,
+       .initial_ns = net_initial_ns,
+};
+EXPORT_SYMBOL_GPL(net_ns_type_operations);
+
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)*/ 
+
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37) */
index cf0279e71c697c4f980fc34e0663817919296a89..5bd6edb03f382deb7a1d86e5daefc4e510bb3ebe 100644 (file)
@@ -24,6 +24,8 @@
 
 #define SDIO_CLASS_BT_AMP      0x09    /* Type-A Bluetooth AMP interface */
 
+extern struct kobj_ns_type_operations net_ns_type_operations;
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) */
 
 #endif /* LINUX_26_37_COMPAT_H */