From: Jérémie Galarneau Date: Fri, 29 Jul 2022 19:32:57 +0000 (-0400) Subject: dynamic-type: remove underscore prefix from mapping names X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=f63969cc383c919fdad975497d668605783c6c3a;p=lttng-ust.git dynamic-type: remove underscore prefix from mapping names Dynamic types are expressed by LTTng-UST as a variant + its tag. Currenly (v2.13 and older), the names of the variant's choices and the enumeration's entries do not match: enumeration entry names are prefixed with an underscore. This worked with older versions of LTTng-tools since all fields in the TSDL metadata were "escaped" by prepending an underscore, causing the variant choices to match the enumeration mapping names. Following a rewrite of the TSDL producer, that no longer systematically prepends an underscore, I noticed this discrepancy. Newer LTTng-tools versions using the v10 protocol will assume that a variant field's choices matches its tag's mapping names exactly, while a work-around for older supported versions (8 and 9) will strip the leading underscores from the enumeration mapping names when this specified combination is found. Note that the "oldest compatible" version remains unchanged as this change is not ABI breaking. There is one scenario where this fix can cause problem: running an older LTTng-tools (e.g. 2.13) linked against a recent LTTng-UST (2.14+). This configuration is _not_ supported and versions are properly checked at build time by LTTng-tools. In that problematic case, the older LTTng-tools would expect the enumeration mappings to be prefixed with an underscore and produce an invalid CTF trace. Signed-off-by: Jérémie Galarneau Signed-off-by: Mathieu Desnoyers Change-Id: Ia7e78096a9c31cd4c0574d599c961067d8f03791 --- diff --git a/include/lttng/ust-abi.h b/include/lttng/ust-abi.h index bc699a0c..1342ca16 100644 --- a/include/lttng/ust-abi.h +++ b/include/lttng/ust-abi.h @@ -19,7 +19,7 @@ #define LTTNG_UST_ABI_COMM_MAGIC 0xC57C57C5 /* Version for ABI between liblttng-ust, sessiond, consumerd */ -#define LTTNG_UST_ABI_MAJOR_VERSION 9 +#define LTTNG_UST_ABI_MAJOR_VERSION 10 #define LTTNG_UST_ABI_MAJOR_VERSION_OLDEST_COMPATIBLE 8 #define LTTNG_UST_ABI_MINOR_VERSION 0 diff --git a/src/common/dynamic-type.c b/src/common/dynamic-type.c index 9350265c..830894b8 100644 --- a/src/common/dynamic-type.c +++ b/src/common/dynamic-type.c @@ -32,18 +32,18 @@ }), static const struct lttng_ust_enum_entry *dt_enum[_NR_LTTNG_UST_DYNAMIC_TYPES] = { - [LTTNG_UST_DYNAMIC_TYPE_NONE] = lttng_ust_field_enum_value("_none", 0) - [LTTNG_UST_DYNAMIC_TYPE_S8] = lttng_ust_field_enum_value("_int8", 1) - [LTTNG_UST_DYNAMIC_TYPE_S16] = lttng_ust_field_enum_value("_int16", 2) - [LTTNG_UST_DYNAMIC_TYPE_S32] = lttng_ust_field_enum_value("_int32", 3) - [LTTNG_UST_DYNAMIC_TYPE_S64] = lttng_ust_field_enum_value("_int64", 4) - [LTTNG_UST_DYNAMIC_TYPE_U8] = lttng_ust_field_enum_value("_uint8", 5) - [LTTNG_UST_DYNAMIC_TYPE_U16] = lttng_ust_field_enum_value("_uint16", 6) - [LTTNG_UST_DYNAMIC_TYPE_U32] = lttng_ust_field_enum_value("_uint32", 7) - [LTTNG_UST_DYNAMIC_TYPE_U64] = lttng_ust_field_enum_value("_uint64", 8) - [LTTNG_UST_DYNAMIC_TYPE_FLOAT] = lttng_ust_field_enum_value("_float", 9) - [LTTNG_UST_DYNAMIC_TYPE_DOUBLE] = lttng_ust_field_enum_value("_double", 10) - [LTTNG_UST_DYNAMIC_TYPE_STRING] = lttng_ust_field_enum_value("_string", 11) + [LTTNG_UST_DYNAMIC_TYPE_NONE] = lttng_ust_field_enum_value("none", 0) + [LTTNG_UST_DYNAMIC_TYPE_S8] = lttng_ust_field_enum_value("int8", 1) + [LTTNG_UST_DYNAMIC_TYPE_S16] = lttng_ust_field_enum_value("int16", 2) + [LTTNG_UST_DYNAMIC_TYPE_S32] = lttng_ust_field_enum_value("int32", 3) + [LTTNG_UST_DYNAMIC_TYPE_S64] = lttng_ust_field_enum_value("int64", 4) + [LTTNG_UST_DYNAMIC_TYPE_U8] = lttng_ust_field_enum_value("uint8", 5) + [LTTNG_UST_DYNAMIC_TYPE_U16] = lttng_ust_field_enum_value("uint16", 6) + [LTTNG_UST_DYNAMIC_TYPE_U32] = lttng_ust_field_enum_value("uint32", 7) + [LTTNG_UST_DYNAMIC_TYPE_U64] = lttng_ust_field_enum_value("uint64", 8) + [LTTNG_UST_DYNAMIC_TYPE_FLOAT] = lttng_ust_field_enum_value("float", 9) + [LTTNG_UST_DYNAMIC_TYPE_DOUBLE] = lttng_ust_field_enum_value("double", 10) + [LTTNG_UST_DYNAMIC_TYPE_STRING] = lttng_ust_field_enum_value("string", 11) }; static struct lttng_ust_enum_desc dt_enum_desc = {