| 1 | #ifndef _URCU_FLAVOR_H |
| 2 | #define _URCU_FLAVOR_H |
| 3 | |
| 4 | /* |
| 5 | * urcu-flavor.h |
| 6 | * |
| 7 | * Userspace RCU header - rcu flavor declarations |
| 8 | * |
| 9 | * Copyright (c) 2011 Lai Jiangshan <laijs@cn.fujitsu.com> |
| 10 | * |
| 11 | * This library is free software; you can redistribute it and/or |
| 12 | * modify it under the terms of the GNU Lesser General Public |
| 13 | * License as published by the Free Software Foundation; either |
| 14 | * version 2.1 of the License, or (at your option) any later version. |
| 15 | * |
| 16 | * This library is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 19 | * Lesser General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU Lesser General Public |
| 22 | * License along with this library; if not, write to the Free Software |
| 23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 24 | */ |
| 25 | |
| 26 | #ifdef __cplusplus |
| 27 | extern "C" { |
| 28 | #endif |
| 29 | |
| 30 | struct urcu_atfork { |
| 31 | void (*before_fork)(void *priv); |
| 32 | void (*after_fork_parent)(void *priv); |
| 33 | void (*after_fork_child)(void *priv); |
| 34 | void *priv; |
| 35 | }; |
| 36 | |
| 37 | void urcu_register_rculfhash_atfork(struct urcu_atfork *atfork); |
| 38 | void urcu_unregister_rculfhash_atfork(struct urcu_atfork *atfork); |
| 39 | |
| 40 | struct rcu_flavor_struct { |
| 41 | void (*read_lock)(void); |
| 42 | void (*read_unlock)(void); |
| 43 | int (*read_ongoing)(void); |
| 44 | void (*read_quiescent_state)(void); |
| 45 | void (*update_call_rcu)(struct rcu_head *head, |
| 46 | void (*func)(struct rcu_head *head)); |
| 47 | void (*update_synchronize_rcu)(void); |
| 48 | void (*update_defer_rcu)(void (*fct)(void *p), void *p); |
| 49 | |
| 50 | void (*thread_offline)(void); |
| 51 | void (*thread_online)(void); |
| 52 | void (*register_thread)(void); |
| 53 | void (*unregister_thread)(void); |
| 54 | |
| 55 | void (*barrier)(void); |
| 56 | |
| 57 | void (*register_rculfhash_atfork)(struct urcu_atfork *atfork); |
| 58 | void (*unregister_rculfhash_atfork)(struct urcu_atfork *atfork); |
| 59 | }; |
| 60 | |
| 61 | #define DEFINE_RCU_FLAVOR(x) \ |
| 62 | const struct rcu_flavor_struct x = { \ |
| 63 | .read_lock = rcu_read_lock, \ |
| 64 | .read_unlock = rcu_read_unlock, \ |
| 65 | .read_ongoing = rcu_read_ongoing, \ |
| 66 | .read_quiescent_state = rcu_quiescent_state, \ |
| 67 | .update_call_rcu = call_rcu, \ |
| 68 | .update_synchronize_rcu = synchronize_rcu, \ |
| 69 | .update_defer_rcu = defer_rcu, \ |
| 70 | .thread_offline = rcu_thread_offline, \ |
| 71 | .thread_online = rcu_thread_online, \ |
| 72 | .register_thread = rcu_register_thread, \ |
| 73 | .unregister_thread = rcu_unregister_thread,\ |
| 74 | .barrier = rcu_barrier, \ |
| 75 | .register_rculfhash_atfork = urcu_register_rculfhash_atfork, \ |
| 76 | .unregister_rculfhash_atfork = urcu_unregister_rculfhash_atfork,\ |
| 77 | } |
| 78 | |
| 79 | extern const struct rcu_flavor_struct rcu_flavor; |
| 80 | |
| 81 | #ifdef __cplusplus |
| 82 | } |
| 83 | #endif |
| 84 | |
| 85 | #endif /* _URCU_FLAVOR_H */ |