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