Commit | Line | Data |
---|---|---|
d3d3857f MJ |
1 | // SPDX-FileCopyrightText: 2011 Lai Jiangshan <laijs@cn.fujitsu.com> |
2 | // | |
3 | // SPDX-License-Identifier: LGPL-2.1-or-later | |
4 | ||
541d828d LJ |
5 | #ifndef _URCU_FLAVOR_H |
6 | #define _URCU_FLAVOR_H | |
7 | ||
8 | /* | |
541d828d | 9 | * Userspace RCU header - rcu flavor declarations |
541d828d LJ |
10 | */ |
11 | ||
111bda8f MD |
12 | #include <urcu/urcu-poll.h> |
13 | ||
541d828d LJ |
14 | #ifdef __cplusplus |
15 | extern "C" { | |
16 | #endif | |
17 | ||
6bcce235 MD |
18 | struct rcu_head; |
19 | ||
d0ec0ed2 MD |
20 | struct urcu_atfork { |
21 | void (*before_fork)(void *priv); | |
22 | void (*after_fork_parent)(void *priv); | |
23 | void (*after_fork_child)(void *priv); | |
24 | void *priv; | |
25 | }; | |
26 | ||
27 | void urcu_register_rculfhash_atfork(struct urcu_atfork *atfork); | |
28 | void urcu_unregister_rculfhash_atfork(struct urcu_atfork *atfork); | |
29 | ||
541d828d LJ |
30 | struct rcu_flavor_struct { |
31 | void (*read_lock)(void); | |
32 | void (*read_unlock)(void); | |
882f3357 | 33 | int (*read_ongoing)(void); |
541d828d LJ |
34 | void (*read_quiescent_state)(void); |
35 | void (*update_call_rcu)(struct rcu_head *head, | |
36 | void (*func)(struct rcu_head *head)); | |
37 | void (*update_synchronize_rcu)(void); | |
38 | void (*update_defer_rcu)(void (*fct)(void *p), void *p); | |
39 | ||
40 | void (*thread_offline)(void); | |
41 | void (*thread_online)(void); | |
42 | void (*register_thread)(void); | |
43 | void (*unregister_thread)(void); | |
b7f721d9 MD |
44 | |
45 | void (*barrier)(void); | |
d0ec0ed2 MD |
46 | |
47 | void (*register_rculfhash_atfork)(struct urcu_atfork *atfork); | |
48 | void (*unregister_rculfhash_atfork)(struct urcu_atfork *atfork); | |
111bda8f MD |
49 | |
50 | struct urcu_gp_poll_state (*update_start_poll_synchronize_rcu)(void); | |
51 | bool (*update_poll_state_synchronize_rcu)(struct urcu_gp_poll_state state); | |
541d828d LJ |
52 | }; |
53 | ||
5e6b23a6 MD |
54 | #define DEFINE_RCU_FLAVOR(x) \ |
55 | const struct rcu_flavor_struct x = { \ | |
541d828d LJ |
56 | .read_lock = rcu_read_lock, \ |
57 | .read_unlock = rcu_read_unlock, \ | |
882f3357 | 58 | .read_ongoing = rcu_read_ongoing, \ |
541d828d LJ |
59 | .read_quiescent_state = rcu_quiescent_state, \ |
60 | .update_call_rcu = call_rcu, \ | |
61 | .update_synchronize_rcu = synchronize_rcu, \ | |
62 | .update_defer_rcu = defer_rcu, \ | |
63 | .thread_offline = rcu_thread_offline, \ | |
64 | .thread_online = rcu_thread_online, \ | |
65 | .register_thread = rcu_register_thread, \ | |
66 | .unregister_thread = rcu_unregister_thread,\ | |
b7f721d9 | 67 | .barrier = rcu_barrier, \ |
d0ec0ed2 MD |
68 | .register_rculfhash_atfork = urcu_register_rculfhash_atfork, \ |
69 | .unregister_rculfhash_atfork = urcu_unregister_rculfhash_atfork,\ | |
111bda8f MD |
70 | .update_start_poll_synchronize_rcu = start_poll_synchronize_rcu,\ |
71 | .update_poll_state_synchronize_rcu = poll_state_synchronize_rcu,\ | |
5e6b23a6 | 72 | } |
541d828d LJ |
73 | |
74 | extern const struct rcu_flavor_struct rcu_flavor; | |
75 | ||
76 | #ifdef __cplusplus | |
77 | } | |
78 | #endif | |
79 | ||
80 | #endif /* _URCU_FLAVOR_H */ |