From: Michael Jeanson Date: Tue, 20 Apr 2021 15:53:04 +0000 (-0400) Subject: Tracepoint API namespacing '_TP_NARGS' X-Git-Tag: v2.13.0-rc1~65 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6eddcb066dfe822dcf187715f35e7dbab84dabdf;p=lttng-ust.git Tracepoint API namespacing '_TP_NARGS' 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: I8fb892f7a1d1053d5b7b87dc3445bd1f254a3fe3 Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/include/lttng/tracepoint-event.h b/include/lttng/tracepoint-event.h index 74957750..30e6523d 100644 --- a/include/lttng/tracepoint-event.h +++ b/include/lttng/tracepoint-event.h @@ -14,10 +14,10 @@ #undef LTTNG_UST_TRACEPOINT_EVENT #define LTTNG_UST_TRACEPOINT_EVENT(_provider, _name, _args, _fields) \ - LTTNG_UST_TRACEPOINT_EVENT_CLASS(_provider, _name, _TP_PARAMS(_args), \ - _TP_PARAMS(_fields)) \ + LTTNG_UST_TRACEPOINT_EVENT_CLASS(_provider, _name, LTTNG_UST__TP_PARAMS(_args), \ + LTTNG_UST__TP_PARAMS(_fields)) \ LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(_provider, _name, _name, \ - _TP_PARAMS(_args)) + LTTNG_UST__TP_PARAMS(_args)) #undef TRACEPOINT_CREATE_PROBES @@ -42,16 +42,16 @@ #undef LTTNG_UST_TRACEPOINT_EVENT #define LTTNG_UST_TRACEPOINT_EVENT(provider, name, args, fields) \ - LTTNG_UST__DECLARE_TRACEPOINT(provider, name, _TP_PARAMS(args)) \ - LTTNG_UST__DEFINE_TRACEPOINT(provider, name, _TP_PARAMS(args)) + LTTNG_UST__DECLARE_TRACEPOINT(provider, name, LTTNG_UST__TP_PARAMS(args)) \ + LTTNG_UST__DEFINE_TRACEPOINT(provider, name, LTTNG_UST__TP_PARAMS(args)) #undef LTTNG_UST_TRACEPOINT_EVENT_CLASS #define LTTNG_UST_TRACEPOINT_EVENT_CLASS(provider, name, args, fields) #undef LTTNG_UST_TRACEPOINT_EVENT_INSTANCE #define LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(provider, _template, name, args) \ - LTTNG_UST__DECLARE_TRACEPOINT(provider, name, _TP_PARAMS(args)) \ - LTTNG_UST__DEFINE_TRACEPOINT(provider, name, _TP_PARAMS(args)) + LTTNG_UST__DECLARE_TRACEPOINT(provider, name, LTTNG_UST__TP_PARAMS(args)) \ + LTTNG_UST__DEFINE_TRACEPOINT(provider, name, LTTNG_UST__TP_PARAMS(args)) #undef TRACEPOINT_LOGLEVEL #define TRACEPOINT_LOGLEVEL(provider, name, loglevel) diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h index 36a32735..7e7f7aca 100644 --- a/include/lttng/tracepoint.h +++ b/include/lttng/tracepoint.h @@ -145,17 +145,17 @@ extern "C" { #define LTTNG_UST__TP_EXDATA_PROTO20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) void *__tp_data,a b,c d,e f,g h,i j,k l,m n,o p,q r,s t /* Preprocessor trick to count arguments. Inspired from sdt.h. */ -#define _TP_NARGS(...) __TP_NARGS(__VA_ARGS__, 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0) -#define __TP_NARGS(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20, N, ...) N -#define _TP_PROTO_N(N, ...) _TP_PARAMS(LTTNG_UST__TP_COMBINE_TOKENS(LTTNG_UST__TP_EXPROTO, N)(__VA_ARGS__)) -#define _TP_VAR_N(N, ...) _TP_PARAMS(LTTNG_UST__TP_COMBINE_TOKENS(LTTNG_UST__TP_EXVAR, N)(__VA_ARGS__)) -#define _TP_DATA_PROTO_N(N, ...) _TP_PARAMS(LTTNG_UST__TP_COMBINE_TOKENS(LTTNG_UST__TP_EXDATA_PROTO, N)(__VA_ARGS__)) -#define _TP_DATA_VAR_N(N, ...) _TP_PARAMS(LTTNG_UST__TP_COMBINE_TOKENS(LTTNG_UST__TP_EXDATA_VAR, N)(__VA_ARGS__)) -#define _TP_ARGS_PROTO(...) _TP_PROTO_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) -#define _TP_ARGS_VAR(...) _TP_VAR_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) -#define _TP_ARGS_DATA_PROTO(...) _TP_DATA_PROTO_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) -#define _TP_ARGS_DATA_VAR(...) _TP_DATA_VAR_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) -#define _TP_PARAMS(...) __VA_ARGS__ +#define LTTNG_UST__TP_NARGS(...) LTTNG_UST___TP_NARGS(__VA_ARGS__, 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0) +#define LTTNG_UST___TP_NARGS(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20, N, ...) N +#define LTTNG_UST__TP_PROTO_N(N, ...) LTTNG_UST__TP_PARAMS(LTTNG_UST__TP_COMBINE_TOKENS(LTTNG_UST__TP_EXPROTO, N)(__VA_ARGS__)) +#define LTTNG_UST__TP_VAR_N(N, ...) LTTNG_UST__TP_PARAMS(LTTNG_UST__TP_COMBINE_TOKENS(LTTNG_UST__TP_EXVAR, N)(__VA_ARGS__)) +#define LTTNG_UST__TP_DATA_PROTO_N(N, ...) LTTNG_UST__TP_PARAMS(LTTNG_UST__TP_COMBINE_TOKENS(LTTNG_UST__TP_EXDATA_PROTO, N)(__VA_ARGS__)) +#define LTTNG_UST__TP_DATA_VAR_N(N, ...) LTTNG_UST__TP_PARAMS(LTTNG_UST__TP_COMBINE_TOKENS(LTTNG_UST__TP_EXDATA_VAR, N)(__VA_ARGS__)) +#define LTTNG_UST__TP_ARGS_PROTO(...) LTTNG_UST__TP_PROTO_N(LTTNG_UST__TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) +#define LTTNG_UST__TP_ARGS_VAR(...) LTTNG_UST__TP_VAR_N(LTTNG_UST__TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) +#define LTTNG_UST__TP_ARGS_DATA_PROTO(...) LTTNG_UST__TP_DATA_PROTO_N(LTTNG_UST__TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) +#define LTTNG_UST__TP_ARGS_DATA_VAR(...) LTTNG_UST__TP_DATA_VAR_N(LTTNG_UST__TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) +#define LTTNG_UST__TP_PARAMS(...) __VA_ARGS__ /* * sizeof(#_provider) - 1 : length of the provider string (excluding \0). @@ -184,10 +184,10 @@ extern "C" { #define LTTNG_UST__DECLARE_TRACEPOINT(_provider, _name, ...) \ extern struct lttng_ust_tracepoint lttng_ust_tracepoint_##_provider##___##_name; \ static inline \ -void lttng_ust_tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) \ +void lttng_ust_tracepoint_cb_##_provider##___##_name(LTTNG_UST__TP_ARGS_PROTO(__VA_ARGS__)) \ __attribute__((always_inline, unused)) lttng_ust_notrace; \ static \ -void lttng_ust_tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) \ +void lttng_ust_tracepoint_cb_##_provider##___##_name(LTTNG_UST__TP_ARGS_PROTO(__VA_ARGS__)) \ { \ struct lttng_ust_tracepoint_probe *__tp_probe; \ \ @@ -201,8 +201,8 @@ void lttng_ust_tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__) void (*__tp_cb)(void) = __tp_probe->func; \ void *__tp_data = __tp_probe->data; \ \ - URCU_FORCE_CAST(void (*)(_TP_ARGS_DATA_PROTO(__VA_ARGS__)), __tp_cb) \ - (_TP_ARGS_DATA_VAR(__VA_ARGS__)); \ + URCU_FORCE_CAST(void (*)(LTTNG_UST__TP_ARGS_DATA_PROTO(__VA_ARGS__)), __tp_cb) \ + (LTTNG_UST__TP_ARGS_DATA_VAR(__VA_ARGS__)); \ } while ((++__tp_probe)->func); \ end: \ tp_rcu_read_unlock(); \ @@ -713,14 +713,14 @@ __tracepoints__ptrs_destroy(void) */ #define LTTNG_UST_TRACEPOINT_EVENT(provider, name, args, fields) \ - LTTNG_UST__DECLARE_TRACEPOINT(provider, name, _TP_PARAMS(args)) \ - LTTNG_UST__DEFINE_TRACEPOINT(provider, name, _TP_PARAMS(args)) + LTTNG_UST__DECLARE_TRACEPOINT(provider, name, LTTNG_UST__TP_PARAMS(args)) \ + LTTNG_UST__DEFINE_TRACEPOINT(provider, name, LTTNG_UST__TP_PARAMS(args)) #define LTTNG_UST_TRACEPOINT_EVENT_CLASS(provider, name, args, fields) #define LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(provider, _template, name, args) \ - LTTNG_UST__DECLARE_TRACEPOINT(provider, name, _TP_PARAMS(args)) \ - LTTNG_UST__DEFINE_TRACEPOINT(provider, name, _TP_PARAMS(args)) + LTTNG_UST__DECLARE_TRACEPOINT(provider, name, LTTNG_UST__TP_PARAMS(args)) \ + LTTNG_UST__DEFINE_TRACEPOINT(provider, name, LTTNG_UST__TP_PARAMS(args)) #if LTTNG_UST_COMPAT_API(0) #define TRACEPOINT_EVENT LTTNG_UST_TRACEPOINT_EVENT diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index e844891f..354545e0 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -39,18 +39,18 @@ #undef LTTNG_UST_TRACEPOINT_EVENT #define LTTNG_UST_TRACEPOINT_EVENT(_provider, _name, _args, _fields) \ LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, \ - _TP_PARAMS(_args), \ - _TP_PARAMS(_fields)) \ + LTTNG_UST__TP_PARAMS(_args), \ + LTTNG_UST__TP_PARAMS(_fields)) \ LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _name, _name, \ - _TP_PARAMS(_args)) + LTTNG_UST__TP_PARAMS(_args)) #undef LTTNG_UST_TRACEPOINT_EVENT_CLASS #define LTTNG_UST_TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ - LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _TP_PARAMS(_args), _TP_PARAMS(_fields)) + LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, LTTNG_UST__TP_PARAMS(_args), LTTNG_UST__TP_PARAMS(_fields)) #undef LTTNG_UST_TRACEPOINT_EVENT_INSTANCE #define LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \ - LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _TP_PARAMS(_args)) + LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, LTTNG_UST__TP_PARAMS(_args)) /* Helpers */ #define _TP_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) @@ -129,11 +129,11 @@ void LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_check_, TRACEPOI #undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE #define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \ -void __event_template_proto___##_provider##___##_template(_TP_ARGS_DATA_PROTO(_args)); +void __event_template_proto___##_provider##___##_template(LTTNG_UST__TP_ARGS_DATA_PROTO(_args)); #undef LTTNG_UST__TRACEPOINT_EVENT_CLASS #define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ -void __event_template_proto___##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)); +void __event_template_proto___##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args)); #include TRACEPOINT_INCLUDE @@ -392,7 +392,7 @@ void __event_template_proto___##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args) #undef LTTNG_UST__TRACEPOINT_EVENT_CLASS #define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ -static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)); +static void __event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args)); #include TRACEPOINT_INCLUDE @@ -463,12 +463,12 @@ static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)); #undef LTTNG_UST__TRACEPOINT_EVENT_CLASS #define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ static inline \ -size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) \ +size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, LTTNG_UST__TP_ARGS_DATA_PROTO(_args)) \ lttng_ust_notrace; \ static inline \ size_t __event_get_size__##_provider##___##_name( \ size_t *__dynamic_len __attribute__((__unused__)), \ - _TP_ARGS_DATA_PROTO(_args)) \ + LTTNG_UST__TP_ARGS_DATA_PROTO(_args)) \ { \ size_t __event_len = 0; \ unsigned int __dynamic_len_idx __attribute__((__unused__)) = 0; \ @@ -633,7 +633,7 @@ size_t __event_get_size__##_provider##___##_name( \ #define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ static inline \ void __event_prepare_interpreter_stack__##_provider##___##_name(char *__stack_data,\ - _TP_ARGS_DATA_PROTO(_args)) \ + LTTNG_UST__TP_ARGS_DATA_PROTO(_args)) \ { \ if (0) { \ (void) __tp_data; /* don't warn if unused */ \ @@ -707,10 +707,10 @@ void __event_prepare_interpreter_stack__##_provider##___##_name(char *__stack_da #undef LTTNG_UST__TRACEPOINT_EVENT_CLASS #define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ static inline \ -size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \ +size_t __event_get_align__##_provider##___##_name(LTTNG_UST__TP_ARGS_PROTO(_args)) \ lttng_ust_notrace; \ static inline \ -size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \ +size_t __event_get_align__##_provider##___##_name(LTTNG_UST__TP_ARGS_PROTO(_args)) \ { \ size_t __event_align = 1; \ _fields \ @@ -833,10 +833,10 @@ size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \ #undef LTTNG_UST__TRACEPOINT_EVENT_CLASS #define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ static \ -void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) \ +void __event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args)) \ lttng_ust_notrace; \ static \ -void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) \ +void __event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args)) \ { \ struct lttng_ust_event_common *__event = (struct lttng_ust_event_common *) __tp_data; \ size_t __dynamic_len_idx = 0; \ @@ -874,7 +874,7 @@ void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) \ return; \ if (caa_unlikely(CMM_ACCESS_ONCE(__event->eval_filter))) { \ __event_prepare_interpreter_stack__##_provider##___##_name(__stackvar.__interpreter_stack_data, \ - _TP_ARGS_DATA_VAR(_args)); \ + LTTNG_UST__TP_ARGS_DATA_VAR(_args)); \ __interpreter_stack_prepared = true; \ if (caa_likely(__event->run_filter(__event, \ __stackvar.__interpreter_stack_data, NULL) != LTTNG_UST_EVENT_FILTER_ACCEPT)) \ @@ -889,8 +889,8 @@ void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) \ struct lttng_ust_ring_buffer_ctx __ctx; \ \ __event_len = __event_get_size__##_provider##___##_name(__stackvar.__dynamic_len, \ - _TP_ARGS_DATA_VAR(_args)); \ - __event_align = __event_get_align__##_provider##___##_name(_TP_ARGS_VAR(_args)); \ + LTTNG_UST__TP_ARGS_DATA_VAR(_args)); \ + __event_align = __event_get_align__##_provider##___##_name(LTTNG_UST__TP_ARGS_VAR(_args)); \ lttng_ust_ring_buffer_ctx_init(&__ctx, __event_recorder, __event_len, __event_align, \ _TP_IP_PARAM(TP_IP_PARAM)); \ __ret = __chan->ops->event_reserve(&__ctx); \ @@ -910,7 +910,7 @@ void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) \ \ if (caa_unlikely(!__interpreter_stack_prepared && __notif_ctx.eval_capture)) \ __event_prepare_interpreter_stack__##_provider##___##_name(__stackvar.__interpreter_stack_data, \ - _TP_ARGS_DATA_VAR(_args)); \ + LTTNG_UST__TP_ARGS_DATA_VAR(_args)); \ \ __event_notifier->notification_send(__event_notifier, \ __stackvar.__interpreter_stack_data, \