From: Ben Pfaff Date: Wed, 12 Jan 2011 18:44:43 +0000 (-0800) Subject: datapath: Get rid of compat.h, compat26.h in favor of modern approach. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f632c8fc817ff5597007a795b51574bddd32563a;p=openvswitch datapath: Get rid of compat.h, compat26.h in favor of modern approach. 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 Acked-by: Jesse Gross --- diff --git a/datapath/Modules.mk b/datapath/Modules.mk index b4d40fd1..01c1a713 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 f23db93c..15cec9c9 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 #include -#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 84a222f9..00000000 --- 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 - -#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 4117ba9d..f9af8299 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 fb339e73..ccc72d34 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 #include -#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 1bc092e1..42514b16 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 61448d63..00000000 --- a/datapath/linux-2.6/compat-2.6/compat26.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __COMPAT26_H -#define __COMPAT26_H 1 - -#include - -#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 13361f78..356187f7 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 ac1ff828..3856bb60 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 5c54c18a..7e9c3f4e 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 d492d19b..363651bd 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))