From 2ebf164be81fea5f9ec19314a030b5f80a8f8fc5 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Tue, 20 Apr 2021 13:03:34 -0400 Subject: [PATCH] Tracepoint API namespacing 'TRACEPOINT_ENUM' 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: I40ce57d796361cc9393d07792e5c5225a38db00f Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- include/lttng/tracepoint.h | 14 +++++++++----- include/lttng/ust-tracepoint-event-reset.h | 4 ++-- include/lttng/ust-tracepoint-event.h | 8 ++++---- tests/compile/ctf-types/ust_tests_ctf_types.h | 4 ++-- tests/compile/hello.cxx/ust_tests_hello.h | 2 +- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h index 043426fc..71250ce0 100644 --- a/include/lttng/tracepoint.h +++ b/include/lttng/tracepoint.h @@ -597,7 +597,7 @@ lttng_ust__tracepoints__ptrs_destroy(void) /* The following declarations must be outside re-inclusion protection. */ -#ifndef TRACEPOINT_ENUM +#ifndef LTTNG_UST_TRACEPOINT_ENUM /* * Tracepoint Enumerations @@ -608,7 +608,7 @@ lttng_ust__tracepoints__ptrs_destroy(void) * * An example: * - * TRACEPOINT_ENUM(someproject_component, enumname, + * LTTNG_UST_TRACEPOINT_ENUM(someproject_component, enumname, * TP_ENUM_VALUES( * ctf_enum_value("even", 0) * ctf_enum_value("uneven", 1) @@ -632,14 +632,18 @@ lttng_ust__tracepoints__ptrs_destroy(void) * ctf_enum(someproject_component, enumname, enumtype, enumfield, enumval) * * Where "someproject_component" and "enumname" match those in the - * TRACEPOINT_ENUM, "enumtype" is a signed or unsigned integer type + * LTTNG_UST_TRACEPOINT_ENUM, "enumtype" is a signed or unsigned integer type * backing the enumeration, "enumfield" is the name of the field and * "enumval" is the value. */ -#define TRACEPOINT_ENUM(provider, name, values) +#define LTTNG_UST_TRACEPOINT_ENUM(provider, name, values) -#endif /* #ifndef TRACEPOINT_ENUM */ +#if LTTNG_UST_COMPAT_API(0) +#define TRACEPOINT_ENUM LTTNG_UST_TRACEPOINT_ENUM +#endif /* #if LTTNG_UST_COMPAT_API(0) */ + +#endif /* #ifndef LTTNG_UST_TRACEPOINT_ENUM */ #ifndef LTTNG_UST_TRACEPOINT_EVENT diff --git a/include/lttng/ust-tracepoint-event-reset.h b/include/lttng/ust-tracepoint-event-reset.h index 6ba39820..a4d13b10 100644 --- a/include/lttng/ust-tracepoint-event-reset.h +++ b/include/lttng/ust-tracepoint-event-reset.h @@ -12,8 +12,8 @@ #undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE #define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) -#undef TRACEPOINT_ENUM -#define TRACEPOINT_ENUM(_provider, _name, _values) +#undef LTTNG_UST_TRACEPOINT_ENUM +#define LTTNG_UST_TRACEPOINT_ENUM(_provider, _name, _values) #undef LTTNG_UST_TP_ARGS #define LTTNG_UST_TP_ARGS(...) diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index 354545e0..fa4739ce 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -201,8 +201,8 @@ void __event_template_proto___##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PR #define TP_ENUM_VALUES(...) \ __VA_ARGS__ -#undef TRACEPOINT_ENUM -#define TRACEPOINT_ENUM(_provider, _name, _values) \ +#undef LTTNG_UST_TRACEPOINT_ENUM +#define LTTNG_UST_TRACEPOINT_ENUM(_provider, _name, _values) \ const struct lttng_ust_enum_entry * const __enum_values__##_provider##_##_name[] = { \ _values \ ctf_enum_value("", 0) /* Dummy, 0-len array forbidden by C99. */ \ @@ -367,8 +367,8 @@ void __event_template_proto___##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PR ctf_integer(int, dummy, 0) /* Dummy, C99 forbids 0-len array. */ \ }; -#undef TRACEPOINT_ENUM -#define TRACEPOINT_ENUM(_provider, _name, _values) \ +#undef LTTNG_UST_TRACEPOINT_ENUM +#define LTTNG_UST_TRACEPOINT_ENUM(_provider, _name, _values) \ static const struct lttng_ust_enum_desc __enum_##_provider##_##_name = { \ .struct_size = sizeof(struct lttng_ust_enum_desc), \ .name = #_provider "_" #_name, \ diff --git a/tests/compile/ctf-types/ust_tests_ctf_types.h b/tests/compile/ctf-types/ust_tests_ctf_types.h index 674950eb..0277e68b 100644 --- a/tests/compile/ctf-types/ust_tests_ctf_types.h +++ b/tests/compile/ctf-types/ust_tests_ctf_types.h @@ -12,7 +12,7 @@ #include -TRACEPOINT_ENUM(ust_tests_ctf_types, testenum, +LTTNG_UST_TRACEPOINT_ENUM(ust_tests_ctf_types, testenum, TP_ENUM_VALUES( ctf_enum_value("even", 0) ctf_enum_value("uneven", 1) @@ -21,7 +21,7 @@ TRACEPOINT_ENUM(ust_tests_ctf_types, testenum, ) ) -TRACEPOINT_ENUM(ust_tests_ctf_types, testenum2, +LTTNG_UST_TRACEPOINT_ENUM(ust_tests_ctf_types, testenum2, TP_ENUM_VALUES( ctf_enum_value("zero", 0) ctf_enum_value("five", 5) diff --git a/tests/compile/hello.cxx/ust_tests_hello.h b/tests/compile/hello.cxx/ust_tests_hello.h index c6fde916..25176dc6 100644 --- a/tests/compile/hello.cxx/ust_tests_hello.h +++ b/tests/compile/hello.cxx/ust_tests_hello.h @@ -13,7 +13,7 @@ #include #include -TRACEPOINT_ENUM(ust_tests_hello, my_enum, +LTTNG_UST_TRACEPOINT_ENUM(ust_tests_hello, my_enum, TP_ENUM_VALUES( ctf_enum_value("zero", 0) ctf_enum_value("one", 1) -- 2.34.1