[ovs-dev] [netlink v4+4] datapath: Move rcu_read_lock_held(), rcu_dereference_*() to rcupdate.h.
Ben Pfaff
blp at nicira.com
Mon Jan 24 22:05:27 UTC 2011
<linux/rcupdate.h> is the normal location of these functions, so we should
not put compat code for them in <linux/rtnetlink.h>.
This caused build failures for datapath/table.c, which in later commits
uses rcu_dereference_check() and rcu_dereference_protected() but does not
need RTNL.
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
datapath/linux-2.6/Modules.mk | 1 +
.../linux-2.6/compat-2.6/include/linux/rcupdate.h | 21 ++++++++++++++++++++
.../linux-2.6/compat-2.6/include/linux/rtnetlink.h | 13 ------------
3 files changed, 22 insertions(+), 13 deletions(-)
create mode 100644 datapath/linux-2.6/compat-2.6/include/linux/rcupdate.h
diff --git a/datapath/linux-2.6/Modules.mk b/datapath/linux-2.6/Modules.mk
index 42514b1..2e779aa 100644
--- a/datapath/linux-2.6/Modules.mk
+++ b/datapath/linux-2.6/Modules.mk
@@ -35,6 +35,7 @@ openvswitch_headers += \
linux-2.6/compat-2.6/include/linux/netfilter_ipv4.h \
linux-2.6/compat-2.6/include/linux/netlink.h \
linux-2.6/compat-2.6/include/linux/rculist.h \
+ linux-2.6/compat-2.6/include/linux/rcupdate.h \
linux-2.6/compat-2.6/include/linux/rtnetlink.h \
linux-2.6/compat-2.6/include/linux/skbuff.h \
linux-2.6/compat-2.6/include/linux/slab.h \
diff --git a/datapath/linux-2.6/compat-2.6/include/linux/rcupdate.h b/datapath/linux-2.6/compat-2.6/include/linux/rcupdate.h
new file mode 100644
index 0000000..f96299f
--- /dev/null
+++ b/datapath/linux-2.6/compat-2.6/include/linux/rcupdate.h
@@ -0,0 +1,21 @@
+#ifndef __RCUPDATE_WRAPPER_H
+#define __RCUPDATE_WRAPPER_H 1
+
+#include_next <linux/rcupdate.h>
+
+#ifndef rcu_dereference_check
+#define rcu_dereference_check(p, c) rcu_dereference(p)
+#endif
+
+#ifndef rcu_dereference_protected
+#define rcu_dereference_protected(p, c) (p)
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)
+static inline int rcu_read_lock_held(void)
+{
+ return 1;
+}
+#endif
+
+#endif /* linux/rcupdate.h wrapper */
diff --git a/datapath/linux-2.6/compat-2.6/include/linux/rtnetlink.h b/datapath/linux-2.6/compat-2.6/include/linux/rtnetlink.h
index bb9bc37..59be83f 100644
--- a/datapath/linux-2.6/compat-2.6/include/linux/rtnetlink.h
+++ b/datapath/linux-2.6/compat-2.6/include/linux/rtnetlink.h
@@ -53,19 +53,6 @@ static inline int lockdep_rtnl_is_held(void)
return 1;
}
#endif
-
-static inline int rcu_read_lock_held(void)
-{
- return 1;
-}
-#endif
-
-#ifndef rcu_dereference_check
-#define rcu_dereference_check(p, c) rcu_dereference(p)
-#endif
-
-#ifndef rcu_dereference_protected
-#define rcu_dereference_protected(p, c) (p)
#endif
#ifndef rcu_dereference_rtnl
--
1.7.1
More information about the dev
mailing list