Refactoring: tracepoint: allow explicit tracepoint instance provider name
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 5 May 2021 19:04:38 +0000 (15:04 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 6 May 2021 15:12:24 +0000 (11:12 -0400)
Add a template_provider argument to LTTNG_UST_TRACEPOINT_EVENT_INSTANCE
to allow a tracepoint instance to refer to a tracepoint class from
another provider within the same compile unit.

Also introduce struct lttng_ust_tracepoint_class to clearly split the
event instance from the class, thus allowing the event instance to refer
to the class through a single symbol. This removes the need to rely on
LTTNG_UST__TP_ARRAY_SIZE() to calculate the size of the event field
array (part of the class) from within the event instance. This
refactoring opens the door to have event class and instance not only in
different providers, but also in providers emitted within different
compile units and shared objects in the future.

For instance, if a .c includes the following headers:

 #define LTTNG_UST_TRACEPOINT_CREATE_PROBES
 #include "a.h"
 #include "b.h"

where a.h contains:

LTTNG_UST_TRACEPOINT_EVENT_CLASS(a, myclass,
        LTTNG_UST_TP_ARGS(int, anint),
        LTTNG_UST_TP_FIELDS(
                lttng_ust_field_integer(int, intfield, anint)
        )
)

and b.h contains:

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(a, myclass,
        b, myeventinstance,
        LTTNG_UST_TP_ARGS(int, anint)
)

This is a localized API-breaking change introduced very early in the
2.13-rc cycle.

This changes the ABI exposed by the probe providers, so bump the probe
provider major version, and make newer lttng-ust reject old incompatible
major. We can do this because it is very early in the 2.13-rc cycle.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Icf25dc950e483719a26785cd17be9f3d113f7237

include/lttng/tp/lttng-ust-tracelog.h
include/lttng/tracepoint-event.h
include/lttng/tracepoint.h
include/lttng/ust-events.h
include/lttng/ust-tracepoint-event-reset.h
include/lttng/ust-tracepoint-event.h
src/lib/lttng-ust-cyg-profile/lttng-ust-cyg-profile.h
src/lib/lttng-ust/lttng-bytecode-specialize.c
src/lib/lttng-ust/lttng-bytecode.c
src/lib/lttng-ust/lttng-events.c
src/lib/lttng-ust/lttng-probes.c

index 5e8d9f0d78e92c3166d10b1019d7cb427bde2f70..673c9abc35df4cc50d3250a413192c7cc433a0ae 100644 (file)
@@ -20,7 +20,8 @@ LTTNG_UST_TRACEPOINT_EVENT_CLASS(lttng_ust_tracelog, tlclass,
 )
 
 #define LTTNG_UST_TP_TRACELOG_TEMPLATE(_level_enum) \
-       LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(lttng_ust_tracelog, tlclass, _level_enum, \
+       LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(lttng_ust_tracelog, tlclass, \
+               lttng_ust_tracelog, _level_enum, \
                LTTNG_UST_TP_ARGS(const char *, file, int, line, const char *, func, \
                        const char *, msg, unsigned int, len, void *, ip) \
        ) \
index 24b387d30b8d32b185231854a1fe4a3b1f3e8071..4c072ca2718754bf1781f766a943ef1d9bc3bb78 100644 (file)
 #define lttng_ust__tp_stringify(x)     lttng_ust__tp_stringify1(x)
 
 #undef LTTNG_UST_TRACEPOINT_EVENT_INSTANCE
-#define LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args)
+#define LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, \
+       _provider, _name, _args)
 
 #undef LTTNG_UST_TRACEPOINT_EVENT
 #define LTTNG_UST_TRACEPOINT_EVENT(_provider, _name, _args, _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,            \
+       LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(_provider, _name, _provider, _name, \
                        LTTNG_UST__TP_PARAMS(_args))
 
 
@@ -95,7 +96,7 @@
 #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)   \
+#define LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(template_provider, template_name, provider, name, args) \
        LTTNG_UST__DECLARE_TRACEPOINT(provider, name, LTTNG_UST__TP_PARAMS(args))               \
        LTTNG_UST__DEFINE_TRACEPOINT(provider, name, LTTNG_UST__TP_PARAMS(args))
 
index c59a96c990218dce0f6ded3a90f9344a95b28bae..1f8b9209de0c1ec4992af786f32ef623230fbc28 100644 (file)
@@ -783,14 +783,17 @@ lttng_ust__tracepoints__ptrs_destroy(void)
 
 #define LTTNG_UST_TRACEPOINT_EVENT_CLASS(provider, name, args, fields)
 
-#define LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(provider, _template, name, args)   \
+#define LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(template_provider, template_name, provider, name, 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
 #define TRACEPOINT_EVENT_CLASS         LTTNG_UST_TRACEPOINT_EVENT_CLASS
-#define TRACEPOINT_EVENT_INSTANCE      LTTNG_UST_TRACEPOINT_EVENT_INSTANCE
+#define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, args)   \
+       LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(_provider, _template,       \
+               _provider, _name, LTTNG_UST__TP_PARAMS(args))
+
 #endif /* #if LTTNG_UST_COMPAT_API(0) */
 
 #endif /* #ifndef LTTNG_UST_TRACEPOINT_EVENT */
index 6920306846f2bc273d883b027403d97281492adb..b09a6718ce022e02526e3dd4500ac7aa773134ac 100644 (file)
@@ -31,8 +31,13 @@ extern "C" {
  * Older tracepoint providers can always register to newer lttng-ust
  * library, but the opposite is rejected: a newer tracepoint provider is
  * rejected by an older lttng-ust library.
+ *
+ * LTTNG_UST_PROVIDER_MAJOR_OLDEST_COMPATIBLE is the floor value of
+ * oldest provider major version currently allowed, typically increased
+ * when LTTng-UST has an ABI-breaking soname bump.
  */
-#define LTTNG_UST_PROVIDER_MAJOR       2
+#define LTTNG_UST_PROVIDER_MAJOR                       3
+#define LTTNG_UST_PROVIDER_MAJOR_OLDEST_COMPATIBLE     3
 #define LTTNG_UST_PROVIDER_MINOR       0
 
 struct lttng_ust_channel_buffer;
@@ -252,6 +257,28 @@ struct lttng_ust_event_field {
        /* End of base ABI. Fields below should be used after checking struct_size. */
 };
 
+/*
+ * Tracepoint class description
+ *
+ * IMPORTANT: this structure is part of the ABI between the probe and
+ * UST. Fields need to be only added at the end, never reordered, never
+ * removed.
+ *
+ * The field @struct_size should be used to determine the size of the
+ * structure. It should be queried before using additional fields added
+ * at the end of the structure.
+ */
+
+struct lttng_ust_tracepoint_class {
+       uint32_t struct_size;
+
+       const struct lttng_ust_event_field * const *fields;
+       size_t nr_fields;
+       void (*probe_callback)(void);
+       const char *signature;                          /* Argument types/names received */
+
+       /* End of base ABI. Fields below should be used after checking struct_size. */
+};
 
 /*
  * IMPORTANT: this structure is part of the ABI between the probe and
@@ -267,11 +294,8 @@ struct lttng_ust_event_desc {
 
        const char *event_name;
        const struct lttng_ust_probe_desc *probe_desc;
-       void (*probe_callback)(void);
-       const struct lttng_ust_event_field * const *fields;     /* event payload */
-       unsigned int nr_fields;
+       const struct lttng_ust_tracepoint_class *tp_class;
        const int **loglevel;
-       const char *signature;                          /* Argument types/names received */
        const char **model_emf_uri;
 
        /* End of base ABI. Fields below should be used after checking struct_size. */
index 2bc255fa571ff1d779d10e93ecbcf00a3c8dc221..10c288fe576699fa85eb3fa176217ebbf74094a4 100644 (file)
@@ -10,7 +10,7 @@
 #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)
+#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args)
 
 #undef LTTNG_UST_TRACEPOINT_ENUM
 #define LTTNG_UST_TRACEPOINT_ENUM(_provider, _name, _values)
index 586f59f9643cd392720cf0c81ce35986e1c0e482..c6dfed7ddc36700f1ab8d43430d3f676ed8f53d9 100644 (file)
@@ -84,7 +84,7 @@
        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,   \
+       LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _name, _provider, _name, \
                         LTTNG_UST__TP_PARAMS(_args))
 
 #undef LTTNG_UST_TRACEPOINT_EVENT_CLASS
@@ -92,8 +92,8 @@
        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, LTTNG_UST__TP_PARAMS(_args))
+#define LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) \
+       LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, LTTNG_UST__TP_PARAMS(_args))
 
 /* Helpers */
 #define LTTNG_UST__TP_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
@@ -128,7 +128,7 @@ void LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_mismatch_, LTTNG
        lttng_ust_tracepoint_provider_mismatch_##_provider();
 
 #undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE
-#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args)       \
+#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) \
        lttng_ust_tracepoint_provider_mismatch_##_provider();
 
 static inline
@@ -151,7 +151,7 @@ void LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_check_, LTTNG_US
 #include <lttng/ust-tracepoint-event-reset.h>
 
 #undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE
-#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args)       \
+#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) \
        lttng_ust_tracepoint_validate_name_len(_provider, _name);
 
 #include LTTNG_UST_TRACEPOINT_INCLUDE
@@ -171,8 +171,8 @@ void LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_check_, LTTNG_US
 #define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
 
 #undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE
-#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
-void lttng_ust__event_template_proto___##_provider##___##_template(LTTNG_UST__TP_ARGS_DATA_PROTO(_args));
+#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) \
+void lttng_ust__event_template_proto___##_template_provider##___##_template_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args));
 
 #undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
 #define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
@@ -288,9 +288,50 @@ void lttng_ust__event_template_proto___##_provider##___##_name(LTTNG_UST__TP_ARG
 
 #include LTTNG_UST_TRACEPOINT_INCLUDE
 
+/*
+ * Stage 0.9.2 of tracepoint event generation.
+ *
+ * Create probe signature
+ */
+
+/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
+#include <lttng/ust-tracepoint-event-reset.h>
+
+#undef LTTNG_UST_TP_ARGS
+#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
+
+#define LTTNG_UST__TP_EXTRACT_STRING2(...)     #__VA_ARGS__
+
+#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
+#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields)    \
+static const char __tp_event_signature___##_provider##___##_name[] =   \
+               LTTNG_UST__TP_EXTRACT_STRING2(_args);
+
+#include LTTNG_UST_TRACEPOINT_INCLUDE
+
+#undef LTTNG_UST__TP_EXTRACT_STRING2
+
 /*
  * Stage 1 of tracepoint event generation.
  *
+ * Create probe callback prototypes.
+ */
+
+/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
+#include <lttng/ust-tracepoint-event-reset.h>
+
+#undef LTTNG_UST_TP_ARGS
+#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
+
+#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
+#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields)            \
+static void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args));
+
+#include LTTNG_UST_TRACEPOINT_INCLUDE
+
+/*
+ * Stage 2 of tracepoint event generation.
+ *
  * Create event field type metadata section.
  * Each event produce an array of fields.
  */
@@ -413,6 +454,13 @@ void lttng_ust__event_template_proto___##_provider##___##_name(LTTNG_UST__TP_ARG
        static const struct lttng_ust_event_field * const lttng_ust__event_fields___##_provider##___##_name[] = { \
                _fields                                                                      \
                lttng_ust_field_integer(int, dummy, 0)  /* Dummy, C99 forbids 0-len array. */        \
+       };                                                                                           \
+       static const struct lttng_ust_tracepoint_class lttng_ust__event_class___##_provider##___##_name = { \
+               .struct_size = sizeof(struct lttng_ust_tracepoint_class),                            \
+               .fields = lttng_ust__event_fields___##_provider##___##_name,                         \
+               .nr_fields = LTTNG_UST__TP_ARRAY_SIZE(lttng_ust__event_fields___##_provider##___##_name) - 1, \
+               .probe_callback = (void (*)(void)) &lttng_ust__event_probe__##_provider##___##_name, \
+               .signature = __tp_event_signature___##_provider##___##_name,                         \
        };
 
 #undef LTTNG_UST_TRACEPOINT_ENUM
@@ -426,24 +474,6 @@ void lttng_ust__event_template_proto___##_provider##___##_name(LTTNG_UST__TP_ARG
 
 #include LTTNG_UST_TRACEPOINT_INCLUDE
 
-/*
- * Stage 2 of tracepoint event generation.
- *
- * Create probe callback prototypes.
- */
-
-/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
-#include <lttng/ust-tracepoint-event-reset.h>
-
-#undef LTTNG_UST_TP_ARGS
-#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
-
-#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
-#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields)            \
-static void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args));
-
-#include LTTNG_UST_TRACEPOINT_INCLUDE
-
 /*
  * Stage 3.0 of tracepoint event generation.
  *
@@ -977,29 +1007,6 @@ void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PRO
 
 #undef lttng_ust__get_dynamic_len
 
-/*
- * Stage 5.1 of tracepoint event generation.
- *
- * Create probe signature
- */
-
-/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */
-#include <lttng/ust-tracepoint-event-reset.h>
-
-#undef LTTNG_UST_TP_ARGS
-#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
-
-#define LTTNG_UST__TP_EXTRACT_STRING2(...)     #__VA_ARGS__
-
-#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
-#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields)    \
-static const char __tp_event_signature___##_provider##___##_name[] =   \
-               LTTNG_UST__TP_EXTRACT_STRING2(_args);
-
-#include LTTNG_UST_TRACEPOINT_INCLUDE
-
-#undef LTTNG_UST__TP_EXTRACT_STRING2
-
 /*
  * Stage 6 of tracepoint event generation.
  *
@@ -1096,7 +1103,7 @@ extern const struct lttng_ust_probe_desc LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_
 #include <lttng/ust-tracepoint-event-reset.h>
 
 #undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE
-#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args)              \
+#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) \
 static const int *                                                            \
        __ref_loglevel___##_provider##___##_name                               \
        __attribute__((weakref ("_loglevel___" #_provider "___" #_name)));     \
@@ -1107,11 +1114,8 @@ static const struct lttng_ust_event_desc lttng_ust__event_desc___##_provider##_#
        .struct_size = sizeof(struct lttng_ust_event_desc),                    \
        .event_name = #_name,                                                  \
        .probe_desc = &lttng_ust__probe_desc___##_provider,                            \
-       .probe_callback = (void (*)(void)) &lttng_ust__event_probe__##_provider##___##_template, \
-       .fields = lttng_ust__event_fields___##_provider##___##_template,                       \
-       .nr_fields = LTTNG_UST__TP_ARRAY_SIZE(lttng_ust__event_fields___##_provider##___##_template) - 1, \
+       .tp_class = &lttng_ust__event_class___##_template_provider##___##_template_name, \
        .loglevel = &__ref_loglevel___##_provider##___##_name,                 \
-       .signature = __tp_event_signature___##_provider##___##_template,       \
        .model_emf_uri = &__ref_model_emf_uri___##_provider##___##_name,       \
 };
 
@@ -1127,7 +1131,7 @@ static const struct lttng_ust_event_desc lttng_ust__event_desc___##_provider##_#
 #include <lttng/ust-tracepoint-event-reset.h>
 
 #undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE
-#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args)              \
+#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) \
        &lttng_ust__event_desc___##_provider##_##_name,
 
 static const struct lttng_ust_event_desc * const LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__event_desc___, LTTNG_UST_TRACEPOINT_PROVIDER)[] = {
index 8661163b79c45ae9a96e3a232c403c588e4e59a7..c98d555d7a7f1e8bca632559ef03c3585c830d99 100644 (file)
@@ -27,7 +27,7 @@ LTTNG_UST_TRACEPOINT_EVENT_CLASS(lttng_ust_cyg_profile, func_class,
 )
 
 LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(lttng_ust_cyg_profile, func_class,
-       func_entry,
+       lttng_ust_cyg_profile, func_entry,
        LTTNG_UST_TP_ARGS(void *, func_addr, void *, call_site)
 )
 
@@ -35,7 +35,7 @@ LTTNG_UST_TRACEPOINT_LOGLEVEL(lttng_ust_cyg_profile, func_entry,
        LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_FUNCTION)
 
 LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(lttng_ust_cyg_profile, func_class,
-       func_exit,
+       lttng_ust_cyg_profile, func_exit,
        LTTNG_UST_TP_ARGS(void *, func_addr, void *, call_site)
 )
 
index e57892f2930b5404651fe6fee9d9ea3401e0e7b1..be1d9d718ec777159bff4f22fcc5d931957bf1e0 100644 (file)
@@ -564,11 +564,11 @@ static int specialize_payload_lookup(const struct lttng_ust_event_desc *event_de
        struct bytecode_get_index_data gid;
        ssize_t data_offset;
 
-       nr_fields = event_desc->nr_fields;
+       nr_fields = event_desc->tp_class->nr_fields;
        offset = ((struct get_symbol *) insn->data)->offset;
        name = runtime->p.bc->bc.data + runtime->p.bc->bc.reloc_offset + offset;
        for (i = 0; i < nr_fields; i++) {
-               field = event_desc->fields[i];
+               field = event_desc->tp_class->fields[i];
                if (field->nofilter) {
                        continue;
                }
index 33d50db64f5550adb94dc6ea1d814582fc24862a..099fc5ca5bab4d444f328fc2fa0ae9991cefe749 100644 (file)
@@ -190,10 +190,10 @@ int apply_field_reloc(const struct lttng_ust_event_desc *event_desc,
        /* Lookup event by name */
        if (!event_desc)
                return -EINVAL;
-       fields = event_desc->fields;
+       fields = event_desc->tp_class->fields;
        if (!fields)
                return -EINVAL;
-       nr_fields = event_desc->nr_fields;
+       nr_fields = event_desc->tp_class->nr_fields;
        for (i = 0; i < nr_fields; i++) {
                if (fields[i]->nofilter) {
                        continue;
index 8596b7a088025c817bf3e0a177fa6d1ba5db8955..2607159447da667f7cf52cad8c83cf00c0d150ef 100644 (file)
@@ -270,8 +270,8 @@ void register_event(struct lttng_ust_event_common *event)
        desc = event->priv->desc;
        ret = lttng_ust_tp_probe_register_queue_release(desc->probe_desc->provider_name,
                        desc->event_name,
-                       desc->probe_callback,
-                       event, desc->signature);
+                       desc->tp_class->probe_callback,
+                       event, desc->tp_class->signature);
        WARN_ON_ONCE(ret);
        if (!ret)
                event->priv->registered = 1;
@@ -287,7 +287,7 @@ void unregister_event(struct lttng_ust_event_common *event)
        desc = event->priv->desc;
        ret = lttng_ust_tp_probe_unregister_queue_release(desc->probe_desc->provider_name,
                        desc->event_name,
-                       desc->probe_callback,
+                       desc->tp_class->probe_callback,
                        event);
        WARN_ON_ONCE(ret);
        if (!ret)
@@ -729,7 +729,7 @@ int lttng_event_recorder_create(const struct lttng_ust_event_desc *desc,
                goto socket_error;
        }
 
-       ret = lttng_create_all_event_enums(desc->nr_fields, desc->fields,
+       ret = lttng_create_all_event_enums(desc->tp_class->nr_fields, desc->tp_class->fields,
                        session);
        if (ret < 0) {
                DBG("Error (%d) adding enum to session", ret);
@@ -793,9 +793,9 @@ int lttng_event_recorder_create(const struct lttng_ust_event_desc *desc,
                chan->priv->parent.objd,
                name,
                loglevel,
-               desc->signature,
-               desc->nr_fields,
-               desc->fields,
+               desc->tp_class->signature,
+               desc->tp_class->nr_fields,
+               desc->tp_class->fields,
                uri,
                &event_recorder->priv->id);
        if (ret < 0) {
@@ -1173,12 +1173,12 @@ void _event_enum_destroy(struct lttng_ust_event_common *event)
                unsigned int i;
 
                /* Destroy enums of the current event. */
-               for (i = 0; i < event_recorder->parent->priv->desc->nr_fields; i++) {
+               for (i = 0; i < event_recorder->parent->priv->desc->tp_class->nr_fields; i++) {
                        const struct lttng_ust_enum_desc *enum_desc;
                        const struct lttng_ust_event_field *field;
                        struct lttng_enum *curr_enum;
 
-                       field = event_recorder->parent->priv->desc->fields[i];
+                       field = event_recorder->parent->priv->desc->tp_class->fields[i];
                        switch (field->type->type) {
                        case lttng_ust_type_enum:
                                enum_desc = lttng_ust_get_type_enum(field->type)->desc;
index 1e73064907865e8e2e7cfbc396fd0fa1fe96c647..911c29178f1b5439b907beb73101dd1e0d3e95f0 100644 (file)
@@ -137,7 +137,8 @@ int check_provider_version(const struct lttng_ust_probe_desc *desc)
        /*
         * Check tracepoint provider version compatibility.
         */
-       if (desc->major <= LTTNG_UST_PROVIDER_MAJOR) {
+       if (desc->major <= LTTNG_UST_PROVIDER_MAJOR &&
+                       desc->major >= LTTNG_UST_PROVIDER_MAJOR_OLDEST_COMPATIBLE) {
                DBG("Provider \"%s\" accepted, version %u.%u is compatible "
                        "with LTTng UST provider version %u.%u.",
                        desc->provider_name, desc->major, desc->minor,
@@ -326,7 +327,7 @@ int lttng_probes_get_field_list(struct lttng_ust_field_list *list)
                                probe_desc->event_desc[i];
                        int j;
 
-                       if (event_desc->nr_fields == 0) {
+                       if (event_desc->tp_class->nr_fields == 0) {
                                /* Events without fields. */
                                struct tp_field_list_entry *list_entry;
 
@@ -348,9 +349,9 @@ int lttng_probes_get_field_list(struct lttng_ust_field_list *list)
                                list_entry->field.nowrite = 1;
                        }
 
-                       for (j = 0; j < event_desc->nr_fields; j++) {
+                       for (j = 0; j < event_desc->tp_class->nr_fields; j++) {
                                const struct lttng_ust_event_field *event_field =
-                                       event_desc->fields[j];
+                                       event_desc->tp_class->fields[j];
                                struct tp_field_list_entry *list_entry;
 
                                /* Skip event if name is too long. */
This page took 0.036309 seconds and 4 git commands to generate.