From: Mathieu Desnoyers Date: Thu, 23 Apr 2015 21:39:35 +0000 (-0400) Subject: Fix: add hlist lttng wrappers X-Git-Tag: v2.7.0-rc1~39 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ac5d8d008d298c7c08101d4a521686578deec6a9;p=lttng-modules.git Fix: add hlist lttng wrappers For older kernels (e.g. 2.6.38). Signed-off-by: Mathieu Desnoyers --- diff --git a/wrapper/list.h b/wrapper/list.h index 0d79e512..25e80406 100644 --- a/wrapper/list.h +++ b/wrapper/list.h @@ -29,6 +29,13 @@ #include #include +/* + * return the first or the next element in an RCU protected hlist + */ +#define lttng_hlist_first_rcu(head) (*((struct hlist_node __rcu **)(&(head)->first))) +#define lttng_hlist_next_rcu(node) (*((struct hlist_node __rcu **)(&(node)->next))) +#define lttng_hlist_pprev_rcu(node) (*((struct hlist_node __rcu **)((node)->pprev))) + #define lttng_hlist_entry_safe(ptr, type, member) \ ({ typeof(ptr) ____ptr = (ptr); \ ____ptr ? hlist_entry(____ptr, type, member) : NULL; \ diff --git a/wrapper/rcu.h b/wrapper/rcu.h index d96d42d1..8c4cd744 100644 --- a/wrapper/rcu.h +++ b/wrapper/rcu.h @@ -81,10 +81,10 @@ * not do any RCU debugging or tracing. */ #define lttng_hlist_for_each_entry_rcu(pos, head, member) \ - for (pos = lttng_hlist_entry_safe (lttng_rcu_dereference(hlist_first_rcu(head)), \ + for (pos = lttng_hlist_entry_safe (lttng_rcu_dereference(lttng_hlist_first_rcu(head)), \ typeof(*(pos)), member); \ pos; \ - pos = lttng_hlist_entry_safe(lttng_rcu_dereference(hlist_next_rcu( \ + pos = lttng_hlist_entry_safe(lttng_rcu_dereference(lttng_hlist_next_rcu( \ &(pos)->member)), typeof(*(pos)), member)) #endif /* _LTTNG_WRAPPER_RCU_H */