From 4c4626e870c14cbd26024f648d87450871c64e8e Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 17 Aug 2010 20:32:32 +0200 Subject: [PATCH] compat: backport net_ns_type_operations 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 --- compat/Makefile | 1 + compat/compat-2.6.37.c | 45 +++++++++++++++++++++++++++++++++++ include/linux/compat-2.6.37.h | 2 ++ 3 files changed, 48 insertions(+) create mode 100644 compat/compat-2.6.37.c diff --git a/compat/Makefile b/compat/Makefile index bcd8fe76df0b..b067be272335 100644 --- a/compat/Makefile +++ b/compat/Makefile @@ -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 index 000000000000..655b92fc2be2 --- /dev/null +++ b/compat/compat-2.6.37.c @@ -0,0 +1,45 @@ +/* + * Copyright 2010 Hauke Mehrtens + * + * 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 + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37) + +#include +#include +#include + +#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) */ diff --git a/include/linux/compat-2.6.37.h b/include/linux/compat-2.6.37.h index cf0279e71c69..5bd6edb03f38 100644 --- a/include/linux/compat-2.6.37.h +++ b/include/linux/compat-2.6.37.h @@ -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 */ -- 2.30.2