[ovs-dev] [compat 2/2] datapath: Get rid of compat.h, compat26.h in favor of modern approach.
Ben Pfaff
blp at nicira.com
Wed Jan 12 21:29:46 UTC 2011
I had completely forgotten that we had a top-level compat.h and compat26.h.
It's better to distribute their contents to individual compat headers, so
this commit does so and deletes them.
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
datapath/Modules.mk | 1 -
datapath/brcompat.c | 3 +-
datapath/compat.h | 25 -------------
datapath/datapath.c | 4 +--
datapath/flow.c | 4 +--
datapath/linux-2.6/Modules.mk | 1 -
datapath/linux-2.6/compat-2.6/compat26.h | 37 --------------------
.../linux-2.6/compat-2.6/include/linux/kernel.h | 4 ++
.../linux-2.6/compat-2.6/include/linux/netdevice.h | 7 ++++
datapath/linux-2.6/compat-2.6/include/linux/slab.h | 4 ++
datapath/vport-netdev.c | 4 +--
11 files changed, 19 insertions(+), 75 deletions(-)
delete mode 100644 datapath/compat.h
delete mode 100644 datapath/linux-2.6/compat-2.6/compat26.h
diff --git a/datapath/Modules.mk b/datapath/Modules.mk
index b4d40fd..01c1a71 100644
--- a/datapath/Modules.mk
+++ b/datapath/Modules.mk
@@ -31,7 +31,6 @@ openvswitch_sources = \
openvswitch_headers = \
actions.h \
checksum.h \
- compat.h \
datapath.h \
dp_sysfs.h \
flow.h \
diff --git a/datapath/brcompat.c b/datapath/brcompat.c
index f23db93..15cec9c 100644
--- a/datapath/brcompat.c
+++ b/datapath/brcompat.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009 Nicira Networks.
+ * Copyright (c) 2009, 2011 Nicira Networks.
* Distributed under the terms of the GNU GPL version 2.
*
* Significant portions of this file may be copied from parts of the Linux
@@ -17,7 +17,6 @@
#include <linux/rtnetlink.h>
#include <net/genetlink.h>
-#include "compat.h"
#include "openvswitch/brcompat-netlink.h"
#include "brc_procfs.h"
#include "datapath.h"
diff --git a/datapath/compat.h b/datapath/compat.h
deleted file mode 100644
index 84a222f..0000000
--- a/datapath/compat.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2009 Nicira Networks.
- * Distributed under the terms of the GNU GPL version 2.
- *
- * Significant portions of this file may be copied from parts of the Linux
- * kernel, by Linus Torvalds and others.
- */
-
-#ifndef COMPAT_H
-#define COMPAT_H 1
-
-#include <linux/version.h>
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-
-#include "compat26.h"
-
-#else
-
-#include "compat24.h"
-
-#endif
-
-
-#endif /* compat.h */
diff --git a/datapath/datapath.c b/datapath/datapath.c
index 4117ba9..f9af829 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2008, 2009, 2010 Nicira Networks.
+ * Copyright (c) 2007, 2008, 2009, 2010, 2011 Nicira Networks.
* Distributed under the terms of the GNU GPL version 2.
*
* Significant portions of this file may be copied from parts of the Linux
@@ -53,8 +53,6 @@
#include "table.h"
#include "vport-internal_dev.h"
-#include "compat.h"
-
int (*dp_ioctl_hook)(struct net_device *dev, struct ifreq *rq, int cmd);
EXPORT_SYMBOL(dp_ioctl_hook);
diff --git a/datapath/flow.c b/datapath/flow.c
index fb339e7..ccc72d3 100644
--- a/datapath/flow.c
+++ b/datapath/flow.c
@@ -1,6 +1,6 @@
/*
* Distributed under the terms of the GNU GPL version 2.
- * Copyright (c) 2007, 2008, 2009, 2010 Nicira Networks.
+ * Copyright (c) 2007, 2008, 2009, 2010, 2011 Nicira Networks.
*
* Significant portions of this file may be copied from parts of the Linux
* kernel, by Linus Torvalds and others.
@@ -29,8 +29,6 @@
#include <net/inet_ecn.h>
#include <net/ip.h>
-#include "compat.h"
-
static struct kmem_cache *flow_cache;
static unsigned int hash_seed __read_mostly;
diff --git a/datapath/linux-2.6/Modules.mk b/datapath/linux-2.6/Modules.mk
index 1bc092e..42514b1 100644
--- a/datapath/linux-2.6/Modules.mk
+++ b/datapath/linux-2.6/Modules.mk
@@ -8,7 +8,6 @@ openvswitch_sources += \
linux-2.6/compat-2.6/skbuff-openvswitch.c \
linux-2.6/compat-2.6/time.c
openvswitch_headers += \
- linux-2.6/compat-2.6/compat26.h \
linux-2.6/compat-2.6/include/asm-generic/bug.h \
linux-2.6/compat-2.6/include/linux/bottom_half.h \
linux-2.6/compat-2.6/include/linux/compiler.h \
diff --git a/datapath/linux-2.6/compat-2.6/compat26.h b/datapath/linux-2.6/compat-2.6/compat26.h
deleted file mode 100644
index 61448d6..0000000
--- a/datapath/linux-2.6/compat-2.6/compat26.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef __COMPAT26_H
-#define __COMPAT26_H 1
-
-#include <linux/version.h>
-
-#if defined(CONFIG_PREEMPT) && LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,21)
-#error "CONFIG_PREEMPT is broken with 2.6.x before 2.6.21--see commit 4498121ca3, \"[NET]: Handle disabled preemption in gfp_any()\""
-#endif
-
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23)
-/*----------------------------------------------------------------------------
- * In 2.6.24, a namespace argument became required for dev_get_by_name. */
-
-#define dev_get_by_name(net, name) \
- dev_get_by_name((name))
-
-#define dev_get_by_index(net, ifindex) \
- dev_get_by_index((ifindex))
-
-#define __dev_get_by_name(net, name) \
- __dev_get_by_name((name))
-
-#define __dev_get_by_index(net, ifindex) \
- __dev_get_by_index((ifindex))
-
-#endif /* linux kernel <= 2.6.23 */
-
-
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,22)
-/*----------------------------------------------------------------------------
- * In 2.6.23, the last argument was dropped from kmem_cache_create. */
-#define kmem_cache_create(n, s, a, f, c) \
- kmem_cache_create((n), (s), (a), (f), (c), NULL)
-
-#endif /* linux kernel <= 2.6.22 */
-
-#endif /* compat26.h */
diff --git a/datapath/linux-2.6/compat-2.6/include/linux/kernel.h b/datapath/linux-2.6/compat-2.6/include/linux/kernel.h
index 13361f7..356187f 100644
--- a/datapath/linux-2.6/compat-2.6/include/linux/kernel.h
+++ b/datapath/linux-2.6/compat-2.6/include/linux/kernel.h
@@ -38,4 +38,8 @@
#define pr_warn pr_warning
#endif
+#if defined(CONFIG_PREEMPT) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)
+#error "CONFIG_PREEMPT is broken before 2.6.21--see commit 4498121ca3, \"[NET]: Handle disabled preemption in gfp_any()\""
+#endif
+
#endif /* linux/kernel.h */
diff --git a/datapath/linux-2.6/compat-2.6/include/linux/netdevice.h b/datapath/linux-2.6/compat-2.6/include/linux/netdevice.h
index ac1ff82..3856bb6 100644
--- a/datapath/linux-2.6/compat-2.6/include/linux/netdevice.h
+++ b/datapath/linux-2.6/compat-2.6/include/linux/netdevice.h
@@ -116,4 +116,11 @@ static inline void netdev_rx_handler_unregister(struct net_device *dev)
( (netdev)->ethtool_ops = (struct ethtool_ops *)(ops) )
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
+#define dev_get_by_name(net, name) dev_get_by_name(name)
+#define dev_get_by_index(net, ifindex) dev_get_by_index(ifindex)
+#define __dev_get_by_name(net, name) __dev_get_by_name(name)
+#define __dev_get_by_index(net, ifindex) __dev_get_by_index(ifindex)
+#endif
+
#endif
diff --git a/datapath/linux-2.6/compat-2.6/include/linux/slab.h b/datapath/linux-2.6/compat-2.6/include/linux/slab.h
index 5c54c18..7e9c3f4 100644
--- a/datapath/linux-2.6/compat-2.6/include/linux/slab.h
+++ b/datapath/linux-2.6/compat-2.6/include/linux/slab.h
@@ -7,4 +7,8 @@
extern void *kmemdup(const void *src, size_t len, gfp_t gfp);
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+#define kmem_cache_create(n, s, a, f, c) kmem_cache_create(n, s, a, f, c, NULL)
+#endif
+
#endif
diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c
index d492d19..363651b 100644
--- a/datapath/vport-netdev.c
+++ b/datapath/vport-netdev.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Nicira Networks.
+ * Copyright (c) 2010, 2011 Nicira Networks.
* Distributed under the terms of the GNU GPL version 2.
*
* Significant portions of this file may be copied from parts of the Linux
@@ -21,8 +21,6 @@
#include "vport-internal_dev.h"
#include "vport-netdev.h"
-#include "compat.h"
-
/* If the native device stats aren't 64 bit use the vport stats tracking instead. */
#define USE_VPORT_STATS (sizeof(((struct net_device_stats *)0)->rx_bytes) < sizeof(u64))
--
1.7.1
More information about the dev
mailing list