-#define __type_float(_type) \
- { \
- .atype = atype_float, \
- .u = \
- { \
- ._float = \
- { \
- .exp_dig = sizeof(_type) * CHAR_BIT \
- - _float_mant_dig(_type), \
- .mant_dig = _float_mant_dig(_type), \
- .alignment = lttng_alignof(_type) * CHAR_BIT, \
- .reverse_byte_order = BYTE_ORDER != FLOAT_WORD_ORDER, \
- } \
- } \
- } \
-
-#define LTTNG_UST_FLOAT_TYPE_PADDING 24
-struct lttng_float_type {
- unsigned int exp_dig; /* exponent digits, in bits */
- unsigned int mant_dig; /* mantissa digits, in bits */
- unsigned short alignment; /* in bits */
- unsigned int reverse_byte_order:1;
- char padding[LTTNG_UST_FLOAT_TYPE_PADDING];
-};
-
-/* legacy */
-#define LTTNG_UST_BASIC_TYPE_PADDING 128
-union _lttng_basic_type {
- struct lttng_integer_type integer; /* legacy */
- struct {
- const struct lttng_enum_desc *desc; /* Enumeration mapping */
- struct lttng_integer_type container_type;
- } enumeration; /* legacy */
- struct {
- enum lttng_string_encodings encoding;
- } string; /* legacy */
- struct lttng_float_type _float; /* legacy */
- char padding[LTTNG_UST_BASIC_TYPE_PADDING];
-};
-
-/* legacy */
-struct lttng_basic_type {
- enum lttng_abstract_types atype;
- union {
- union _lttng_basic_type basic;
- } u;
-};
-
-#define LTTNG_UST_TYPE_PADDING 128
-struct lttng_type {
- enum lttng_abstract_types atype;
- union {
- /* provider ABI 2.0 */
- struct lttng_integer_type integer;
- struct lttng_float_type _float;
- struct {
- enum lttng_string_encodings encoding;
- } string;
- struct {
- const struct lttng_enum_desc *desc; /* Enumeration mapping */
- struct lttng_type *container_type;
- } enum_nestable;
- struct {
- const struct lttng_type *elem_type;
- unsigned int length; /* Num. elems. */
- unsigned int alignment;
- } array_nestable;
- struct {
- const char *length_name; /* Length field name. */
- const struct lttng_type *elem_type;
- unsigned int alignment; /* Alignment before elements. */
- } sequence_nestable;
- struct {
- unsigned int nr_fields;
- const struct lttng_event_field *fields; /* Array of fields. */
- unsigned int alignment;
- } struct_nestable;
-
- union {
- /* legacy provider ABI 1.0 */
- union _lttng_basic_type basic; /* legacy */
- struct {
- struct lttng_basic_type elem_type;
- unsigned int length; /* Num. elems. */
- } array; /* legacy */
- struct {
- struct lttng_basic_type length_type;
- struct lttng_basic_type elem_type;
- } sequence; /* legacy */
- struct {
- unsigned int nr_fields;
- struct lttng_event_field *fields; /* Array of fields. */
- } _struct; /* legacy */
- } legacy;
- char padding[LTTNG_UST_TYPE_PADDING];
- } u;
-};
-
-#define LTTNG_UST_ENUM_TYPE_PADDING 24
-struct lttng_enum_desc {
+#define lttng_ust_type_float_define(_type) \
+ ((struct lttng_ust_type_common *) LTTNG_UST_COMPOUND_LITERAL(struct lttng_ust_type_float, { \
+ .parent = { \
+ .type = lttng_ust_type_float, \
+ }, \
+ .struct_size = sizeof(struct lttng_ust_type_float), \
+ .exp_dig = sizeof(_type) * CHAR_BIT \
+ - lttng_ust_float_mant_dig(_type), \
+ .mant_dig = lttng_ust_float_mant_dig(_type), \
+ .alignment = lttng_ust_rb_alignof(_type) * CHAR_BIT, \
+ .reverse_byte_order = LTTNG_UST_BYTE_ORDER != LTTNG_UST_FLOAT_WORD_ORDER, \
+ }))
+
+
+struct lttng_ust_type_string {
+ struct lttng_ust_type_common parent;
+ uint32_t struct_size;
+ enum lttng_ust_string_encoding encoding;
+};
+
+struct lttng_ust_type_enum {
+ struct lttng_ust_type_common parent;
+ uint32_t struct_size;
+ const struct lttng_ust_enum_desc *desc; /* Enumeration mapping */
+ const struct lttng_ust_type_common *container_type;
+};
+
+/*
+ * The alignment field in structure, array, and sequence types is a
+ * minimum alignment requirement. The actual alignment of a type may be
+ * larger than this explicit alignment value if its nested types have a
+ * larger alignment.
+ */
+
+struct lttng_ust_type_array {
+ struct lttng_ust_type_common parent;
+ uint32_t struct_size;
+ const struct lttng_ust_type_common *elem_type;
+ unsigned int length; /* Num. elems. */
+ unsigned int alignment; /* Minimum alignment for this type. */
+ enum lttng_ust_string_encoding encoding;
+};
+
+struct lttng_ust_type_sequence {
+ struct lttng_ust_type_common parent;
+ uint32_t struct_size;
+ const char *length_name; /* Length field name. If NULL, use previous field. */
+ const struct lttng_ust_type_common *elem_type;
+ unsigned int alignment; /* Minimum alignment before elements. */
+ enum lttng_ust_string_encoding encoding;
+};
+
+struct lttng_ust_type_struct {
+ struct lttng_ust_type_common parent;
+ uint32_t struct_size;
+ unsigned int nr_fields;
+ const struct lttng_ust_event_field * const *fields; /* Array of pointers to fields. */
+ unsigned int alignment; /* Minimum alignment for this type. */
+};
+
+/*
+ * Enumeration 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.
+ *
+ * The field @struct_size should be used to determine the size of the
+ * structure. It should be queried before using additional fields added
+ * at the end of the structure.
+ */
+
+struct lttng_ust_enum_desc {
+ uint32_t struct_size;
+