Fix: backward compatibility with UST 2.0 app probes
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 7 Sep 2012 19:19:45 +0000 (15:19 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 7 Sep 2012 19:19:45 +0000 (15:19 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng/ringbuffer-config.h
include/lttng/ust-abi.h
include/lttng/ust-events.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
liblttng-ust/ltt-events.c
liblttng-ust/ltt-probes.c

index 650b56b250db4dbb6d2889bff659c74fe1c20970..174906cbafcdea9469601ba39a996bde3f2ecc26 100644 (file)
@@ -188,6 +188,10 @@ struct lttng_ust_lib_ring_buffer_config {
  * Context passed to lib_ring_buffer_reserve(), lib_ring_buffer_commit(),
  * lib_ring_buffer_try_discard_reserve(), lib_ring_buffer_align_ctx() and
  * lib_ring_buffer_write().
+ *
+ * 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.
  */
 #define LTTNG_UST_RING_BUFFER_CTX_PADDING      24
 struct lttng_ust_lib_ring_buffer_ctx {
index 91639a7c6d43279ab60f85b0098d2bced8484d0b..c9be4bd9d29fda9d8268a8d3531774d253f6e791 100644 (file)
@@ -105,7 +105,7 @@ struct lttng_ust_field_iter {
        char field_name[LTTNG_UST_SYM_NAME_LEN];
        enum lttng_ust_field_type type;
        int loglevel;                           /* event loglevel */
-       int written;
+       int nowrite;
        char padding[LTTNG_UST_FIELD_ITER_PADDING];
 };
 
index 8a2fa14c04e1c5f2247c6f303d750c7d932e5246..daf589025fd0074031c0290f603ba03538c812e5 100644 (file)
@@ -179,13 +179,19 @@ struct lttng_enum {
        char padding[LTTNG_UST_ENUM_TYPE_PADDING];
 };
 
-/* Event field description */
+/*
+ * Event field 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.
+ */
 
 #define LTTNG_UST_EVENT_FIELD_PADDING  28
 struct lttng_event_field {
        const char *name;
        struct lttng_type type;
-       unsigned int written;   /* written into trace */
+       unsigned int nowrite;   /* do not write into trace */
        char padding[LTTNG_UST_EVENT_FIELD_PADDING];
 };
 
@@ -291,14 +297,18 @@ struct lttng_ust_filter_bytecode;
 /*
  * ltt_event structure is referred to by the tracing fast path. It must be
  * kept small.
+ *
+ * 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.
  */
 struct ltt_event {
+       /* LTTng-UST 2.0 starts here */
        unsigned int id;
        struct ltt_channel *chan;
        int enabled;
        const struct lttng_event_desc *desc;
        int (*filter)(void *filter_data, const char *filter_stack_data);
-       void *filter_data;
        struct lttng_ctx *ctx;
        enum lttng_ust_instrumentation instrumentation;
        union {
@@ -306,13 +316,20 @@ struct ltt_event {
        struct cds_list_head list;              /* Event list */
        struct cds_list_head wildcard_list;     /* Event list for wildcard */
        struct ust_pending_probe *pending_probe;
-       struct lttng_ust_filter_bytecode *filter_bytecode;
        unsigned int metadata_dumped:1;
+       /* LTTng-UST 2.1 starts here */
+       struct lttng_ust_filter_bytecode *filter_bytecode;
+       void *filter_data;
 };
 
 struct channel;
 struct lttng_ust_shm_handle;
 
+/*
+ * 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.
+ */
 struct ltt_channel_ops {
        struct ltt_channel *(*channel_create)(const char *name,
                                void *buf_addr,
@@ -348,6 +365,11 @@ struct ltt_channel_ops {
        int (*flush_buffer)(struct channel *chan, struct lttng_ust_shm_handle *handle);
 };
 
+/*
+ * 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.
+ */
 struct ltt_channel {
        /*
         * The pointers located in this private data are NOT safe to be
@@ -375,6 +397,11 @@ struct ltt_channel {
        unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
 };
 
+/*
+ * 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.
+ */
 struct ltt_session {
        int active;                     /* Is trace session active ? */
        int been_active;                /* Has trace session been active ? */
index 2b23a81d4955167a45aadc0b339acef6bedf270e..bd7c57526cd6e75b789edbebcc8d8117830ce463 100644 (file)
 
 #undef ctf_integer_nowrite
 #define ctf_integer_nowrite(_type, _item, _src)                        \
-       _ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10, 0)
+       _ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10, 1)
 
 #undef ctf_float_nowrite
 #define ctf_float_nowrite(_type, _item, _src)                  \
-       _ctf_float(_type, _item, _src, 0)
+       _ctf_float(_type, _item, _src, 1)
 
 #undef ctf_array_nowrite
 #define ctf_array_nowrite(_type, _item, _src, _length)         \
-       _ctf_array_encoded(_type, _item, _src, _length, none, 0)
+       _ctf_array_encoded(_type, _item, _src, _length, none, 1)
 
 #undef ctf_array_text_nowrite
 #define ctf_array_text_nowrite(_type, _item, _src, _length)    \
-       _ctf_array_encoded(_type, _item, _src, _length, UTF8, 0)
+       _ctf_array_encoded(_type, _item, _src, _length, UTF8, 1)
 
 #undef ctf_sequence_nowrite
 #define ctf_sequence_nowrite(_type, _item, _src, _length_type, _src_length) \
        _ctf_sequence_encoded(_type, _item, _src,               \
-                       _length_type, _src_length, none, 0)
+                       _length_type, _src_length, none, 1)
 
 #undef ctf_sequence_text_nowrite
 #define ctf_sequence_text_nowrite(_type, _item, _src, _length_type, _src_length) \
        _ctf_sequence_encoded(_type, _item, _src,               \
-                       _length_type, _src_length, UTF8, 0)
+                       _length_type, _src_length, UTF8, 1)
 
 #undef ctf_string_nowrite
 #define ctf_string_nowrite(_item, _src)                                \
-       _ctf_string(_item, _src, 0)
+       _ctf_string(_item, _src, 1)
index 25432fdc922466cf3b244879961512ae0ad44661..e76072fc532d90fe98ecdc10e2f157e3a595990f 100644 (file)
 
 #undef _ctf_integer_ext
 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, \
-                       _written)
+                       _nowrite)
 
 #undef _ctf_float
-#define _ctf_float(_type, _item, _src, _written)
+#define _ctf_float(_type, _item, _src, _nowrite)
 
 #undef _ctf_array_encoded
 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, \
-                       _written)
+                       _nowrite)
 
 #undef _ctf_sequence_encoded
 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
-                       _src_length, _encoding, _written)
+                       _src_length, _encoding, _nowrite)
 
 #undef _ctf_string
-#define _ctf_string(_item, _src, _written)
+#define _ctf_string(_item, _src, _nowrite)
 
 /* "write" */
 #undef ctf_integer
index a23cab6037b3ae781847edb76458d48f7fa48f56..e0c6eed7e3e8fcde9ddbc7d730fe5fbedc834157 100644 (file)
 
 #undef ctf_integer
 #define ctf_integer(_type, _item, _src)                                \
-       _ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10, 1)
+       _ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10, 0)
 
 #undef ctf_integer_hex
 #define ctf_integer_hex(_type, _item, _src)                    \
-       _ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 16, 1)
+       _ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 16, 0)
 
 #undef ctf_integer_network
 #define ctf_integer_network(_type, _item, _src)                        \
-       _ctf_integer_ext(_type, _item, _src, BIG_ENDIAN, 10, 1)
+       _ctf_integer_ext(_type, _item, _src, BIG_ENDIAN, 10, 0)
 
 #undef ctf_integer_network_hex
 #define ctf_integer_network_hex(_type, _item, _src)            \
-       _ctf_integer_ext(_type, _item, _src, BIG_ENDIAN, 16, 1)
+       _ctf_integer_ext(_type, _item, _src, BIG_ENDIAN, 16, 0)
 
 #undef ctf_float
 #define ctf_float(_type, _item, _src)                          \
-       _ctf_float(_type, _item, _src, 1)
+       _ctf_float(_type, _item, _src, 0)
 
 #undef ctf_array
 #define ctf_array(_type, _item, _src, _length)                 \
-       _ctf_array_encoded(_type, _item, _src, _length, none, 1)
+       _ctf_array_encoded(_type, _item, _src, _length, none, 0)
 
 #undef ctf_array_text
 #define ctf_array_text(_type, _item, _src, _length)            \
-       _ctf_array_encoded(_type, _item, _src, _length, UTF8, 1)
+       _ctf_array_encoded(_type, _item, _src, _length, UTF8, 0)
 
 #undef ctf_sequence
 #define ctf_sequence(_type, _item, _src, _length_type, _src_length) \
        _ctf_sequence_encoded(_type, _item, _src,               \
-                       _length_type, _src_length, none, 1)
+                       _length_type, _src_length, none, 0)
 
 #undef ctf_sequence_text
 #define ctf_sequence_text(_type, _item, _src, _length_type, _src_length) \
        _ctf_sequence_encoded(_type, _item, _src,               \
-                       _length_type, _src_length, UTF8, 1)
+                       _length_type, _src_length, UTF8, 0)
 
 #undef ctf_string
 #define ctf_string(_item, _src)                                        \
-       _ctf_string(_item, _src, 1)
+       _ctf_string(_item, _src, 0)
index 30414e8176c73c891b0b8a3994693447c5d10d91..aaba93eab1ec0c819256186790f212bbc72e4057 100644 (file)
@@ -109,23 +109,23 @@ static const char                                                 \
 #include <lttng/ust-tracepoint-event-nowrite.h>
 
 #undef _ctf_integer_ext
-#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _written)     \
+#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite)     \
        {                                                       \
          .name = #_item,                                       \
          .type = __type_integer(_type, _byte_order, _base, none),\
-         .written = _written,                                  \
+         .nowrite = _nowrite,                                  \
        },
 
 #undef _ctf_float
-#define _ctf_float(_type, _item, _src, _written)               \
+#define _ctf_float(_type, _item, _src, _nowrite)               \
        {                                                       \
          .name = #_item,                                       \
          .type = __type_float(_type),                          \
-         .written = _written,                                  \
+         .nowrite = _nowrite,                                  \
        },
 
 #undef _ctf_array_encoded
-#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _written) \
+#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _nowrite) \
        {                                                       \
          .name = #_item,                                       \
          .type =                                               \
@@ -137,12 +137,12 @@ static const char                                                 \
                            .elem_type = __type_integer(_type, BYTE_ORDER, 10, _encoding), \
                        },                                      \
                },                                              \
-         .written = _written,                                  \
+         .nowrite = _nowrite,                                  \
        },
 
 #undef _ctf_sequence_encoded
 #define _ctf_sequence_encoded(_type, _item, _src,      \
-                       _length_type, _src_length, _encoding, _written) \
+                       _length_type, _src_length, _encoding, _nowrite) \
        {                                                       \
          .name = #_item,                                       \
          .type =                                               \
@@ -154,11 +154,11 @@ static const char                                                 \
                            .elem_type = __type_integer(_type, BYTE_ORDER, 10, _encoding), \
                        },                                      \
                },                                              \
-         .written = _written,                                  \
+         .nowrite = _nowrite,                                  \
        },
 
 #undef _ctf_string
-#define _ctf_string(_item, _src, _written)                     \
+#define _ctf_string(_item, _src, _nowrite)                     \
        {                                                       \
          .name = #_item,                                       \
          .type =                                               \
@@ -166,7 +166,7 @@ static const char                                                   \
                  .atype = atype_string,                        \
                  .u.basic.string.encoding = lttng_encode_UTF8, \
                },                                              \
-         .written = _written,                                  \
+         .nowrite = _nowrite,                                  \
        },
 
 #undef TP_FIELDS
@@ -209,23 +209,23 @@ static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args));
 #include <lttng/ust-tracepoint-event-write.h>
 
 #undef _ctf_integer_ext
-#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _written)       \
+#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite)       \
        __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
        __event_len += sizeof(_type);
 
 #undef _ctf_float
-#define _ctf_float(_type, _item, _src, _written)                                \
+#define _ctf_float(_type, _item, _src, _nowrite)                                \
        __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
        __event_len += sizeof(_type);
 
 #undef _ctf_array_encoded
-#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _written)     \
+#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _nowrite)     \
        __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
        __event_len += sizeof(_type) * (_length);
 
 #undef _ctf_sequence_encoded
 #define _ctf_sequence_encoded(_type, _item, _src, _length_type,        \
-                       _src_length, _encoding, _written)       \
+                       _src_length, _encoding, _nowrite)       \
        __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_length_type));   \
        __event_len += sizeof(_length_type);                                   \
        __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
@@ -234,7 +234,7 @@ static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args));
        __dynamic_len_idx++;
 
 #undef _ctf_string
-#define _ctf_string(_item, _src, _written)                                    \
+#define _ctf_string(_item, _src, _nowrite)                                    \
        __event_len += __dynamic_len[__dynamic_len_idx++] = strlen(_src) + 1;
 
 #undef TP_ARGS
@@ -274,7 +274,7 @@ size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS
 #include <lttng/ust-tracepoint-event-nowrite.h>
 
 #undef _ctf_integer_ext
-#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _written)     \
+#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite)     \
        if (lttng_is_signed_type(_type)) {                                     \
                int64_t __ctf_tmp_int64 = (int64_t) (_type) (_src);            \
                memcpy(__stack_data, &__ctf_tmp_int64, sizeof(int64_t));       \
@@ -285,7 +285,7 @@ size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS
        __stack_data += sizeof(int64_t);
 
 #undef _ctf_float
-#define _ctf_float(_type, _item, _src, _written)                              \
+#define _ctf_float(_type, _item, _src, _nowrite)                              \
        {                                                                      \
                double __ctf_tmp_double = (double) (_type) (_src);             \
                memcpy(__stack_data, &__ctf_tmp_double, sizeof(double));       \
@@ -293,7 +293,7 @@ size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS
        }
 
 #undef _ctf_array_encoded
-#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _written)   \
+#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _nowrite)   \
        {                                                                      \
                unsigned long __ctf_tmp_ulong = (unsigned long) (_length);     \
                memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \
@@ -304,7 +304,7 @@ size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS
 
 #undef _ctf_sequence_encoded
 #define _ctf_sequence_encoded(_type, _item, _src, _length_type,                       \
-                       _src_length, _encoding, _written)                      \
+                       _src_length, _encoding, _nowrite)                      \
        {                                                                      \
                unsigned long __ctf_tmp_ulong = (unsigned long) (_src_length); \
                memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \
@@ -314,7 +314,7 @@ size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS
        }
 
 #undef _ctf_string
-#define _ctf_string(_item, _src, _written)                                    \
+#define _ctf_string(_item, _src, _nowrite)                                    \
        {                                                                      \
                memcpy(__stack_data, &(_src), sizeof(void **));                \
                __stack_data += sizeof(void **);                               \
@@ -350,25 +350,25 @@ void __event_prepare_filter_stack__##_provider##___##_name(char *__stack_data,\
 #include <lttng/ust-tracepoint-event-write.h>
 
 #undef _ctf_integer_ext
-#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _written)     \
+#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite)     \
        __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
 
 #undef _ctf_float
-#define _ctf_float(_type, _item, _src, _written)                              \
+#define _ctf_float(_type, _item, _src, _nowrite)                              \
        __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
 
 #undef _ctf_array_encoded
-#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _written)   \
+#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _nowrite)   \
        __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
 
 #undef _ctf_sequence_encoded
 #define _ctf_sequence_encoded(_type, _item, _src, _length_type,        \
-                       _src_length, _encoding, _written)       \
+                       _src_length, _encoding, _nowrite)       \
        __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_length_type));    \
        __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
 
 #undef _ctf_string
-#define _ctf_string(_item, _src, _written)
+#define _ctf_string(_item, _src, _nowrite)
 
 #undef TP_ARGS
 #define TP_ARGS(...) __VA_ARGS__
@@ -403,7 +403,7 @@ size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args))      \
 #include <lttng/ust-tracepoint-event-write.h>
 
 #undef _ctf_integer_ext
-#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _written) \
+#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
        {                                                               \
                _type __tmp = (_src);                                   \
                lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__tmp));\
@@ -411,7 +411,7 @@ size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args))      \
        }
 
 #undef _ctf_float
-#define _ctf_float(_type, _item, _src, _written)                       \
+#define _ctf_float(_type, _item, _src, _nowrite)                       \
        {                                                               \
                _type __tmp = (_src);                                   \
                lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__tmp));\
@@ -419,13 +419,13 @@ size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args))      \
        }
 
 #undef _ctf_array_encoded
-#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _written) \
+#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _nowrite) \
        lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type));        \
        __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length));
 
 #undef _ctf_sequence_encoded
 #define _ctf_sequence_encoded(_type, _item, _src, _length_type,                \
-                       _src_length, _encoding, _written)               \
+                       _src_length, _encoding, _nowrite)               \
        {                                                               \
                _length_type __tmpl = __stackvar.__dynamic_len[__dynamic_len_idx]; \
                lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\
@@ -436,7 +436,7 @@ size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args))      \
                sizeof(_type) * __get_dynamic_len(dest));
 
 #undef _ctf_string
-#define _ctf_string(_item, _src, _written)                             \
+#define _ctf_string(_item, _src, _nowrite)                             \
        lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(*(_src)));      \
        __chan->ops->event_write(&__ctx, _src, __get_dynamic_len(dest));
 
index fd70279afb8451d99ad3c5ddc7b6facea20f4b43..ab099e1aba89afedb6a9456c0768509277500a8c 100644 (file)
@@ -726,7 +726,7 @@ int _ltt_field_statedump(struct ltt_session *session,
 {
        int ret = 0;
 
-       if (!field->written)
+       if (field->nowrite)
                return 0;
 
        switch (field->type.atype) {
index 884a97409eb4cc53470addcebc590b2790d5e531..1e1407e680d37d0e48b16857fea18e7cd1a60582 100644 (file)
@@ -296,7 +296,7 @@ int ltt_probes_get_field_list(struct lttng_ust_field_list *list)
                                } else {
                                        list_entry->field.loglevel = *(*event_desc->loglevel);
                                }
-                               list_entry->field.written = event_field->written;
+                               list_entry->field.nowrite = event_field->nowrite;
                        }
                }
        }
This page took 0.036399 seconds and 4 git commands to generate.