Tracepoint API namespacing ctf_enum
authorMichael Jeanson <mjeanson@efficios.com>
Wed, 21 Apr 2021 21:44:07 +0000 (17:44 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 22 Apr 2021 15:01:18 +0000 (11:01 -0400)
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: I377d89338735a6cc3b2b436e69fefd2e81f39e9a
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng/tracepoint.h
include/lttng/ust-tracepoint-event-nowrite.h
include/lttng/ust-tracepoint-event-reset.h
include/lttng/ust-tracepoint-event-write.h
include/lttng/ust-tracepoint-event.h
src/lib/lttng-ust/lttng-ust-dynamic-type.c
tests/compile/ctf-types/ust_tests_ctf_types.h
tests/compile/hello.cxx/ust_tests_hello.h

index beb2c409dcfe1ed7afdd43998564ae58a10f96e2..a8532796a95dc4f016ecee74f093db5cfe26c657 100644 (file)
@@ -624,6 +624,12 @@ lttng_ust__tracepoints__ptrs_destroy(void)
 
 #define ctf_unused                     lttng_ust_field_unused
 #define ctf_unused_nowrite             lttng_ust_field_unused_nowrite
+
+#define ctf_enum                       lttng_ust_field_enum
+#define ctf_enum_nowrite               lttng_ust_field_enum_nowrite
+#define ctf_enum_value                 lttng_ust_field_enum_value
+#define ctf_enum_range                 lttng_ust_field_enum_range
+#define ctf_enum_auto                  lttng_ust_field_enum_auto
 #endif /* #if LTTNG_UST_COMPAT_API(0) */
 
 #ifdef __cplusplus
@@ -647,18 +653,18 @@ lttng_ust__tracepoints__ptrs_destroy(void)
  *
  * LTTNG_UST_TRACEPOINT_ENUM(someproject_component, enumname,
  *     LTTNG_UST_TP_ENUM_VALUES(
- *             ctf_enum_value("even", 0)
- *             ctf_enum_value("uneven", 1)
- *             ctf_enum_range("twoto4", 2, 4)
- *             ctf_enum_value("five", 5)
+ *             lttng_ust_field_enum_value("even", 0)
+ *             lttng_ust_field_enum_value("uneven", 1)
+ *             lttng_ust_field_enum_range("twoto4", 2, 4)
+ *             lttng_ust_field_enum_value("five", 5)
  *     )
  * )
  *
  * Where "someproject_component" is the name of the component this enumeration
  * belongs to and "enumname" identifies this enumeration. Inside the
  * LTTNG_UST_TP_ENUM_VALUES macro is the actual mapping. Each string value can map
- * to either a single value with ctf_enum_value or a range of values
- * with ctf_enum_range.
+ * to either a single value with lttng_ust_field_enum_value or a range of values
+ * with lttng_ust_field_enum_range.
  *
  * Enumeration ranges may overlap, but the behavior is implementation-defined,
  * each trace reader will handle overlapping as it wishes.
@@ -666,7 +672,7 @@ lttng_ust__tracepoints__ptrs_destroy(void)
  * That enumeration can then be used in a field inside the TP_FIELD macro using
  * the following line:
  *
- * ctf_enum(someproject_component, enumname, enumtype, enumfield, enumval)
+ * lttng_ust_field_enum(someproject_component, enumname, enumtype, enumfield, enumval)
  *
  * Where "someproject_component" and "enumname" match those in the
  * LTTNG_UST_TRACEPOINT_ENUM, "enumtype" is a signed or unsigned integer type
@@ -706,7 +712,7 @@ lttng_ust__tracepoints__ptrs_destroy(void)
  *         lttng_ust_field_integer_hex(unsigned long, field_d, arg1)
  *
  *         * Enumeration *
- *         ctf_enum(someproject_component, enum_name, int, field_e, arg0)
+ *         lttng_ust_field_enum(someproject_component, enum_name, int, field_e, arg0)
  *
  *         * Array Sequence, printed as UTF8-encoded array of bytes *
  *         lttng_ust_field_array_text(char, field_b, string, FIXED_LEN)
index d5406c83f229451da13ad83350093f0882129016..552955b66f787d682f5e26b44d17411338f2c189 100644 (file)
@@ -67,6 +67,6 @@
 #define lttng_ust_field_unused_nowrite(_src)                           \
        lttng_ust__field_unused(_src)
 
-#undef ctf_enum_nowrite
-#define ctf_enum_nowrite(_provider, _name, _type, _item, _src)         \
-       _ctf_enum(_provider, _name, _type, _item, _src, 1)
+#undef lttng_ust_field_enum_nowrite
+#define lttng_ust_field_enum_nowrite(_provider, _name, _type, _item, _src)             \
+       lttng_ust__field_enum(_provider, _name, _type, _item, _src, 1)
index ed1c465e13be1f474e13e1f581283002b2e37e56..2bc255fa571ff1d779d10e93ecbcf00a3c8dc221 100644 (file)
@@ -48,8 +48,8 @@
 #undef lttng_ust__field_unused
 #define lttng_ust__field_unused(_src)
 
-#undef _ctf_enum
-#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite)
+#undef lttng_ust__field_enum
+#define lttng_ust__field_enum(_provider, _name, _type, _item, _src, _nowrite)
 
 /* "write" */
 #undef lttng_ust_field_integer
 #undef lttng_ust_field_unused
 #define lttng_ust_field_unused(_src)
 
-#undef ctf_enum
-#define ctf_enum(_provider, _name, _type, _item, _src)
+#undef lttng_ust_field_enum
+#define lttng_ust_field_enum(_provider, _name, _type, _item, _src)
 
 /* "nowrite" */
 #undef lttng_ust_field_integer_nowrite
 #undef lttng_ust_field_unused_nowrite
 #define lttng_ust_field_unused_nowrite(_src)
 
-#undef ctf_enum_nowrite
-#define ctf_enum_nowrite(_provider, _name, _type, _item, _src)
+#undef lttng_ust_field_enum_nowrite
+#define lttng_ust_field_enum_nowrite(_provider, _name, _type, _item, _src)
index 3c542980b8eedda119d8bfbadd463f6a1e4362aa..f43fd4c3573b6ce6122f9be9d666e2abad234a30 100644 (file)
@@ -82,6 +82,6 @@
 #define lttng_ust_field_unused(_src)                                   \
        lttng_ust__field_unused(_src)
 
-#undef ctf_enum
-#define ctf_enum(_provider, _name, _type, _item, _src)                 \
-       _ctf_enum(_provider, _name, _type, _item, _src, 0)
+#undef lttng_ust_field_enum
+#define lttng_ust_field_enum(_provider, _name, _type, _item, _src)                     \
+       lttng_ust__field_enum(_provider, _name, _type, _item, _src, 0)
index 9399be21d8c200bb589851bfed2936ab87f2217e..cec6239e0df0b63de18c10bc0c0cfe1bd40da2bb 100644 (file)
@@ -146,8 +146,8 @@ void lttng_ust__event_template_proto___##_provider##___##_name(LTTNG_UST__TP_ARG
 #include <lttng/ust-tracepoint-event-reset.h>
 
 /* Enumeration entry (single value) */
-#undef ctf_enum_value
-#define ctf_enum_value(_string, _value)                                        \
+#undef lttng_ust_field_enum_value
+#define lttng_ust_field_enum_value(_string, _value)                                    \
        LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_enum_entry, { \
                .struct_size = sizeof(struct lttng_ust_enum_entry),             \
                .start = {                                              \
@@ -164,8 +164,8 @@ void lttng_ust__event_template_proto___##_provider##___##_name(LTTNG_UST__TP_ARG
        }),
 
 /* Enumeration entry (range) */
-#undef ctf_enum_range
-#define ctf_enum_range(_string, _range_start, _range_end)              \
+#undef lttng_ust_field_enum_range
+#define lttng_ust_field_enum_range(_string, _range_start, _range_end)          \
        LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_enum_entry, { \
                .struct_size = sizeof(struct lttng_ust_enum_entry),             \
                .start = {                                              \
@@ -182,8 +182,8 @@ void lttng_ust__event_template_proto___##_provider##___##_name(LTTNG_UST__TP_ARG
        }),
 
 /* Enumeration entry (automatic value; follows the rules of CTF) */
-#undef ctf_enum_auto
-#define ctf_enum_auto(_string)                                         \
+#undef lttng_ust_field_enum_auto
+#define lttng_ust_field_enum_auto(_string)                                             \
        LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_enum_entry, { \
                .struct_size = sizeof(struct lttng_ust_enum_entry),             \
                .start = {                                              \
@@ -211,7 +211,7 @@ void lttng_ust__event_template_proto___##_provider##___##_name(LTTNG_UST__TP_ARG
 #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. */ \
+               lttng_ust_field_enum_value("", 0)       /* Dummy, 0-len array forbidden by C99. */ \
        };
 #include LTTNG_UST_TRACEPOINT_INCLUDE
 
@@ -346,8 +346,8 @@ void lttng_ust__event_template_proto___##_provider##___##_name(LTTNG_UST__TP_ARG
 #undef lttng_ust__field_unused
 #define lttng_ust__field_unused(_src)
 
-#undef _ctf_enum
-#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \
+#undef lttng_ust__field_enum
+#define lttng_ust__field_enum(_provider, _name, _type, _item, _src, _nowrite) \
        LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, { \
                .struct_size = sizeof(struct lttng_ust_event_field), \
                .name = #_item,                                 \
@@ -456,8 +456,8 @@ static void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_D
        if (0)                                                                  \
                (void) (_src);  /* Unused */
 
-#undef _ctf_enum
-#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite)              \
+#undef lttng_ust__field_enum
+#define lttng_ust__field_enum(_provider, _name, _type, _item, _src, _nowrite)          \
        lttng_ust__field_integer_ext(_type, _item, _src, LTTNG_UST_BYTE_ORDER, 10, _nowrite)
 
 #undef LTTNG_UST_TP_ARGS
@@ -625,8 +625,8 @@ size_t lttng_ust__event_get_size__##_provider##___##_name(                        \
        if (0)                                                                  \
                (void) (_src);
 
-#undef _ctf_enum
-#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite)              \
+#undef lttng_ust__field_enum
+#define lttng_ust__field_enum(_provider, _name, _type, _item, _src, _nowrite)          \
        lttng_ust__field_integer_ext(_type, _item, _src, LTTNG_UST_BYTE_ORDER, 10, _nowrite)
 
 #undef LTTNG_UST_TP_ARGS
@@ -700,8 +700,8 @@ void lttng_ust__event_prepare_interpreter_stack__##_provider##___##_name(char *_
        if (0)                                                                  \
                (void) (_src);  /* Unused */
 
-#undef _ctf_enum
-#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite)              \
+#undef lttng_ust__field_enum
+#define lttng_ust__field_enum(_provider, _name, _type, _item, _src, _nowrite)          \
        lttng_ust__field_integer_ext(_type, _item, _src, LTTNG_UST_BYTE_ORDER, 10, _nowrite)
 
 #undef LTTNG_UST_TP_ARGS
@@ -784,8 +784,8 @@ size_t lttng_ust__event_get_align__##_provider##___##_name(LTTNG_UST__TP_ARGS_PR
 #undef lttng_ust__field_unused
 #define lttng_ust__field_unused(_src)
 
-#undef _ctf_enum
-#define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite)      \
+#undef lttng_ust__field_enum
+#define lttng_ust__field_enum(_provider, _name, _type, _item, _src, _nowrite)  \
        lttng_ust__field_integer_ext(_type, _item, _src, LTTNG_UST_BYTE_ORDER, 10, _nowrite)
 
 /* Beware: this get len actually consumes the len value */
index 4147e3a70dec262ee00ec4a5a5a7860c492808ec..2b3ebd6551a99f7512bde77abf21eb5de87bd2b6 100644 (file)
@@ -15,7 +15,7 @@
 #include "common/macros.h"
 #include "common/dynamic-type.h"
 
-#define ctf_enum_value(_string, _value)                                        \
+#define lttng_ust_field_enum_value(_string, _value)                                    \
        LTTNG_UST_COMPOUND_LITERAL(struct lttng_ust_enum_entry, {               \
                .struct_size = sizeof(struct lttng_ust_enum_entry),             \
                .start = {                                              \
        }),
 
 static const struct lttng_ust_enum_entry *dt_enum[_NR_LTTNG_UST_DYNAMIC_TYPES] = {
-       [LTTNG_UST_DYNAMIC_TYPE_NONE] = ctf_enum_value("_none", 0)
-       [LTTNG_UST_DYNAMIC_TYPE_S8] = ctf_enum_value("_int8", 1)
-       [LTTNG_UST_DYNAMIC_TYPE_S16] = ctf_enum_value("_int16", 2)
-       [LTTNG_UST_DYNAMIC_TYPE_S32] = ctf_enum_value("_int32", 3)
-       [LTTNG_UST_DYNAMIC_TYPE_S64] = ctf_enum_value("_int64", 4)
-       [LTTNG_UST_DYNAMIC_TYPE_U8] = ctf_enum_value("_uint8", 5)
-       [LTTNG_UST_DYNAMIC_TYPE_U16] = ctf_enum_value("_uint16", 6)
-       [LTTNG_UST_DYNAMIC_TYPE_U32] = ctf_enum_value("_uint32", 7)
-       [LTTNG_UST_DYNAMIC_TYPE_U64] = ctf_enum_value("_uint64", 8)
-       [LTTNG_UST_DYNAMIC_TYPE_FLOAT] = ctf_enum_value("_float", 9)
-       [LTTNG_UST_DYNAMIC_TYPE_DOUBLE] = ctf_enum_value("_double", 10)
-       [LTTNG_UST_DYNAMIC_TYPE_STRING] = ctf_enum_value("_string", 11)
+       [LTTNG_UST_DYNAMIC_TYPE_NONE] = lttng_ust_field_enum_value("_none", 0)
+       [LTTNG_UST_DYNAMIC_TYPE_S8] = lttng_ust_field_enum_value("_int8", 1)
+       [LTTNG_UST_DYNAMIC_TYPE_S16] = lttng_ust_field_enum_value("_int16", 2)
+       [LTTNG_UST_DYNAMIC_TYPE_S32] = lttng_ust_field_enum_value("_int32", 3)
+       [LTTNG_UST_DYNAMIC_TYPE_S64] = lttng_ust_field_enum_value("_int64", 4)
+       [LTTNG_UST_DYNAMIC_TYPE_U8] = lttng_ust_field_enum_value("_uint8", 5)
+       [LTTNG_UST_DYNAMIC_TYPE_U16] = lttng_ust_field_enum_value("_uint16", 6)
+       [LTTNG_UST_DYNAMIC_TYPE_U32] = lttng_ust_field_enum_value("_uint32", 7)
+       [LTTNG_UST_DYNAMIC_TYPE_U64] = lttng_ust_field_enum_value("_uint64", 8)
+       [LTTNG_UST_DYNAMIC_TYPE_FLOAT] = lttng_ust_field_enum_value("_float", 9)
+       [LTTNG_UST_DYNAMIC_TYPE_DOUBLE] = lttng_ust_field_enum_value("_double", 10)
+       [LTTNG_UST_DYNAMIC_TYPE_STRING] = lttng_ust_field_enum_value("_string", 11)
 };
 
 static struct lttng_ust_enum_desc dt_enum_desc = {
index a0fb0b340c097b4cfd7c8358f8b262c399b0335d..489f04a204d05146059477f6a6187eee7357afe7 100644 (file)
 
 LTTNG_UST_TRACEPOINT_ENUM(ust_tests_ctf_types, testenum,
        LTTNG_UST_TP_ENUM_VALUES(
-               ctf_enum_value("even", 0)
-               ctf_enum_value("uneven", 1)
-               ctf_enum_range("twoto4", 2, 4)
-               ctf_enum_value("five\"extra\\test", 5)
+               lttng_ust_field_enum_value("even", 0)
+               lttng_ust_field_enum_value("uneven", 1)
+               lttng_ust_field_enum_range("twoto4", 2, 4)
+               lttng_ust_field_enum_value("five\"extra\\test", 5)
        )
 )
 
 LTTNG_UST_TRACEPOINT_ENUM(ust_tests_ctf_types, testenum2,
        LTTNG_UST_TP_ENUM_VALUES(
-               ctf_enum_value("zero", 0)
-               ctf_enum_value("five", 5)
-               ctf_enum_range("ten_to_twenty", 10, 20)
+               lttng_ust_field_enum_value("zero", 0)
+               lttng_ust_field_enum_value("five", 5)
+               lttng_ust_field_enum_range("ten_to_twenty", 10, 20)
        )
 )
 
@@ -37,10 +37,10 @@ LTTNG_UST_TRACEPOINT_EVENT(ust_tests_ctf_types, tptest,
        LTTNG_UST_TP_ARGS(int, anint, int, enumval, int, enumval2),
        LTTNG_UST_TP_FIELDS(
                lttng_ust_field_integer(int, intfield, anint)
-               ctf_enum(ust_tests_ctf_types, testenum, int, enumfield, enumval)
-               ctf_enum(ust_tests_ctf_types, testenum, long long,
+               lttng_ust_field_enum(ust_tests_ctf_types, testenum, int, enumfield, enumval)
+               lttng_ust_field_enum(ust_tests_ctf_types, testenum, long long,
                                enumfield_bis, enumval)
-               ctf_enum(ust_tests_ctf_types, testenum2, unsigned int,
+               lttng_ust_field_enum(ust_tests_ctf_types, testenum2, unsigned int,
                                enumfield_third, enumval2)
        )
 )
@@ -53,7 +53,7 @@ LTTNG_UST_TRACEPOINT_EVENT(ust_tests_ctf_types, tptest_bis,
        LTTNG_UST_TP_ARGS(int, anint, int, enumval),
        LTTNG_UST_TP_FIELDS(
                lttng_ust_field_integer(int, intfield, anint)
-               ctf_enum(ust_tests_ctf_types, testenum, unsigned char,
+               lttng_ust_field_enum(ust_tests_ctf_types, testenum, unsigned char,
                        enumfield, enumval)
        )
 )
index 3fd0f76a8115168e4e4cf2dbb7b9281bf3209005..9088aaf1ec92eff8d5722c1dc2e510c78bdf856c 100644 (file)
 
 LTTNG_UST_TRACEPOINT_ENUM(ust_tests_hello, my_enum,
        LTTNG_UST_TP_ENUM_VALUES(
-               ctf_enum_value("zero", 0)
-               ctf_enum_value("one", 1)
-               ctf_enum_auto("two")
-               ctf_enum_value("three", 3)
-               ctf_enum_range("ten to twenty", 10, 20)
-               ctf_enum_auto("21!")
+               lttng_ust_field_enum_value("zero", 0)
+               lttng_ust_field_enum_value("one", 1)
+               lttng_ust_field_enum_auto("two")
+               lttng_ust_field_enum_value("three", 3)
+               lttng_ust_field_enum_range("ten to twenty", 10, 20)
+               lttng_ust_field_enum_auto("21!")
        )
 )
 
@@ -44,7 +44,7 @@ LTTNG_UST_TRACEPOINT_EVENT(ust_tests_hello, tptest,
                lttng_ust_field_string(stringfield, text)
                lttng_ust_field_float(float, floatfield, floatarg)
                lttng_ust_field_float(double, doublefield, doublearg)
-               ctf_enum(ust_tests_hello, my_enum, int, enumfield, enumarg)
+               lttng_ust_field_enum(ust_tests_hello, my_enum, int, enumfield, enumarg)
        )
 )
 
This page took 0.03495 seconds and 4 git commands to generate.