1 #ifndef __TOOLS_LINUX_RCUPDATE_H
2 #define __TOOLS_LINUX_RCUPDATE_H
5 #include <linux/compiler.h>
7 #define rcu_dereference_check(p, c) rcu_dereference(p)
8 #define rcu_dereference_raw(p) rcu_dereference(p)
9 #define rcu_dereference_protected(p, c) rcu_dereference(p)
10 #define rcu_access_pointer(p) READ_ONCE(p)
12 #define kfree_rcu(ptr, rcu_head) kfree(ptr) /* XXX */
14 #define RCU_INIT_POINTER(p, v) WRITE_ONCE(p, v)
16 /* Has the specified rcu_head structure been handed to call_rcu()? */
19 * rcu_head_init - Initialize rcu_head for rcu_head_after_call_rcu()
20 * @rhp: The rcu_head structure to initialize.
22 * If you intend to invoke rcu_head_after_call_rcu() to test whether a
23 * given rcu_head structure has already been passed to call_rcu(), then
24 * you must also invoke this rcu_head_init() function on it just after
25 * allocating that structure. Calls to this function must not race with
26 * calls to call_rcu(), rcu_head_after_call_rcu(), or callback invocation.
28 static inline void rcu_head_init(struct rcu_head *rhp)
30 rhp->func = (void *)~0L;
34 rcu_head_after_call_rcu(struct rcu_head *rhp,
35 void (*f)(struct rcu_head *head))
37 void (*func)(struct rcu_head *head) = READ_ONCE(rhp->func);
44 #endif /* __TOOLS_LINUX_RCUPDATE_H */