]>
Commit | Line | Data |
---|---|---|
1 | #ifndef __LINUX_RCULIST_WRAPPER_H | |
2 | #define __LINUX_RCULIST_WRAPPER_H | |
3 | ||
4 | #include_next <linux/rculist.h> | |
5 | ||
6 | #ifndef hlist_first_rcu | |
7 | #define hlist_first_rcu(head) (*((struct hlist_node __rcu **)(&(head)->first))) | |
8 | #define hlist_next_rcu(node) (*((struct hlist_node __rcu **)(&(node)->next))) | |
9 | #define hlist_pprev_rcu(node) (*((struct hlist_node __rcu **)((node)->pprev))) | |
10 | #endif | |
11 | ||
12 | /* | |
13 | * Check during list traversal that we are within an RCU reader | |
14 | */ | |
15 | ||
16 | #define check_arg_count_one(dummy) | |
17 | ||
18 | #ifdef CONFIG_PROVE_RCU_LIST | |
19 | #define __list_check_rcu(dummy, cond, extra...) \ | |
20 | ({ \ | |
21 | check_arg_count_one(extra); \ | |
22 | RCU_LOCKDEP_WARN(!cond && !rcu_read_lock_any_held(), \ | |
23 | "RCU-list traversed in non-reader section!"); \ | |
24 | }) | |
25 | #else | |
26 | #define __list_check_rcu(dummy, cond, extra...) \ | |
27 | ({ check_arg_count_one(extra); }) | |
28 | #endif | |
29 | ||
30 | #undef hlist_for_each_entry_rcu | |
31 | #define hlist_for_each_entry_rcu(pos, head, member, cond...) \ | |
32 | for (__list_check_rcu(dummy, ## cond, 0), \ | |
33 | pos = hlist_entry_safe(rcu_dereference_raw(hlist_first_rcu(head)),\ | |
34 | typeof(*(pos)), member); \ | |
35 | pos; \ | |
36 | pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu(\ | |
37 | &(pos)->member)), typeof(*(pos)), member)) | |
38 | ||
39 | #endif |