From e85e37239d682b8127005c3f63f72999193214c1 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Mon, 4 Jul 2016 17:48:42 -0400 Subject: [PATCH] Add support for UST's autoincrementing enum entries MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/lttng-ust-abi.h | 2 +- src/bin/lttng-sessiond/lttng-ust-ctl.h | 7 +++- src/bin/lttng-sessiond/ust-metadata.c | 56 ++++++++++++++++---------- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/src/bin/lttng-sessiond/lttng-ust-abi.h b/src/bin/lttng-sessiond/lttng-ust-abi.h index 7bec0c961..0487320b8 100644 --- a/src/bin/lttng-sessiond/lttng-ust-abi.h +++ b/src/bin/lttng-sessiond/lttng-ust-abi.h @@ -44,7 +44,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 { diff --git a/src/bin/lttng-sessiond/lttng-ust-ctl.h b/src/bin/lttng-sessiond/lttng-ust-ctl.h index b8cf775e3..c0723d095 100644 --- a/src/bin/lttng-sessiond/lttng-ust-ctl.h +++ b/src/bin/lttng-sessiond/lttng-ust-ctl.h @@ -297,7 +297,12 @@ struct ustctl_enum_value { 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 { + uint8_t is_auto; + } LTTNG_PACKED options; + char padding[USTCTL_UST_ENUM_ENTRY_PADDING]; + } u; } LTTNG_PACKED; #define USTCTL_UST_BASIC_TYPE_PADDING 296 diff --git a/src/bin/lttng-sessiond/ust-metadata.c b/src/bin/lttng-sessiond/ust-metadata.c index c97013f43..328d6ea4c 100644 --- a/src/bin/lttng-sessiond/ust-metadata.c +++ b/src/bin/lttng-sessiond/ust-metadata.c @@ -300,38 +300,52 @@ int ust_metadata_enum_statedump(struct ust_registry_session *session, goto end; } } - ret = lttng_metadata_printf(session, - "\" = "); + ret = lttng_metadata_printf(session, "\""); if (ret) { goto end; } - if (entry->start.signedness) { - ret = lttng_metadata_printf(session, - "%lld", (long long) entry->start.value); + if (entry->u.options.is_auto) { + ret = lttng_metadata_printf(session, ",\n"); + if (ret) { + goto end; + } } else { ret = lttng_metadata_printf(session, - "%llu", entry->start.value); - } - if (ret) { - goto end; - } + " = "); + if (ret) { + goto end; + } - if (entry->start.signedness == entry->end.signedness && - entry->start.value == entry->end.value) { - ret = lttng_metadata_printf(session, - ",\n"); - } else { - if (entry->end.signedness) { + if (entry->start.signedness) { ret = lttng_metadata_printf(session, - " ... %lld,\n", (long long) entry->end.value); + "%lld", (long long) entry->start.value); } else { ret = lttng_metadata_printf(session, - " ... %llu,\n", entry->end.value); + "%llu", entry->start.value); + } + if (ret) { + goto end; + } + + if (entry->start.signedness == entry->end.signedness && + entry->start.value == + entry->end.value) { + ret = lttng_metadata_printf(session, ",\n"); + } else { + if (entry->end.signedness) { + ret = lttng_metadata_printf(session, + " ... %lld,\n", + (long long) entry->end.value); + } else { + ret = lttng_metadata_printf(session, + " ... %llu,\n", + entry->end.value); + } + } + if (ret) { + goto end; } - } - if (ret) { - goto end; } } nesting--; -- 2.34.1