1 #ifndef _LINUX_RCULIST_H
2 #define _LINUX_RCULIST_H
9 #include <linux/list.h>
25 #define list_next_rcu(list) (*((struct list_head __rcu **)(&(list)->next)))
33 #ifndef CONFIG_DEBUG_LIST
84 static inline void list_add_tail_rcu(
struct list_head *
new,
140 static inline void hlist_del_init_rcu(
struct hlist_node *
n)
142 if (!hlist_unhashed(n)) {
156 static inline void list_replace_rcu(
struct list_head *old,
159 new->next = old->
next;
160 new->prev = old->
prev;
162 new->next->prev =
new;
183 static inline void list_splice_init_rcu(
struct list_head *
list,
191 if (list_empty(list))
196 INIT_LIST_HEAD(list);
230 #define list_entry_rcu(ptr, type, member) \
231 ({typeof (*ptr) __rcu *__ptr = (typeof (*ptr) __rcu __force *)ptr; \
232 container_of((typeof(ptr))rcu_dereference_raw(__ptr), type, member); \
268 #define list_first_or_null_rcu(ptr, type, member) \
269 ({struct list_head *__ptr = (ptr); \
270 struct list_head __rcu *__next = list_next_rcu(__ptr); \
271 likely(__ptr != __next) ? container_of(__next, type, member) : NULL; \
284 #define list_for_each_entry_rcu(pos, head, member) \
285 for (pos = list_entry_rcu((head)->next, typeof(*pos), member); \
286 &pos->member != (head); \
287 pos = list_entry_rcu(pos->member.next, typeof(*pos), member))
301 #define list_for_each_continue_rcu(pos, head) \
302 for ((pos) = rcu_dereference_raw(list_next_rcu(pos)); \
304 (pos) = rcu_dereference_raw(list_next_rcu(pos)))
315 #define list_for_each_entry_continue_rcu(pos, head, member) \
316 for (pos = list_entry_rcu(pos->member.next, typeof(*pos), member); \
317 &pos->member != (head); \
318 pos = list_entry_rcu(pos->member.next, typeof(*pos), member))
339 static inline void hlist_del_rcu(
struct hlist_node *n)
352 static inline void hlist_replace_rcu(
struct hlist_node *old,
358 new->pprev = old->
pprev;
361 new->next->pprev = &
new->next;
368 #define hlist_first_rcu(head) (*((struct hlist_node __rcu **)(&(head)->first)))
369 #define hlist_next_rcu(node) (*((struct hlist_node __rcu **)(&(node)->next)))
370 #define hlist_pprev_rcu(node) (*((struct hlist_node __rcu **)((node)->pprev)))
391 static inline void hlist_add_head_rcu(
struct hlist_node *n,
421 static inline void hlist_add_before_rcu(
struct hlist_node *n,
448 static inline void hlist_add_after_rcu(
struct hlist_node *prev,
458 #define __hlist_for_each_rcu(pos, head) \
459 for (pos = rcu_dereference(hlist_first_rcu(head)); \
461 pos = rcu_dereference(hlist_next_rcu(pos)))
474 #define hlist_for_each_entry_rcu(tpos, pos, head, member) \
475 for (pos = rcu_dereference_raw(hlist_first_rcu(head)); \
477 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
478 pos = rcu_dereference_raw(hlist_next_rcu(pos)))
491 #define hlist_for_each_entry_rcu_bh(tpos, pos, head, member) \
492 for (pos = rcu_dereference_bh((head)->first); \
494 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
495 pos = rcu_dereference_bh(pos->next))
503 #define hlist_for_each_entry_continue_rcu(tpos, pos, member) \
504 for (pos = rcu_dereference((pos)->next); \
506 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
507 pos = rcu_dereference(pos->next))
515 #define hlist_for_each_entry_continue_rcu_bh(tpos, pos, member) \
516 for (pos = rcu_dereference_bh((pos)->next); \
518 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
519 pos = rcu_dereference_bh(pos->next))