Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
rculist_nulls.h
Go to the documentation of this file.
1 #ifndef _LINUX_RCULIST_NULLS_H
2 #define _LINUX_RCULIST_NULLS_H
3 
4 #ifdef __KERNEL__
5 
6 /*
7  * RCU-protected list version
8  */
9 #include <linux/list_nulls.h>
10 #include <linux/rcupdate.h>
11 
32 static inline void hlist_nulls_del_init_rcu(struct hlist_nulls_node *n)
33 {
34  if (!hlist_nulls_unhashed(n)) {
35  __hlist_nulls_del(n);
36  n->pprev = NULL;
37  }
38 }
39 
40 #define hlist_nulls_first_rcu(head) \
41  (*((struct hlist_nulls_node __rcu __force **)&(head)->first))
42 
43 #define hlist_nulls_next_rcu(node) \
44  (*((struct hlist_nulls_node __rcu __force **)&(node)->next))
45 
65 static inline void hlist_nulls_del_rcu(struct hlist_nulls_node *n)
66 {
67  __hlist_nulls_del(n);
68  n->pprev = LIST_POISON2;
69 }
70 
90 static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n,
91  struct hlist_nulls_head *h)
92 {
93  struct hlist_nulls_node *first = h->first;
94 
95  n->next = first;
96  n->pprev = &h->first;
97  rcu_assign_pointer(hlist_nulls_first_rcu(h), n);
98  if (!is_a_nulls(first))
99  first->pprev = &n->next;
100 }
109 #define hlist_nulls_for_each_entry_rcu(tpos, pos, head, member) \
110  for (pos = rcu_dereference_raw(hlist_nulls_first_rcu(head)); \
111  (!is_a_nulls(pos)) && \
112  ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \
113  pos = rcu_dereference_raw(hlist_nulls_next_rcu(pos)))
114 
115 #endif
116 #endif