datapath: Provide additional RCU backports.
authorJesse Gross <jesse@nicira.com>
Fri, 15 Mar 2013 19:20:12 +0000 (12:20 -0700)
committerJesse Gross <jesse@nicira.com>
Fri, 15 Mar 2013 19:20:12 +0000 (12:20 -0700)
A recent commit started using rcu_dereference_raw, hlist_first_rcu,
and hlist_next_rcu so this provides backports for kernels where they
don't exist.

Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath/linux/compat/include/linux/rculist.h
datapath/linux/compat/include/linux/rcupdate.h

index fd9bf10..365d126 100644 (file)
@@ -7,6 +7,7 @@
 #else
 /* Prior to 2.6.26, the contents of rculist.h were part of list.h. */
 #include <linux/list.h>
+#include <linux/rcupdate.h>
 #endif
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
@@ -20,6 +21,12 @@ static inline void hlist_del_init_rcu(struct hlist_node *n)
 }
 #endif
 
+#ifndef hlist_first_rcu
+#define hlist_first_rcu(head)   (*((struct hlist_node __rcu **)(&(head)->first)))
+#define hlist_next_rcu(node)    (*((struct hlist_node __rcu **)(&(node)->next)))
+#define hlist_pprev_rcu(node)   (*((struct hlist_node __rcu **)((node)->pprev)))
+#endif
+
 #undef hlist_for_each_entry_rcu
 #define hlist_for_each_entry_rcu(pos, head, member)                    \
        for (pos = hlist_entry_safe (rcu_dereference_raw(hlist_first_rcu(head)),\
index 99459ea..20cdedf 100644 (file)
 #define rcu_dereference_protected(p, c) (p)
 #endif
 
+#ifndef rcu_dereference_raw
+#define rcu_dereference_raw(p) rcu_dereference_check(p, 1)
+#endif
+
 #ifndef HAVE_RCU_READ_LOCK_HELD
 static inline int rcu_read_lock_held(void)
 {