Add ctf_enum_auto() for autoincrementing enumeration values
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 4 Jul 2016 19:14:54 +0000 (15:14 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 4 Jul 2016 19:55:26 +0000 (15:55 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lttng-events.c
lttng-events.h
probes/lttng-tracepoint-event-impl.h

index bcf59da1df5d8916ae7e85c01f9e5a6639743d25..ef934374b7442845d6bcb4e3d7fb798742eb8eda 100644 (file)
@@ -1955,8 +1955,19 @@ int _lttng_enum_statedump(struct lttng_session *session,
                        if (ret)
                                goto end;
                }
+               ret = lttng_metadata_printf(session, "\"");
+               if (ret)
+                       goto end;
+
+               if (entry->options.is_auto) {
+                       ret = lttng_metadata_printf(session, ",\n");
+                       if (ret)
+                               goto end;
+                       continue;
+               }
+
                ret = lttng_metadata_printf(session,
-                               "\" = ");
+                               " = ");
                if (ret)
                        goto end;
                if (entry->start.signedness)
index 9e05e2f9a56b044c8c690fbbc2ac75a3889d2c58..42a7b24bbb35f103e771d8488cf11ffc6273f265 100644 (file)
@@ -77,6 +77,9 @@ struct lttng_enum_value {
 struct lttng_enum_entry {
        struct lttng_enum_value start, end;     /* start and end are inclusive */
        const char *string;
+       struct {
+               unsigned int is_auto:1;
+       } options;
 };
 
 #define __type_integer(_type, _size, _alignment, _signedness,  \
index ed7072cf19377973de61f38e12b0547a1bf13d36..e1c408298fea396ceda470dcc12f8a10a735654d 100644 (file)
@@ -222,6 +222,24 @@ void __event_template_proto___##_name(void);
                .string = (_string),                                    \
        },
 
+/* Enumeration entry (automatic value; follows the rules of CTF) */
+#undef ctf_enum_auto
+#define ctf_enum_auto(_string)                                 \
+       {                                                               \
+               .start = {                                              \
+                       .signedness = -1,                               \
+                       .value = -1,                                    \
+               },                                                      \
+               .end = {                                                \
+                       .signedness = -1,                               \
+                       .value = -1,                                    \
+               },                                                      \
+               .string = (_string),                                    \
+               .options = {                                            \
+                       .is_auto = 1,                                   \
+               }                                                       \
+       },
+
 #undef TP_ENUM_VALUES
 #define TP_ENUM_VALUES(...)                                            \
        __VA_ARGS__
This page took 0.028088 seconds and 4 git commands to generate.