Add ctf_enum_auto() for autoincrementing enumeration values
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 4 Jul 2016 21:04:42 +0000 (17:04 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 5 Jul 2016 20:27:27 +0000 (16:27 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng/ust-abi.h
include/lttng/ust-ctl.h
include/lttng/ust-events.h
include/lttng/ust-tracepoint-event.h
liblttng-ust-comm/lttng-ust-comm.c

index 379e02315ad687fa643a677f4c050f1a6deb960a..6e8f8d7be3691a7f8d5592ab84667011b498e946 100644 (file)
@@ -42,7 +42,7 @@
 #define LTTNG_UST_COMM_MAGIC                   0xC57C57C5
 
 /* Version for ABI between liblttng-ust, sessiond, consumerd */
-#define LTTNG_UST_ABI_MAJOR_VERSION            6
+#define LTTNG_UST_ABI_MAJOR_VERSION            7
 #define LTTNG_UST_ABI_MINOR_VERSION            1
 
 enum lttng_ust_instrumentation {
index 201782341443d070b2382a8db7f3745873d3e25c..7b750fd4438812f530357e3355d86a672215af5c 100644 (file)
@@ -330,11 +330,20 @@ struct ustctl_enum_value {
        char padding[USTCTL_UST_ENUM_VALUE_PADDING];
 } LTTNG_PACKED;
 
+enum ustctl_ust_enum_entry_options {
+       USTCTL_UST_ENUM_ENTRY_OPTION_IS_AUTO = 1U << 0,
+};
+
 #define USTCTL_UST_ENUM_ENTRY_PADDING  32
 struct ustctl_enum_entry {
        struct ustctl_enum_value start, end; /* start and end are inclusive */
        char string[LTTNG_UST_SYM_NAME_LEN];
-       char padding[USTCTL_UST_ENUM_ENTRY_PADDING];
+       union {
+               struct {
+                       uint32_t options;
+               } LTTNG_PACKED extra;
+               char padding[USTCTL_UST_ENUM_ENTRY_PADDING];
+       } u;
 } LTTNG_PACKED;
 
 #define USTCTL_UST_BASIC_TYPE_PADDING  296
index 5167ddee50a9de5f526c80545221dab32fbb3246..61acf7542305f84ada90af1f0e68ec4f5a9b6210 100644 (file)
@@ -106,11 +106,20 @@ struct lttng_enum_value {
        unsigned int signedness:1;
 };
 
+enum lttng_enum_entry_options {
+       LTTNG_ENUM_ENTRY_OPTION_IS_AUTO = 1U << 0,
+};
+
 #define LTTNG_UST_ENUM_ENTRY_PADDING   16
 struct lttng_enum_entry {
        struct lttng_enum_value start, end; /* start and end are inclusive */
        const char *string;
-       char padding[LTTNG_UST_ENUM_ENTRY_PADDING];
+       union {
+               struct {
+                       unsigned int options;
+               } LTTNG_PACKED extra;
+               char padding[LTTNG_UST_ENUM_ENTRY_PADDING];
+       } u;
 };
 
 #define __type_integer(_type, _byte_order, _base, _encoding)   \
index 2b703dc57ce2b5c522ccdb8faad5c208178d833a..0b4e5a262b537ea7de75b4502a83c7480a5c9d27 100644 (file)
@@ -161,6 +161,26 @@ static const char                                                  \
                .string = (_string),                                    \
        },
 
+/* Enumeration entry (automatic value; follows the rules of CTF) */
+#undef ctf_enum_auto
+#define ctf_enum_auto(_string)                                 \
+       {                                                               \
+               .start = {                                              \
+                       .value = -1ULL,                                 \
+                       .signedness = 0,                                \
+               },                                                      \
+               .end = {                                                \
+                       .value = -1ULL,                                 \
+                       .signedness = 0,                                \
+               },                                                      \
+               .string = (_string),                                    \
+               .u = {                                                  \
+                       .extra = {                                      \
+                               .options = LTTNG_ENUM_ENTRY_OPTION_IS_AUTO, \
+                       },                                              \
+               },                                                      \
+       },
+
 #undef TP_ENUM_VALUES
 #define TP_ENUM_VALUES(...)                                            \
        __VA_ARGS__
index 4e9de57bd0d48e20840b1c168a4e76309f94ad45..129ad8f259aaa3eea7fea766a567c207fd98797e 100644 (file)
@@ -1094,6 +1094,11 @@ int serialize_entries(struct ustctl_enum_entry **_entries,
                uentry->end.signedness = lentry->end.signedness;
                strncpy(uentry->string, lentry->string, LTTNG_UST_SYM_NAME_LEN);
                uentry->string[LTTNG_UST_SYM_NAME_LEN - 1] = '\0';
+
+               if (lentry->u.extra.options & LTTNG_ENUM_ENTRY_OPTION_IS_AUTO) {
+                       uentry->u.extra.options |=
+                               USTCTL_UST_ENUM_ENTRY_OPTION_IS_AUTO;
+               }
        }
        *_entries = entries;
        return 0;
This page took 0.027398 seconds and 4 git commands to generate.