| 1 | /* |
| 2 | * SPDX-License-Identifier: MIT |
| 3 | * |
| 4 | * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 5 | */ |
| 6 | |
| 7 | #ifndef _LTTNG_UST_TRACEPOINT_RCU_H |
| 8 | #define _LTTNG_UST_TRACEPOINT_RCU_H |
| 9 | |
| 10 | #include <urcu/compiler.h> |
| 11 | #include <lttng/urcu/pointer.h> |
| 12 | #include <lttng/ust-api-compat.h> |
| 13 | |
| 14 | #ifdef _LGPL_SOURCE |
| 15 | |
| 16 | #include <lttng/urcu/urcu-ust.h> |
| 17 | |
| 18 | #define lttng_ust_tp_rcu_read_lock lttng_ust_urcu_read_lock |
| 19 | #define lttng_ust_tp_rcu_read_unlock lttng_ust_urcu_read_unlock |
| 20 | #define lttng_ust_tp_rcu_dereference lttng_ust_rcu_dereference |
| 21 | #define LTTNG_UST_TP_RCU_LINK_TEST() 1 |
| 22 | |
| 23 | #else /* _LGPL_SOURCE */ |
| 24 | |
| 25 | #define lttng_ust_tp_rcu_read_lock lttng_ust_tracepoint_dlopen_ptr->rcu_read_lock_sym |
| 26 | #define lttng_ust_tp_rcu_read_unlock lttng_ust_tracepoint_dlopen_ptr->rcu_read_unlock_sym |
| 27 | |
| 28 | #define lttng_ust_tp_rcu_dereference(p) \ |
| 29 | URCU_FORCE_CAST(__typeof__(p), \ |
| 30 | lttng_ust_tracepoint_dlopen_ptr->rcu_dereference_sym(URCU_FORCE_CAST(void *, p))) |
| 31 | |
| 32 | #define LTTNG_UST_TP_RCU_LINK_TEST() (lttng_ust_tracepoint_dlopen_ptr && lttng_ust_tp_rcu_read_lock) |
| 33 | |
| 34 | #endif /* _LGPL_SOURCE */ |
| 35 | |
| 36 | #if LTTNG_UST_COMPAT_API(0) |
| 37 | #define tp_rcu_read_lock lttng_ust_tp_rcu_read_lock |
| 38 | #define tp_rcu_read_unlock lttng_ust_tp_rcu_read_unlock |
| 39 | #define tp_rcu_dereference lttng_ust_tp_rcu_dereference |
| 40 | #define TP_RCU_LINK_TEST LTTNG_UST_TP_RCU_LINK_TEST |
| 41 | #endif |
| 42 | |
| 43 | #endif /* _LTTNG_UST_TRACEPOINT_RCU_H */ |