X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=wrapper%2Flist.h;h=25e804069b71dd01f457c48b58cbc8c4e3022c50;hb=2d16de12b197aed57212826187bcb0ab24ad071e;hp=c816684ddf7eb35fd5421f285b80e5182c1ff305;hpb=f934e302d314d76563484f31caed56ad680eb17b;p=lttng-modules.git diff --git a/wrapper/list.h b/wrapper/list.h index c816684d..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; \ @@ -57,28 +64,4 @@ pos && ({ n = pos->member.next; 1; }); \ pos = lttng_hlist_entry_safe(n, typeof(*pos), member)) -#ifndef rcu_dereference_raw_notrace -#define rcu_dereference_raw_notrace(p) rcu_dereference_raw(p) -#endif - -/** - * lttng_hlist_for_each_entry_rcu_notrace - iterate over rcu list of given type (for tracing) - * @pos: the type * to use as a loop cursor. - * @head: the head for your list. - * @member: the name of the hlist_node within the struct. - * - * This list-traversal primitive may safely run concurrently with - * the _rcu list-mutation primitives such as hlist_add_head_rcu() - * as long as the traversal is guarded by rcu_read_lock(). - * - * This is the same as hlist_for_each_entry_rcu() except that it does - * not do any RCU debugging or tracing. - */ -#define lttng_hlist_for_each_entry_rcu_notrace(pos, head, member) \ - for (pos = lttng_hlist_entry_safe (rcu_dereference_raw_notrace(hlist_first_rcu(head)),\ - typeof(*(pos)), member); \ - pos; \ - pos = lttng_hlist_entry_safe(rcu_dereference_raw_notrace(hlist_next_rcu(\ - &(pos)->member)), typeof(*(pos)), member)) - #endif /* _LTTNG_WRAPPER_LIST_H */