From: Michael Jeanson Date: Wed, 21 Apr 2021 18:33:28 +0000 (-0400) Subject: Tracepoint API namespacing tracepoint-rcu X-Git-Tag: v2.13.0-rc1~34 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=251c9f75028bda8453a048978ec221b70a652153;p=lttng-ust.git Tracepoint API namespacing tracepoint-rcu The ABI bump gives us the opportunity to namespace all public symbols under the 'lttng_ust_' prefix. Namespace all API symbols and macros under 'lttng_ust_' / 'LTTNG_UST_' and add compat macros to keep compatibility with the previous API. Change-Id: Ia07f15d7dd01c6d1e86033c83d329888bb52553f Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/include/lttng/tracepoint-rcu.h b/include/lttng/tracepoint-rcu.h index 552af64a..28988458 100644 --- a/include/lttng/tracepoint-rcu.h +++ b/include/lttng/tracepoint-rcu.h @@ -9,27 +9,35 @@ #include #include +#include #ifdef _LGPL_SOURCE #include -#define tp_rcu_read_lock lttng_ust_urcu_read_lock -#define tp_rcu_read_unlock lttng_ust_urcu_read_unlock -#define tp_rcu_dereference lttng_ust_rcu_dereference -#define TP_RCU_LINK_TEST() 1 +#define lttng_ust_tp_rcu_read_lock lttng_ust_urcu_read_lock +#define lttng_ust_tp_rcu_read_unlock lttng_ust_urcu_read_unlock +#define lttng_ust_tp_rcu_dereference lttng_ust_rcu_dereference +#define LTTNG_UST_TP_RCU_LINK_TEST() 1 #else /* _LGPL_SOURCE */ -#define tp_rcu_read_lock lttng_ust_tracepoint_dlopen_ptr->rcu_read_lock_sym -#define tp_rcu_read_unlock lttng_ust_tracepoint_dlopen_ptr->rcu_read_unlock_sym +#define lttng_ust_tp_rcu_read_lock lttng_ust_tracepoint_dlopen_ptr->rcu_read_lock_sym +#define lttng_ust_tp_rcu_read_unlock lttng_ust_tracepoint_dlopen_ptr->rcu_read_unlock_sym -#define tp_rcu_dereference(p) \ +#define lttng_ust_tp_rcu_dereference(p) \ URCU_FORCE_CAST(__typeof__(p), \ lttng_ust_tracepoint_dlopen_ptr->rcu_dereference_sym(URCU_FORCE_CAST(void *, p))) -#define TP_RCU_LINK_TEST() (lttng_ust_tracepoint_dlopen_ptr && tp_rcu_read_lock) +#define LTTNG_UST_TP_RCU_LINK_TEST() (lttng_ust_tracepoint_dlopen_ptr && tp_rcu_read_lock) #endif /* _LGPL_SOURCE */ +#if LTTNG_UST_COMPAT_API(0) +#define tp_rcu_read_lock lttng_ust_tp_rcu_read_lock +#define tp_rcu_read_unlock lttng_ust_tp_rcu_read_unlock +#define tp_rcu_dereference lttng_ust_tp_rcu_dereference +#define TP_RCU_LINK_TEST LTTNG_UST_TP_RCU_LINK_TEST +#endif + #endif /* _LTTNG_TRACEPOINT_RCU_H */ diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h index 268271c4..42065767 100644 --- a/include/lttng/tracepoint.h +++ b/include/lttng/tracepoint.h @@ -191,10 +191,10 @@ void lttng_ust_tracepoint_cb_##_provider##___##_name(LTTNG_UST__TP_ARGS_PROTO(__ { \ struct lttng_ust_tracepoint_probe *__tp_probe; \ \ - if (caa_unlikely(!TP_RCU_LINK_TEST())) \ + if (caa_unlikely(!LTTNG_UST_TP_RCU_LINK_TEST())) \ return; \ - tp_rcu_read_lock(); \ - __tp_probe = tp_rcu_dereference(lttng_ust_tracepoint_##_provider##___##_name.probes); \ + lttng_ust_tp_rcu_read_lock(); \ + __tp_probe = lttng_ust_tp_rcu_dereference(lttng_ust_tracepoint_##_provider##___##_name.probes); \ if (caa_unlikely(!__tp_probe)) \ goto end; \ do { \ @@ -205,7 +205,7 @@ void lttng_ust_tracepoint_cb_##_provider##___##_name(LTTNG_UST__TP_ARGS_PROTO(__ (LTTNG_UST__TP_ARGS_DATA_VAR(__VA_ARGS__)); \ } while ((++__tp_probe)->func); \ end: \ - tp_rcu_read_unlock(); \ + lttng_ust_tp_rcu_read_unlock(); \ } \ static inline \ void lttng_ust_tracepoint_register_##_provider##___##_name(char *provider_name, char *event_name, \ @@ -350,17 +350,17 @@ lttng_ust_tracepoint__init_urcu_sym(void) lttng_ust_tracepoint_dlopen_ptr->rcu_read_lock_sym = URCU_FORCE_CAST(void (*)(void), dlsym(lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle, - "tp_rcu_read_lock")); + "lttng_ust_tp_rcu_read_lock")); if (!lttng_ust_tracepoint_dlopen_ptr->rcu_read_unlock_sym) lttng_ust_tracepoint_dlopen_ptr->rcu_read_unlock_sym = URCU_FORCE_CAST(void (*)(void), dlsym(lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle, - "tp_rcu_read_unlock")); + "lttng_ust_tp_rcu_read_unlock")); if (!lttng_ust_tracepoint_dlopen_ptr->rcu_dereference_sym) lttng_ust_tracepoint_dlopen_ptr->rcu_dereference_sym = URCU_FORCE_CAST(void *(*)(void *p), dlsym(lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle, - "tp_rcu_dereference_sym")); + "lttng_ust_tp_rcu_dereference_sym")); } #else static inline void diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index fb5d0654..3761915a 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -22,9 +22,9 @@ #undef tp_list_for_each_entry_rcu #define tp_list_for_each_entry_rcu(pos, head, member) \ - for (pos = cds_list_entry(tp_rcu_dereference((head)->next), __typeof__(*pos), member); \ + for (pos = cds_list_entry(lttng_ust_tp_rcu_dereference((head)->next), __typeof__(*pos), member); \ &pos->member != (head); \ - pos = cds_list_entry(tp_rcu_dereference(pos->member.next), __typeof__(*pos), member)) + pos = cds_list_entry(lttng_ust_tp_rcu_dereference(pos->member.next), __typeof__(*pos), member)) /* * LTTNG_UST_TRACEPOINT_EVENT_CLASS declares a class of tracepoints receiving the @@ -877,7 +877,7 @@ void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PRO } \ if (caa_unlikely(!CMM_ACCESS_ONCE(__event->enabled))) \ return; \ - if (caa_unlikely(!TP_RCU_LINK_TEST())) \ + if (caa_unlikely(!LTTNG_UST_TP_RCU_LINK_TEST())) \ return; \ if (caa_unlikely(CMM_ACCESS_ONCE(__event->eval_filter))) { \ lttng_ust__event_prepare_interpreter_stack__##_provider##___##_name(__stackvar.__interpreter_stack_data, \ diff --git a/src/lib/lttng-ust-tracepoint/tracepoint.c b/src/lib/lttng-ust-tracepoint/tracepoint.c index e166372b..35ad019f 100644 --- a/src/lib/lttng-ust-tracepoint/tracepoint.c +++ b/src/lib/lttng-ust-tracepoint/tracepoint.c @@ -998,24 +998,24 @@ void lttng_ust_tp_exit(void) /* * Create the wrapper symbols. */ -#undef tp_rcu_read_lock -#undef tp_rcu_read_unlock -#undef tp_rcu_dereference +#undef lttng_ust_tp_rcu_read_lock +#undef lttng_ust_tp_rcu_read_unlock +#undef lttng_ust_tp_rcu_dereference -void tp_rcu_read_lock(void); -void tp_rcu_read_lock(void) +void lttng_ust_tp_rcu_read_lock(void); +void lttng_ust_tp_rcu_read_lock(void) { lttng_ust_urcu_read_lock(); } -void tp_rcu_read_unlock(void); -void tp_rcu_read_unlock(void) +void lttng_ust_tp_rcu_read_unlock(void); +void lttng_ust_tp_rcu_read_unlock(void) { lttng_ust_urcu_read_unlock(); } -void *tp_rcu_dereference_sym(void *p); -void *tp_rcu_dereference_sym(void *p) +void *lttng_ust_tp_rcu_dereference_sym(void *p); +void *lttng_ust_tp_rcu_dereference_sym(void *p) { return lttng_ust_rcu_dereference(p); }