[ovs-dev] [PATCH 03/11] datapath: Remove namespace compat support.

Pravin B Shelar pshelar at nicira.com
Fri Aug 30 20:23:05 UTC 2013


Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
---
 datapath/linux/Modules.mk                         |    1 -
 datapath/linux/compat/include/net/genetlink.h     |   18 -----
 datapath/linux/compat/include/net/net_namespace.h |   80 +--------------------
 datapath/linux/compat/include/net/netns/generic.h |   12 ---
 datapath/linux/compat/net_namespace.c             |   35 ---------
 5 files changed, 1 insertions(+), 145 deletions(-)
 delete mode 100644 datapath/linux/compat/include/net/netns/generic.h

diff --git a/datapath/linux/Modules.mk b/datapath/linux/Modules.mk
index 178cd5e..15c518a 100644
--- a/datapath/linux/Modules.mk
+++ b/datapath/linux/Modules.mk
@@ -81,6 +81,5 @@ openvswitch_headers += \
 	linux/compat/include/net/protocol.h \
 	linux/compat/include/net/route.h \
 	linux/compat/include/net/sock.h \
-	linux/compat/include/net/netns/generic.h \
 	linux/compat/include/net/vxlan.h \
 	linux/compat/include/net/sctp/checksum.h
diff --git a/datapath/linux/compat/include/net/genetlink.h b/datapath/linux/compat/include/net/genetlink.h
index ac199ec..c17459b 100644
--- a/datapath/linux/compat/include/net/genetlink.h
+++ b/datapath/linux/compat/include/net/genetlink.h
@@ -49,8 +49,6 @@ extern int busted_nlmsg_multicast(struct sock *sk, struct sk_buff *skb,
 #define nlmsg_multicast rpl_nlmsg_multicast
 #endif	/* linux kernel < v2.6.19 */
 
-#include <net/net_namespace.h>
-
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
 
 #include <linux/genetlink.h>
@@ -112,11 +110,6 @@ static inline int genlmsg_multicast_flags(struct sk_buff *skb, u32 portid,
 }
 #endif /* linux kernel < 2.6.19 */
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
-#define genlmsg_multicast_netns(net, skb, portid, grp, flags) \
-		genlmsg_multicast(skb, portid, grp, flags)
-#endif
-
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
 
 #define genlmsg_put(skb, p, seq, fam, flg, c) \
@@ -174,15 +167,4 @@ int genl_register_family_with_ops(struct genl_family *family,
 extern void genl_notify(struct sk_buff *skb, struct net *net, u32 portid,
 			u32 group, struct nlmsghdr *nlh, gfp_t flags);
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) && \
-    LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
-static inline struct net *genl_info_net(struct genl_info *info)
-{
-	return &init_net;
-}
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
-#define genlmsg_unicast(ignore_net, skb, portid)   genlmsg_unicast(skb, portid)
-#endif
 #endif /* genetlink.h */
diff --git a/datapath/linux/compat/include/net/net_namespace.h b/datapath/linux/compat/include/net/net_namespace.h
index 440c601..198ab22 100644
--- a/datapath/linux/compat/include/net/net_namespace.h
+++ b/datapath/linux/compat/include/net/net_namespace.h
@@ -1,69 +1,10 @@
 #ifndef __NET_NET_NAMESPACE_WRAPPER_H
 #define __NET_NET_NAMESPACE_WRAPPER_H 1
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
-/* <net/net_namespace.h> exists, go ahead and include it. */
 #include_next <net/net_namespace.h>
-#else
-/* No network namespace support. */
-struct net;
-
-static inline struct net *hold_net(struct net *net)
-{
-	return net;
-}
-
-static inline void release_net(struct net *net)
-{
-}
-
-#define __net_init      __init
-#define __net_exit      __exit
-#endif /* 2.6.24 */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
-#ifdef CONFIG_NET_NS
-static inline
-int net_eq(const struct net *net1, const struct net *net2)
-{
-	return net1 == net2;
-}
-#else
-static inline
-int net_eq(const struct net *net1, const struct net *net2)
-{
-	return 1;
-}
-#endif /* CONFIG_NET_NS */
-#endif /* 2.6.26 */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
-#ifdef CONFIG_NET_NS
-
-static inline void write_pnet(struct net **pnet, struct net *net)
-{
-	*pnet = net;
-}
-
-static inline struct net *read_pnet(struct net * const *pnet)
-{
-	return *pnet;
-}
-
-#else
-
-#define write_pnet(pnet, net)   do { (void)(net); } while (0)
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
-#define read_pnet(pnet)         (&init_net)
-#else
-#define read_pnet(pnet)         (NULL)
-#endif /* 2.6.24 */
-
-#endif /* CONFIG_NET_NS */
-#endif /* 2.6.29 */
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
+/* for 2.6.32* */
 struct rpl_pernet_operations {
 	int (*init)(struct net *net);
 	void (*exit)(struct net *net);
@@ -76,12 +17,6 @@ struct rpl_pernet_operations {
 #define register_pernet_device rpl_register_pernet_gen_device
 #define unregister_pernet_device rpl_unregister_pernet_gen_device
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
-extern int rpl_register_pernet_gen_device(struct rpl_pernet_operations *ops);
-extern void rpl_unregister_pernet_gen_device(struct rpl_pernet_operations *ops);
-
-#else /* for 2.6.32* */
-
 int compat_init_net(struct net *net, struct rpl_pernet_operations *pnet);
 void compat_exit_net(struct net *net, struct rpl_pernet_operations *pnet);
 
@@ -110,18 +45,5 @@ static void rpl_unregister_pernet_gen_##TYPE(struct rpl_pernet_operations *rpl_p
 {											\
 	unregister_pernet_gen_##TYPE(*pnet_gen_##TYPE->id, &rpl_pnet->ops);		\
 }
-#endif
-#endif /* 2.6.33 */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32) || \
-    LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
-#define DEFINE_COMPAT_PNET_REG_FUNC(TYPE)
 #endif /* 2.6.33 */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
-#undef for_each_net
-#define for_each_net(net)   { net = NULL; }
-
-#endif /* 2.6.32 */
-
 #endif /* net/net_namespace.h wrapper */
diff --git a/datapath/linux/compat/include/net/netns/generic.h b/datapath/linux/compat/include/net/netns/generic.h
deleted file mode 100644
index 1a0303f..0000000
--- a/datapath/linux/compat/include/net/netns/generic.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef __NET_NET_NETNS_GENERIC_WRAPPER_H
-#define __NET_NET_NETNS_GENERIC_WRAPPER_H 1
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
-/* <net/netns/generic.h> exists, go ahead and include it. */
-#include_next <net/netns/generic.h>
-#else
-#define net_generic rpl_net_generic
-void *net_generic(const struct net *net, int id);
-#endif
-
-#endif /* net/netns/generic.h wrapper */
diff --git a/datapath/linux/compat/net_namespace.c b/datapath/linux/compat/net_namespace.c
index 843e6c1..1fba3b1 100644
--- a/datapath/linux/compat/net_namespace.c
+++ b/datapath/linux/compat/net_namespace.c
@@ -4,9 +4,6 @@
 #include <net/netns/generic.h>
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
-static int net_assign_generic(struct net *net, int id, void *data);
-#endif
 
 int compat_init_net(struct net *net, struct rpl_pernet_operations *pnet)
 {
@@ -41,35 +38,3 @@ void compat_exit_net(struct net *net, struct rpl_pernet_operations *pnet)
 	kfree(ovs_net);
 }
 #endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
-#define MAX_DATA_COUNT 2
-static struct net *net;
-
-static void *__ovs_net_data[MAX_DATA_COUNT];
-static int count;
-
-static int net_assign_generic(struct net *net, int id, void *data)
-{
-	BUG_ON(id >= MAX_DATA_COUNT);
-	__ovs_net_data[id] = data;
-	return 0;
-}
-
-void *net_generic(const struct net *net, int id)
-{
-	return __ovs_net_data[id];
-}
-
-int rpl_register_pernet_gen_device(struct rpl_pernet_operations *rpl_pnet)
-{
-	*rpl_pnet->id = count++;
-	return compat_init_net(net, rpl_pnet);
-}
-
-void rpl_unregister_pernet_gen_device(struct rpl_pernet_operations *rpl_pnet)
-{
-	compat_exit_net(net, rpl_pnet);
-}
-
-#endif
-- 
1.7.1




More information about the dev mailing list