]>
Commit | Line | Data |
---|---|---|
064af421 BP |
1 | #ifndef __LINUX_RCULIST_WRAPPER_H |
2 | #define __LINUX_RCULIST_WRAPPER_H | |
3 | ||
064af421 | 4 | #include_next <linux/rculist.h> |
3544358a | 5 | |
05a5321e JG |
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 | ||
82367043 JFG |
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 | ||
29285b62 | 30 | #undef hlist_for_each_entry_rcu |
82367043 JFG |
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)),\ | |
29285b62 JG |
34 | typeof(*(pos)), member); \ |
35 | pos; \ | |
36 | pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu(\ | |
37 | &(pos)->member)), typeof(*(pos)), member)) | |
38 | ||
064af421 | 39 | #endif |