From 10937ee5c85456292ce4e8d67c9ac7bc37caf974 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Wed, 21 Apr 2021 16:03:42 -0400 Subject: [PATCH] Tracepoint API namespacing ctf_array 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: Ib1c3694d054cba2b6d27bd62a3db2b64eca27c3f Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- doc/examples/demo/ust_tests_demo2.h | 4 +- .../hello-static-lib/ust_tests_hello.h | 4 +- include/lttng/tracepoint.h | 15 ++++++- include/lttng/ust-tracepoint-event-nowrite.h | 30 ++++++------- include/lttng/ust-tracepoint-event-reset.h | 44 +++++++++---------- include/lttng/ust-tracepoint-event-write.h | 30 ++++++------- include/lttng/ust-tracepoint-event.h | 28 ++++++------ include/lttng/ust-utils.h | 10 ++--- .../lttng-ust/lttng-ust-statedump-provider.h | 2 +- tests/compile/hello.cxx/ust_tests_hello.h | 4 +- tests/compile/hello/ust_tests_hello.h | 14 +++--- tests/compile/test-app-ctx/ust_tests_hello.h | 4 +- 12 files changed, 100 insertions(+), 89 deletions(-) diff --git a/doc/examples/demo/ust_tests_demo2.h b/doc/examples/demo/ust_tests_demo2.h index b3ab8feb..95c83446 100644 --- a/doc/examples/demo/ust_tests_demo2.h +++ b/doc/examples/demo/ust_tests_demo2.h @@ -23,8 +23,8 @@ LTTNG_UST_TRACEPOINT_EVENT(ust_tests_demo2, loop, lttng_ust_field_integer(long, longfield, anint) lttng_ust_field_integer_network(int, netintfield, netint) lttng_ust_field_integer_network_hex(int, netintfieldhex, netint) - ctf_array(long, arrfield1, values, 3) - ctf_array_text(char, arrfield2, text, 10) + lttng_ust_field_array(long, arrfield1, values, 3) + lttng_ust_field_array_text(char, arrfield2, text, 10) ctf_sequence(char, seqfield1, text, size_t, textlen) ctf_sequence_text(char, seqfield2, text, diff --git a/doc/examples/hello-static-lib/ust_tests_hello.h b/doc/examples/hello-static-lib/ust_tests_hello.h index a2d4eab4..80b9d3b8 100644 --- a/doc/examples/hello-static-lib/ust_tests_hello.h +++ b/doc/examples/hello-static-lib/ust_tests_hello.h @@ -23,8 +23,8 @@ LTTNG_UST_TRACEPOINT_EVENT(ust_tests_hello, tptest, lttng_ust_field_integer(long, longfield, anint) lttng_ust_field_integer_network(int, netintfield, netint) lttng_ust_field_integer_network_hex(int, netintfieldhex, netint) - ctf_array(long, arrfield1, values, 3) - ctf_array_text(char, arrfield2, text, 10) + lttng_ust_field_array(long, arrfield1, values, 3) + lttng_ust_field_array_text(char, arrfield2, text, 10) ctf_sequence(char, seqfield1, text, size_t, textlen) ctf_sequence_text(char, seqfield2, text, diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h index 3524c9d1..01aeb3b7 100644 --- a/include/lttng/tracepoint.h +++ b/include/lttng/tracepoint.h @@ -596,6 +596,17 @@ lttng_ust__tracepoints__ptrs_destroy(void) #define ctf_float lttng_ust_field_float #define ctf_float_nowrite lttng_ust_field_float_nowrite + +#define ctf_array lttng_ust_field_array +#define ctf_array_hex lttng_ust_field_array_hex +#define ctf_array_network lttng_ust_field_array_network +#define ctf_array_network_hex lttng_ust_field_array_network_hex +#define ctf_array_text lttng_ust_field_array_text +#define ctf_array_nowrite lttng_ust_field_array_nowrite +#define ctf_array_nowrite_hex lttng_ust_field_array_nowrite_hex +#define ctf_array_network_nowrite lttng_ust_field_array_network_nowrite +#define ctf_array_network_nowrite_hex lttng_ust_field_array_network_nowrite_hex +#define ctf_array_text_nowrite lttng_ust_field_array_text_nowrite #endif /* #if LTTNG_UST_COMPAT_API(0) */ #ifdef __cplusplus @@ -681,14 +692,14 @@ lttng_ust__tracepoints__ptrs_destroy(void) * ctf_enum(someproject_component, enum_name, int, field_e, arg0) * * * Array Sequence, printed as UTF8-encoded array of bytes * - * ctf_array_text(char, field_b, string, FIXED_LEN) + * lttng_ust_field_array_text(char, field_b, string, FIXED_LEN) * ctf_sequence_text(char, field_c, string, size_t, strlen) * * * String, printed as UTF8-encoded string * * ctf_string(field_e, string) * * * Array sequence of signed integer values * - * ctf_array(long, field_f, arg4, FIXED_LEN4) + * lttng_ust_field_array(long, field_f, arg4, FIXED_LEN4) * ctf_sequence(long, field_g, arg4, size_t, arg4_len) * ) * ) diff --git a/include/lttng/ust-tracepoint-event-nowrite.h b/include/lttng/ust-tracepoint-event-nowrite.h index 9358d8f1..282462c3 100644 --- a/include/lttng/ust-tracepoint-event-nowrite.h +++ b/include/lttng/ust-tracepoint-event-nowrite.h @@ -12,27 +12,27 @@ #define lttng_ust_field_float_nowrite(_type, _item, _src) \ lttng_ust__field_float(_type, _item, _src, 1) -#undef ctf_array_nowrite -#define ctf_array_nowrite(_type, _item, _src, _length) \ - _ctf_array_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, _length, none, 1, 10) +#undef lttng_ust_field_array_nowrite +#define lttng_ust_field_array_nowrite(_type, _item, _src, _length) \ + lttng_ust__field_array_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, _length, none, 1, 10) -#undef ctf_array_nowrite_hex -#define ctf_array_nowrite_hex(_type, _item, _src, _length) \ - _ctf_array_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, _length, none, 1, 16) +#undef lttng_ust_field_array_nowrite_hex +#define lttng_ust_field_array_nowrite_hex(_type, _item, _src, _length) \ + lttng_ust__field_array_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, _length, none, 1, 16) -#undef ctf_array_network_nowrite -#define ctf_array_network_nowrite(_type, _item, _src, _length) \ - _ctf_array_encoded(_type, _item, _src, LTTNG_UST_BIG_ENDIAN, \ +#undef lttng_ust_field_array_network_nowrite +#define lttng_ust_field_array_network_nowrite(_type, _item, _src, _length) \ + lttng_ust__field_array_encoded(_type, _item, _src, LTTNG_UST_BIG_ENDIAN, \ _length, none, 1, 10) -#undef ctf_array_network_nowrite_hex -#define ctf_array_network_nowrite_hex(_type, _item, _src, _length) \ - _ctf_array_encoded(_type, _item, _src, LTTNG_UST_BIG_ENDIAN, \ +#undef lttng_ust_field_array_network_nowrite_hex +#define lttng_ust_field_array_network_nowrite_hex(_type, _item, _src, _length) \ + lttng_ust__field_array_encoded(_type, _item, _src, LTTNG_UST_BIG_ENDIAN, \ _length, none, 1, 16) -#undef ctf_array_text_nowrite -#define ctf_array_text_nowrite(_type, _item, _src, _length) \ - _ctf_array_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, _length, UTF8, 1, 10) +#undef lttng_ust_field_array_text_nowrite +#define lttng_ust_field_array_text_nowrite(_type, _item, _src, _length) \ + lttng_ust__field_array_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, _length, UTF8, 1, 10) #undef ctf_sequence_nowrite #define ctf_sequence_nowrite(_type, _item, _src, _length_type, _src_length) \ diff --git a/include/lttng/ust-tracepoint-event-reset.h b/include/lttng/ust-tracepoint-event-reset.h index 96945926..bfce5796 100644 --- a/include/lttng/ust-tracepoint-event-reset.h +++ b/include/lttng/ust-tracepoint-event-reset.h @@ -34,8 +34,8 @@ #undef lttng_ust__field_float #define lttng_ust__field_float(_type, _item, _src, _nowrite) -#undef _ctf_array_encoded -#define _ctf_array_encoded(_type, _item, _src, _byte_order, _length, _encoding, \ +#undef lttng_ust__field_array_encoded +#define lttng_ust__field_array_encoded(_type, _item, _src, _byte_order, _length, _encoding, \ _nowrite, _elem_type_base) #undef _ctf_sequence_encoded @@ -67,20 +67,20 @@ #undef lttng_ust_field_float #define lttng_ust_field_float(_type, _item, _src) -#undef ctf_array -#define ctf_array(_type, _item, _src, _length) +#undef lttng_ust_field_array +#define lttng_ust_field_array(_type, _item, _src, _length) -#undef ctf_array_hex -#define ctf_array_hex(_type, _item, _src, _length) +#undef lttng_ust_field_array_hex +#define lttng_ust_field_array_hex(_type, _item, _src, _length) -#undef ctf_array_network -#define ctf_array_network(_type, _item, _src, _length) +#undef lttng_ust_field_array_network +#define lttng_ust_field_array_network(_type, _item, _src, _length) -#undef ctf_array_network_hex -#define ctf_array_network_hex(_type, _item, _src, _length) +#undef lttng_ust_field_array_network_hex +#define lttng_ust_field_array_network_hex(_type, _item, _src, _length) -#undef ctf_array_text -#define ctf_array_text(_type, _item, _src, _length) +#undef lttng_ust_field_array_text +#define lttng_ust_field_array_text(_type, _item, _src, _length) #undef ctf_sequence #define ctf_sequence(_type, _item, _src, _length_type, _src_length) @@ -113,20 +113,20 @@ #undef lttng_ust_field_float_nowrite #define lttng_ust_field_float_nowrite(_type, _item, _src) -#undef ctf_array_nowrite -#define ctf_array_nowrite(_type, _item, _src, _length) +#undef lttng_ust_field_array_nowrite +#define lttng_ust_field_array_nowrite(_type, _item, _src, _length) -#undef ctf_array_nowrite_hex -#define ctf_array_nowrite_hex(_type, _item, _src, _length) +#undef lttng_ust_field_array_nowrite_hex +#define lttng_ust_field_array_nowrite_hex(_type, _item, _src, _length) -#undef ctf_array_network_nowrite -#define ctf_array_network_nowrite(_type, _item, _src, _length) +#undef lttng_ust_field_array_network_nowrite +#define lttng_ust_field_array_network_nowrite(_type, _item, _src, _length) -#undef ctf_array_network_nowrite_hex -#define ctf_array_network_nowrite_hex(_type, _item, _src, _length) +#undef lttng_ust_field_array_network_nowrite_hex +#define lttng_ust_field_array_network_nowrite_hex(_type, _item, _src, _length) -#undef ctf_array_text_nowrite -#define ctf_array_text_nowrite(_type, _item, _src, _length) +#undef lttng_ust_field_array_text_nowrite +#define lttng_ust_field_array_text_nowrite(_type, _item, _src, _length) #undef ctf_sequence_nowrite #define ctf_sequence_nowrite(_type, _item, _src, _length_type, _src_length) diff --git a/include/lttng/ust-tracepoint-event-write.h b/include/lttng/ust-tracepoint-event-write.h index 66a7dede..a9292dfc 100644 --- a/include/lttng/ust-tracepoint-event-write.h +++ b/include/lttng/ust-tracepoint-event-write.h @@ -24,29 +24,29 @@ #define lttng_ust_field_float(_type, _item, _src) \ lttng_ust__field_float(_type, _item, _src, 0) -#undef ctf_array -#define ctf_array(_type, _item, _src, _length) \ - _ctf_array_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, \ +#undef lttng_ust_field_array +#define lttng_ust_field_array(_type, _item, _src, _length) \ + lttng_ust__field_array_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, \ _length, none, 0, 10) -#undef ctf_array_hex -#define ctf_array_hex(_type, _item, _src, _length) \ - _ctf_array_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, \ +#undef lttng_ust_field_array_hex +#define lttng_ust_field_array_hex(_type, _item, _src, _length) \ + lttng_ust__field_array_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, \ _length, none, 0, 16) -#undef ctf_array_network -#define ctf_array_network(_type, _item, _src, _length) \ - _ctf_array_encoded(_type, _item, _src, LTTNG_UST_BIG_ENDIAN, \ +#undef lttng_ust_field_array_network +#define lttng_ust_field_array_network(_type, _item, _src, _length) \ + lttng_ust__field_array_encoded(_type, _item, _src, LTTNG_UST_BIG_ENDIAN, \ _length, none, 0, 10) -#undef ctf_array_network_hex -#define ctf_array_network_hex(_type, _item, _src, _length) \ - _ctf_array_encoded(_type, _item, _src, LTTNG_UST_BIG_ENDIAN, \ +#undef lttng_ust_field_array_network_hex +#define lttng_ust_field_array_network_hex(_type, _item, _src, _length) \ + lttng_ust__field_array_encoded(_type, _item, _src, LTTNG_UST_BIG_ENDIAN, \ _length, none, 0, 16) -#undef ctf_array_text -#define ctf_array_text(_type, _item, _src, _length) \ - _ctf_array_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, \ +#undef lttng_ust_field_array_text +#define lttng_ust_field_array_text(_type, _item, _src, _length) \ + lttng_ust__field_array_encoded(_type, _item, _src, LTTNG_UST_BYTE_ORDER, \ _length, UTF8, 0, 10) #undef ctf_sequence diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index 66c27e05..f9c0c88c 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -225,17 +225,17 @@ void lttng_ust__event_template_proto___##_provider##___##_name(LTTNG_UST__TP_ARG #include #include -#undef _ctf_array_encoded -#define _ctf_array_encoded(_type, _item, _src, _byte_order, \ +#undef lttng_ust__field_array_encoded +#define lttng_ust__field_array_encoded(_type, _item, _src, _byte_order, \ _length, _encoding, _nowrite, \ _elem_type_base) \ - lttng_ust_ctf_array_element_type_is_supported(_type, _item); + lttng_ust_field_array_element_type_is_supported(_type, _item); #undef _ctf_sequence_encoded #define _ctf_sequence_encoded(_type, _item, _src, _byte_order, \ _length_type, _src_length, _encoding, _nowrite, \ _elem_type_base) \ - lttng_ust_ctf_array_element_type_is_supported(_type, _item); + lttng_ust_field_array_element_type_is_supported(_type, _item); #undef LTTNG_UST_TP_FIELDS #define LTTNG_UST_TP_FIELDS(...) __VA_ARGS__ /* Only one used in this phase */ @@ -278,8 +278,8 @@ void lttng_ust__event_template_proto___##_provider##___##_name(LTTNG_UST__TP_ARG .nofilter = 0, \ }), -#undef _ctf_array_encoded -#define _ctf_array_encoded(_type, _item, _src, _byte_order, \ +#undef lttng_ust__field_array_encoded +#define lttng_ust__field_array_encoded(_type, _item, _src, _byte_order, \ _length, _encoding, _nowrite, \ _elem_type_base) \ LTTNG_UST_COMPOUND_LITERAL(const struct lttng_ust_event_field, { \ @@ -426,8 +426,8 @@ static void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_D __event_len += lttng_ust_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \ __event_len += sizeof(_type); -#undef _ctf_array_encoded -#define _ctf_array_encoded(_type, _item, _src, _byte_order, _length, _encoding, \ +#undef lttng_ust__field_array_encoded +#define lttng_ust__field_array_encoded(_type, _item, _src, _byte_order, _length, _encoding, \ _nowrite, _elem_type_base) \ if (0) \ (void) (_src); /* Unused */ \ @@ -587,8 +587,8 @@ size_t lttng_ust__event_get_size__##_provider##___##_name( \ __stack_data += sizeof(double); \ } -#undef _ctf_array_encoded -#define _ctf_array_encoded(_type, _item, _src, _byte_order, _length, \ +#undef lttng_ust__field_array_encoded +#define lttng_ust__field_array_encoded(_type, _item, _src, _byte_order, _length, \ _encoding, _nowrite, _elem_type_base) \ { \ unsigned long __ctf_tmp_ulong = (unsigned long) (_length); \ @@ -673,8 +673,8 @@ void lttng_ust__event_prepare_interpreter_stack__##_provider##___##_name(char *_ (void) (_src); /* Unused */ \ lttng_ust__event_align = lttng_ust__tp_max_t(size_t, lttng_ust__event_align, lttng_ust_rb_alignof(_type)); -#undef _ctf_array_encoded -#define _ctf_array_encoded(_type, _item, _src, _byte_order, _length, \ +#undef lttng_ust__field_array_encoded +#define lttng_ust__field_array_encoded(_type, _item, _src, _byte_order, _length, \ _encoding, _nowrite, _elem_type_base) \ if (0) \ (void) (_src); /* Unused */ \ @@ -751,8 +751,8 @@ size_t lttng_ust__event_get_align__##_provider##___##_name(LTTNG_UST__TP_ARGS_PR __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp), lttng_ust_rb_alignof(__tmp));\ } -#undef _ctf_array_encoded -#define _ctf_array_encoded(_type, _item, _src, _byte_order, _length, \ +#undef lttng_ust__field_array_encoded +#define lttng_ust__field_array_encoded(_type, _item, _src, _byte_order, _length, \ _encoding, _nowrite, _elem_type_base) \ if (lttng_ust_string_encoding_##_encoding == lttng_ust_string_encoding_none) \ __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length), lttng_ust_rb_alignof(_type)); \ diff --git a/include/lttng/ust-utils.h b/include/lttng/ust-utils.h index 13d2a7ae..d2747d4a 100644 --- a/include/lttng/ust-utils.h +++ b/include/lttng/ust-utils.h @@ -59,15 +59,15 @@ #endif /** - * lttng_ust_ctf_array_element_type_is_supported - + * lttng_ust_field_array_element_type_is_supported - * - * Adds a compilation assertion that CTF arrays and sequences declared by the + * Adds a compilation assertion that array and sequence fields declared by the * user are of an integral type. */ -#define lttng_ust_ctf_array_element_type_is_supported(type, item) \ +#define lttng_ust_field_array_element_type_is_supported(type, item) \ lttng_ust_static_assert(lttng_ust_is_integer_type(type), \ - "Non-integer type `" #item "` not supported as element of CTF_ARRAY or CTF_SEQUENCE", \ - Non_integer_type__##item##__not_supported_as_element_of_CTF_ARRAY_or_CTF_SEQUENCE) + "Non-integer type `" #item "` not supported as element of LTTNG_UST_FIELD_ARRAY or LTTNG_UST_FIELD_SEQUENCE", \ + Non_integer_type__##item##__not_supported_as_element_of_LTTNG_UST_FIELD_ARRAY_or_LTTNG_UST_FIELD_SEQUENCE) /** diff --git a/src/lib/lttng-ust/lttng-ust-statedump-provider.h b/src/lib/lttng-ust/lttng-ust-statedump-provider.h index 0805d546..d3b18a66 100644 --- a/src/lib/lttng-ust/lttng-ust-statedump-provider.h +++ b/src/lib/lttng-ust/lttng-ust-statedump-provider.h @@ -88,7 +88,7 @@ LTTNG_UST_TRACEPOINT_EVENT(lttng_ust_statedump, procname, ), LTTNG_UST_TP_FIELDS( ctf_unused(session) - ctf_array_text(char, procname, name, LTTNG_UST_ABI_PROCNAME_LEN) + lttng_ust_field_array_text(char, procname, name, LTTNG_UST_ABI_PROCNAME_LEN) ) ) diff --git a/tests/compile/hello.cxx/ust_tests_hello.h b/tests/compile/hello.cxx/ust_tests_hello.h index 9fba556e..4bcbce9a 100644 --- a/tests/compile/hello.cxx/ust_tests_hello.h +++ b/tests/compile/hello.cxx/ust_tests_hello.h @@ -35,8 +35,8 @@ LTTNG_UST_TRACEPOINT_EVENT(ust_tests_hello, tptest, lttng_ust_field_integer(long, longfield, anint) lttng_ust_field_integer_network(int, netintfield, netint) lttng_ust_field_integer_network_hex(int, netintfieldhex, netint) - ctf_array(long, arrfield1, values, 3) - ctf_array_text(char, arrfield2, text, 10) + lttng_ust_field_array(long, arrfield1, values, 3) + lttng_ust_field_array_text(char, arrfield2, text, 10) ctf_sequence(char, seqfield1, text, size_t, textlen) ctf_sequence_text(char, seqfield2, text, diff --git a/tests/compile/hello/ust_tests_hello.h b/tests/compile/hello/ust_tests_hello.h index 7cc92a27..450096d2 100644 --- a/tests/compile/hello/ust_tests_hello.h +++ b/tests/compile/hello/ust_tests_hello.h @@ -25,13 +25,13 @@ LTTNG_UST_TRACEPOINT_EVENT(ust_tests_hello, tptest, lttng_ust_field_integer(long, longfield, anint) lttng_ust_field_integer_network(int, netintfield, netint) lttng_ust_field_integer_network_hex(int, netintfieldhex, netint) - ctf_array_nowrite(long, arrfield1z, values, 3) - ctf_array(long, blah, values, 3) - ctf_array(long, arrfield1, values, 3) - ctf_array_hex(long, arrfield1_hex, values, 3) - ctf_array_network(long, arrfield1_network, values, 3) - ctf_array_network_hex(long, arrfield1_network_hex, values, 3) - ctf_array_text(char, arrfield2, text, 10) + lttng_ust_field_array_nowrite(long, arrfield1z, values, 3) + lttng_ust_field_array(long, blah, values, 3) + lttng_ust_field_array(long, arrfield1, values, 3) + lttng_ust_field_array_hex(long, arrfield1_hex, values, 3) + lttng_ust_field_array_network(long, arrfield1_network, values, 3) + lttng_ust_field_array_network_hex(long, arrfield1_network_hex, values, 3) + lttng_ust_field_array_text(char, arrfield2, text, 10) ctf_sequence(char, seqfield1, text, size_t, textlen) ctf_sequence_nowrite(char, seqfield1z, text, diff --git a/tests/compile/test-app-ctx/ust_tests_hello.h b/tests/compile/test-app-ctx/ust_tests_hello.h index 8d2ac308..86ee816c 100644 --- a/tests/compile/test-app-ctx/ust_tests_hello.h +++ b/tests/compile/test-app-ctx/ust_tests_hello.h @@ -25,8 +25,8 @@ LTTNG_UST_TRACEPOINT_EVENT(ust_tests_hello, tptest, lttng_ust_field_integer(long, longfield, anint) lttng_ust_field_integer_network(int, netintfield, netint) lttng_ust_field_integer_network_hex(int, netintfieldhex, netint) - ctf_array(long, arrfield1, values, 3) - ctf_array_text(char, arrfield2, text, 10) + lttng_ust_field_array(long, arrfield1, values, 3) + lttng_ust_field_array_text(char, arrfield2, text, 10) ctf_sequence(char, seqfield1, text, size_t, textlen) ctf_sequence_text(char, seqfield2, text, -- 2.34.1