From 1487a16a42ca7be6b85ef210644d9ac398d7c0dd Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Mon, 3 Apr 2017 17:48:51 -0400 Subject: [PATCH] Rename bt_ctf_type_id -> bt_ctf_field_type_id (and the enumerators) 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 --- .../babeltrace/ctf-ir/field-types-internal.h | 2 +- include/babeltrace/ctf-ir/field-types.h | 46 +-- include/babeltrace/ctf-ir/fields.h | 8 +- lib/ctf-ir/event-class.c | 12 +- lib/ctf-ir/event.c | 2 +- lib/ctf-ir/field-types.c | 278 +++++++++--------- lib/ctf-ir/fields.c | 224 +++++++------- lib/ctf-ir/resolve.c | 2 +- lib/ctf-ir/stream-class.c | 6 +- lib/ctf-ir/stream.c | 14 +- lib/ctf-ir/trace.c | 2 +- lib/ctf-ir/validation.c | 10 +- plugins/ctf/common/btr/btr.c | 44 +-- plugins/ctf/common/notif-iter/notif-iter.c | 20 +- plugins/debug-info/copy.c | 18 +- plugins/libctfcopytrace/clock-fields.c | 32 +- plugins/libctfcopytrace/ctfcopytrace.c | 4 +- plugins/text/print.c | 10 +- plugins/utils/trimmer/copy.c | 2 +- tests/lib/test_ctf_writer.c | 18 +- 20 files changed, 377 insertions(+), 377 deletions(-) diff --git a/include/babeltrace/ctf-ir/field-types-internal.h b/include/babeltrace/ctf-ir/field-types-internal.h index dcb5b12a..129446bd 100644 --- a/include/babeltrace/ctf-ir/field-types-internal.h +++ b/include/babeltrace/ctf-ir/field-types-internal.h @@ -42,7 +42,7 @@ typedef int (*type_serialize_func)(struct bt_ctf_field_type *, struct bt_ctf_field_type { struct bt_object base; - enum bt_ctf_type_id id; + enum bt_ctf_field_type_id id; unsigned int alignment; type_freeze_func freeze; type_serialize_func serialize; diff --git a/include/babeltrace/ctf-ir/field-types.h b/include/babeltrace/ctf-ir/field-types.h index b7e30545..74908cf1 100644 --- a/include/babeltrace/ctf-ir/field-types.h +++ b/include/babeltrace/ctf-ir/field-types.h @@ -97,49 +97,49 @@ The standard CTF field types are: CTF IR field which you can create from this field type - #BT_CTF_TYPE_ID_INTEGER + #BT_CTF_FIELD_TYPE_ID_INTEGER \ref ctfirintfieldtype \ref ctfirintfield - #BT_CTF_TYPE_ID_FLOAT + #BT_CTF_FIELD_TYPE_ID_FLOAT \ref ctfirfloatfieldtype \ref ctfirfloatfield - #BT_CTF_TYPE_ID_ENUM + #BT_CTF_FIELD_TYPE_ID_ENUM \ref ctfirenumfieldtype \ref ctfirenumfield - #BT_CTF_TYPE_ID_STRING + #BT_CTF_FIELD_TYPE_ID_STRING \ref ctfirstringfieldtype \ref ctfirstringfield - #BT_CTF_TYPE_ID_STRUCT + #BT_CTF_FIELD_TYPE_ID_STRUCT \ref ctfirstructfieldtype \ref ctfirstructfield - #BT_CTF_TYPE_ID_ARRAY + #BT_CTF_FIELD_TYPE_ID_ARRAY \ref ctfirarrayfieldtype \ref ctfirarrayfield - #BT_CTF_TYPE_ID_SEQUENCE + #BT_CTF_FIELD_TYPE_ID_SEQUENCE \ref ctfirseqfieldtype \ref ctfirseqfield - #BT_CTF_TYPE_ID_VARIANT + #BT_CTF_FIELD_TYPE_ID_VARIANT \ref ctfirvarfieldtype \ref ctfirvarfield Each field type has its own type ID (see -#bt_ctf_type_id). You get the type ID of a field type object +#bt_ctf_field_type_id). You get the type ID of a field type object with bt_ctf_field_type_get_type_id(). You can get a deep copy of a field type with bt_ctf_field_type_copy(). @@ -206,7 +206,7 @@ struct bt_ctf_field_type_enumeration_mapping_iterator; /* * Babeltrace 1.x enumerations that were also used in CTF writer's API. * They are left here for backward compatibility reasons, but - * enum bt_ctf_type_id and enum bt_ctf_string_encoding should be used + * enum bt_ctf_field_type_id and enum bt_ctf_string_encoding should be used * in new code. Both new enumerations are compatible with their legacy * counterpart. */ @@ -275,37 +275,37 @@ enum bt_ctf_scope { /** @brief Type ID of a @ft. */ -enum bt_ctf_type_id { +enum bt_ctf_field_type_id { /// Unknown, used for errors. - BT_CTF_TYPE_ID_UNKNOWN = CTF_TYPE_UNKNOWN, + BT_CTF_FIELD_TYPE_ID_UNKNOWN = CTF_TYPE_UNKNOWN, /// \ref ctfirintfieldtype - BT_CTF_TYPE_ID_INTEGER = CTF_TYPE_INTEGER, + BT_CTF_FIELD_TYPE_ID_INTEGER = CTF_TYPE_INTEGER, /// \ref ctfirfloatfieldtype - BT_CTF_TYPE_ID_FLOAT = CTF_TYPE_FLOAT, + BT_CTF_FIELD_TYPE_ID_FLOAT = CTF_TYPE_FLOAT, /// \ref ctfirenumfieldtype - BT_CTF_TYPE_ID_ENUM = CTF_TYPE_ENUM, + BT_CTF_FIELD_TYPE_ID_ENUM = CTF_TYPE_ENUM, /// \ref ctfirstringfieldtype - BT_CTF_TYPE_ID_STRING = CTF_TYPE_STRING, + BT_CTF_FIELD_TYPE_ID_STRING = CTF_TYPE_STRING, /// \ref ctfirstructfieldtype - BT_CTF_TYPE_ID_STRUCT = CTF_TYPE_STRUCT, + BT_CTF_FIELD_TYPE_ID_STRUCT = CTF_TYPE_STRUCT, /// @cond DOCUMENT BT_CTF_TYPE_ID_UNTAGGED_VARIANT = CTF_TYPE_UNTAGGED_VARIANT, /// @endcond /// \ref ctfirarrayfieldtype - BT_CTF_TYPE_ID_ARRAY = CTF_TYPE_ARRAY, + BT_CTF_FIELD_TYPE_ID_ARRAY = CTF_TYPE_ARRAY, /// \ref ctfirseqfieldtype - BT_CTF_TYPE_ID_SEQUENCE = CTF_TYPE_SEQUENCE, + BT_CTF_FIELD_TYPE_ID_SEQUENCE = CTF_TYPE_SEQUENCE, /// \ref ctfirvarfieldtype - BT_CTF_TYPE_ID_VARIANT = CTF_TYPE_VARIANT, + BT_CTF_FIELD_TYPE_ID_VARIANT = CTF_TYPE_VARIANT, /// Number of enumeration entries. BT_CTF_NR_TYPE_IDS = NR_CTF_TYPES, @@ -316,12 +316,12 @@ enum bt_ctf_type_id { @param[in] field_type Field type of which to get the type ID. @returns Type ID of \p field_type, - or #BT_CTF_TYPE_ID_UNKNOWN on error. + or #BT_CTF_FIELD_TYPE_ID_UNKNOWN on error. @prenotnull{field_type} @postrefcountsame{field_type} -@sa #bt_ctf_type_id: CTF IR field type ID. +@sa #bt_ctf_field_type_id: CTF IR field type ID. @sa bt_ctf_field_type_is_integer(): Returns whether or not a given field type is a @intft. @sa bt_ctf_field_type_is_floating_point(): Returns whether or not a @@ -339,7 +339,7 @@ enum bt_ctf_type_id { @sa bt_ctf_field_type_is_variant(): Returns whether or not a given field type is a @varft. */ -extern enum bt_ctf_type_id bt_ctf_field_type_get_type_id( +extern enum bt_ctf_field_type_id bt_ctf_field_type_get_type_id( struct bt_ctf_field_type *field_type); /** diff --git a/include/babeltrace/ctf-ir/fields.h b/include/babeltrace/ctf-ir/fields.h index 5120d9e4..8578b518 100644 --- a/include/babeltrace/ctf-ir/fields.h +++ b/include/babeltrace/ctf-ir/fields.h @@ -93,7 +93,7 @@ name within a @structfield with bt_ctf_field_structure_set_field(). You can get a reference to the @ft which was used to create a field with bt_ctf_field_get_type(). You can get the -\link #bt_ctf_type_id type ID\endlink of this field type directly with +\link #bt_ctf_field_type_id type ID\endlink of this field type directly with bt_ctf_field_get_type_id(). You can get a deep copy of a field with bt_ctf_field_copy(). The field @@ -187,12 +187,12 @@ extern struct bt_ctf_field_type *bt_ctf_field_get_type( @param[in] field Field of which to get the type ID of its parent field type.. @returns Type ID of the parent field type of \p field, - or #BT_CTF_TYPE_ID_UNKNOWN on error. + or #BT_CTF_FIELD_TYPE_ID_UNKNOWN on error. @prenotnull{field} @postrefcountsame{field} -@sa #bt_ctf_type_id: CTF IR field type ID. +@sa #bt_ctf_field_type_id: CTF IR field type ID. @sa bt_ctf_field_is_integer(): Returns whether or not a given field is a @intfield. @sa bt_ctf_field_is_floating_point(): Returns whether or not a given @@ -210,7 +210,7 @@ extern struct bt_ctf_field_type *bt_ctf_field_get_type( @sa bt_ctf_field_is_variant(): Returns whether or not a given field is a @varfield. */ -extern enum bt_ctf_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field); +extern enum bt_ctf_field_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field); /* * bt_ctf_field_signed_integer_get_value: get a signed integer field's value diff --git a/lib/ctf-ir/event-class.c b/lib/ctf-ir/event-class.c index 36444873..6764d438 100644 --- a/lib/ctf-ir/event-class.c +++ b/lib/ctf-ir/event-class.c @@ -365,7 +365,7 @@ int bt_ctf_event_class_set_payload_type(struct bt_ctf_event_class *event_class, } if (payload && bt_ctf_field_type_get_type_id(payload) != - BT_CTF_TYPE_ID_STRUCT) { + BT_CTF_FIELD_TYPE_ID_STRUCT) { ret = -1; goto end; } @@ -389,7 +389,7 @@ int bt_ctf_event_class_add_field(struct bt_ctf_event_class *event_class, } if (bt_ctf_field_type_get_type_id(event_class->fields) != - BT_CTF_TYPE_ID_STRUCT) { + BT_CTF_FIELD_TYPE_ID_STRUCT) { ret = -1; goto end; } @@ -411,7 +411,7 @@ int bt_ctf_event_class_get_field_count( } if (bt_ctf_field_type_get_type_id(event_class->fields) != - BT_CTF_TYPE_ID_STRUCT) { + BT_CTF_FIELD_TYPE_ID_STRUCT) { ret = -1; goto end; } @@ -433,7 +433,7 @@ int bt_ctf_event_class_get_field(struct bt_ctf_event_class *event_class, } if (bt_ctf_field_type_get_type_id(event_class->fields) != - BT_CTF_TYPE_ID_STRUCT) { + BT_CTF_FIELD_TYPE_ID_STRUCT) { ret = -1; goto end; } @@ -455,7 +455,7 @@ struct bt_ctf_field_type *bt_ctf_event_class_get_field_by_name( } if (bt_ctf_field_type_get_type_id(event_class->fields) != - BT_CTF_TYPE_ID_STRUCT) { + BT_CTF_FIELD_TYPE_ID_STRUCT) { goto end; } @@ -501,7 +501,7 @@ int bt_ctf_event_class_set_context_type( } if (context && bt_ctf_field_type_get_type_id(context) != - BT_CTF_TYPE_ID_STRUCT) { + BT_CTF_FIELD_TYPE_ID_STRUCT) { ret = -1; goto end; } diff --git a/lib/ctf-ir/event.c b/lib/ctf-ir/event.c index 80044dd9..6d878fd7 100644 --- a/lib/ctf-ir/event.c +++ b/lib/ctf-ir/event.c @@ -348,7 +348,7 @@ int bt_ctf_event_set_payload_field(struct bt_ctf_event *event, } if (bt_ctf_field_type_get_type_id(payload_type) != - BT_CTF_TYPE_ID_STRUCT) { + BT_CTF_FIELD_TYPE_ID_STRUCT) { ret = -1; goto end; } diff --git a/lib/ctf-ir/field-types.c b/lib/ctf-ir/field-types.c index aac43002..6b02d4e3 100644 --- a/lib/ctf-ir/field-types.c +++ b/lib/ctf-ir/field-types.c @@ -76,16 +76,16 @@ void bt_ctf_field_type_string_destroy(struct bt_ctf_field_type *); static void (* const type_destroy_funcs[])(struct bt_ctf_field_type *) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_destroy, - [BT_CTF_TYPE_ID_ENUM] = + [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_destroy, + [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_destroy, - [BT_CTF_TYPE_ID_FLOAT] = + [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_type_floating_point_destroy, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_destroy, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_destroy, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_type_array_destroy, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_destroy, - [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_type_string_destroy, + [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_destroy, + [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_destroy, + [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_type_array_destroy, + [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_destroy, + [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_type_string_destroy, }; static @@ -105,14 +105,14 @@ void bt_ctf_field_type_sequence_freeze(struct bt_ctf_field_type *); static type_freeze_func const type_freeze_funcs[] = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_freeze, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_freeze, - [BT_CTF_TYPE_ID_FLOAT] = generic_field_type_freeze, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_freeze, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_freeze, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_type_array_freeze, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_freeze, - [BT_CTF_TYPE_ID_STRING] = generic_field_type_freeze, + [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_freeze, + [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_freeze, + [BT_CTF_FIELD_TYPE_ID_FLOAT] = generic_field_type_freeze, + [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_freeze, + [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_freeze, + [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_type_array_freeze, + [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_freeze, + [BT_CTF_FIELD_TYPE_ID_STRING] = generic_field_type_freeze, }; static @@ -142,17 +142,17 @@ int bt_ctf_field_type_string_serialize(struct bt_ctf_field_type *, static type_serialize_func const type_serialize_funcs[] = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_serialize, - [BT_CTF_TYPE_ID_ENUM] = + [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_serialize, + [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_serialize, - [BT_CTF_TYPE_ID_FLOAT] = + [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_type_floating_point_serialize, - [BT_CTF_TYPE_ID_STRUCT] = + [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_serialize, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_serialize, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_type_array_serialize, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_serialize, - [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_type_string_serialize, + [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_serialize, + [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_type_array_serialize, + [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_serialize, + [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_type_string_serialize, }; static @@ -180,17 +180,17 @@ void bt_ctf_field_type_sequence_set_byte_order(struct bt_ctf_field_type *, static void (* const set_byte_order_funcs[])(struct bt_ctf_field_type *, enum bt_ctf_byte_order) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_set_byte_order, - [BT_CTF_TYPE_ID_ENUM] = + [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_set_byte_order, + [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_set_byte_order, - [BT_CTF_TYPE_ID_FLOAT] = + [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_type_floating_point_set_byte_order, - [BT_CTF_TYPE_ID_STRUCT] = + [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_set_byte_order, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_set_byte_order, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_type_array_set_byte_order, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_set_byte_order, - [BT_CTF_TYPE_ID_STRING] = NULL, + [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_set_byte_order, + [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_type_array_set_byte_order, + [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_set_byte_order, + [BT_CTF_FIELD_TYPE_ID_STRING] = NULL, }; static @@ -221,14 +221,14 @@ struct bt_ctf_field_type *bt_ctf_field_type_string_copy( static struct bt_ctf_field_type *(* const type_copy_funcs[])( struct bt_ctf_field_type *) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_copy, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_copy, - [BT_CTF_TYPE_ID_FLOAT] = bt_ctf_field_type_floating_point_copy, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_copy, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_copy, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_type_array_copy, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_copy, - [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_type_string_copy, + [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_copy, + [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_copy, + [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_type_floating_point_copy, + [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_copy, + [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_copy, + [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_type_array_copy, + [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_copy, + [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_type_string_copy, }; static @@ -259,14 +259,14 @@ int bt_ctf_field_type_sequence_compare(struct bt_ctf_field_type *, static int (* const type_compare_funcs[])(struct bt_ctf_field_type *, struct bt_ctf_field_type *) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_compare, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_compare, - [BT_CTF_TYPE_ID_FLOAT] = bt_ctf_field_type_floating_point_compare, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_compare, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_compare, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_type_array_compare, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_compare, - [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_type_string_compare, + [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_compare, + [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_compare, + [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_type_floating_point_compare, + [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_compare, + [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_compare, + [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_type_array_compare, + [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_compare, + [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_type_string_compare, }; static @@ -284,14 +284,14 @@ int bt_ctf_field_type_sequence_validate(struct bt_ctf_field_type *); static int (* const type_validate_funcs[])(struct bt_ctf_field_type *) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_validate, - [BT_CTF_TYPE_ID_FLOAT] = NULL, - [BT_CTF_TYPE_ID_STRING] = NULL, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_validate, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_validate, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_validate, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_type_array_validate, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_validate, + [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_validate, + [BT_CTF_FIELD_TYPE_ID_FLOAT] = NULL, + [BT_CTF_FIELD_TYPE_ID_STRING] = NULL, + [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_validate, + [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_validate, + [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_validate, + [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_type_array_validate, + [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_validate, }; static @@ -358,7 +358,7 @@ gint compare_enumeration_mappings_unsigned(struct enumeration_mapping **a, static void bt_ctf_field_type_init(struct bt_ctf_field_type *type, bool init_bo) { - assert(type && (type->id > BT_CTF_TYPE_ID_UNKNOWN) && + assert(type && (type->id > BT_CTF_FIELD_TYPE_ID_UNKNOWN) && (type->id < BT_CTF_NR_TYPE_IDS)); bt_object_init(type, bt_ctf_field_type_destroy); @@ -412,11 +412,11 @@ static void bt_ctf_field_type_destroy(struct bt_object *obj) { struct bt_ctf_field_type *type; - enum bt_ctf_type_id type_id; + enum bt_ctf_field_type_id type_id; type = container_of(obj, struct bt_ctf_field_type, base); type_id = type->id; - if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || + if (type_id <= BT_CTF_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { return; } @@ -750,7 +750,7 @@ BT_HIDDEN int bt_ctf_field_type_validate(struct bt_ctf_field_type *type) { int ret = 0; - enum bt_ctf_type_id id = bt_ctf_field_type_get_type_id(type); + enum bt_ctf_field_type_id id = bt_ctf_field_type_get_type_id(type); if (!type) { ret = -1; @@ -784,7 +784,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_integer_create(unsigned int size) return NULL; } - integer->parent.id = BT_CTF_TYPE_ID_INTEGER; + integer->parent.id = BT_CTF_FIELD_TYPE_ID_INTEGER; integer->size = size; integer->base = BT_CTF_INTEGER_BASE_DECIMAL; integer->encoding = BT_CTF_STRING_ENCODING_NONE; @@ -797,7 +797,7 @@ int bt_ctf_field_type_integer_get_size(struct bt_ctf_field_type *type) int ret = 0; struct bt_ctf_field_type_integer *integer; - if (!type || type->id != BT_CTF_TYPE_ID_INTEGER) { + if (!type || type->id != BT_CTF_FIELD_TYPE_ID_INTEGER) { ret = -1; goto end; } @@ -813,7 +813,7 @@ int bt_ctf_field_type_integer_get_signed(struct bt_ctf_field_type *type) int ret = 0; struct bt_ctf_field_type_integer *integer; - if (!type || type->id != BT_CTF_TYPE_ID_INTEGER) { + if (!type || type->id != BT_CTF_FIELD_TYPE_ID_INTEGER) { ret = -1; goto end; } @@ -831,7 +831,7 @@ int bt_ctf_field_type_integer_set_signed(struct bt_ctf_field_type *type, struct bt_ctf_field_type_integer *integer; if (!type || type->frozen || - type->id != BT_CTF_TYPE_ID_INTEGER) { + type->id != BT_CTF_FIELD_TYPE_ID_INTEGER) { ret = -1; goto end; } @@ -849,7 +849,7 @@ int bt_ctf_field_type_integer_set_size(struct bt_ctf_field_type *type, struct bt_ctf_field_type_integer *integer; if (!type || type->frozen || - type->id != BT_CTF_TYPE_ID_INTEGER || + type->id != BT_CTF_FIELD_TYPE_ID_INTEGER || !size || size > 64) { ret = -1; goto end; @@ -867,7 +867,7 @@ enum bt_ctf_integer_base bt_ctf_field_type_integer_get_base( enum bt_ctf_integer_base ret = BT_CTF_INTEGER_BASE_UNKNOWN; struct bt_ctf_field_type_integer *integer; - if (!type || type->id != BT_CTF_TYPE_ID_INTEGER) { + if (!type || type->id != BT_CTF_FIELD_TYPE_ID_INTEGER) { goto end; } @@ -883,7 +883,7 @@ int bt_ctf_field_type_integer_set_base(struct bt_ctf_field_type *type, int ret = 0; if (!type || type->frozen || - type->id != BT_CTF_TYPE_ID_INTEGER) { + type->id != BT_CTF_FIELD_TYPE_ID_INTEGER) { ret = -1; goto end; } @@ -912,7 +912,7 @@ enum bt_ctf_string_encoding bt_ctf_field_type_integer_get_encoding( enum bt_ctf_string_encoding ret = BT_CTF_STRING_ENCODING_UNKNOWN; struct bt_ctf_field_type_integer *integer; - if (!type || type->id != BT_CTF_TYPE_ID_INTEGER) { + if (!type || type->id != BT_CTF_FIELD_TYPE_ID_INTEGER) { goto end; } @@ -929,7 +929,7 @@ int bt_ctf_field_type_integer_set_encoding(struct bt_ctf_field_type *type, struct bt_ctf_field_type_integer *integer; if (!type || type->frozen || - (type->id != BT_CTF_TYPE_ID_INTEGER) || + (type->id != BT_CTF_FIELD_TYPE_ID_INTEGER) || (encoding < BT_CTF_STRING_ENCODING_NONE) || (encoding >= BT_CTF_STRING_ENCODING_UNKNOWN)) { ret = -1; @@ -999,7 +999,7 @@ bt_ctf_field_type_enumeration_find_mappings_type( struct bt_ctf_field_type_enumeration *enumeration_type; struct bt_ctf_field_type_enumeration_mapping_iterator *iter = NULL; - if (!type || (type->id != BT_CTF_TYPE_ID_ENUM)) { + if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_ENUM)) { goto end; } @@ -1278,7 +1278,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_enumeration_create( goto error; } - if (integer_container_type->id != BT_CTF_TYPE_ID_INTEGER) { + if (integer_container_type->id != BT_CTF_FIELD_TYPE_ID_INTEGER) { goto error; } @@ -1287,7 +1287,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_enumeration_create( goto error; } - enumeration->parent.id = BT_CTF_TYPE_ID_ENUM; + enumeration->parent.id = BT_CTF_FIELD_TYPE_ID_ENUM; bt_get(integer_container_type); enumeration->container = integer_container_type; enumeration->entries = g_ptr_array_new_with_free_func( @@ -1309,7 +1309,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_enumeration_get_container_type( goto end; } - if (type->id != BT_CTF_TYPE_ID_ENUM) { + if (type->id != BT_CTF_FIELD_TYPE_ID_ENUM) { goto end; } @@ -1331,7 +1331,7 @@ int bt_ctf_field_type_enumeration_add_mapping( struct bt_ctf_field_type_enumeration *enumeration; char *escaped_string; - if (!type || (type->id != BT_CTF_TYPE_ID_ENUM) || + if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_ENUM) || type->frozen || (range_end < range_start)) { ret = -1; @@ -1381,7 +1381,7 @@ int bt_ctf_field_type_enumeration_add_mapping_unsigned( struct bt_ctf_field_type_enumeration *enumeration; char *escaped_string; - if (!type || (type->id != BT_CTF_TYPE_ID_ENUM) || + if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_ENUM) || type->frozen || (range_end < range_start)) { ret = -1; @@ -1427,7 +1427,7 @@ int bt_ctf_field_type_enumeration_get_mapping_count( int ret = 0; struct bt_ctf_field_type_enumeration *enumeration; - if (!type || (type->id != BT_CTF_TYPE_ID_ENUM)) { + if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_ENUM)) { ret = -1; goto end; } @@ -1448,7 +1448,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_floating_point_create(void) goto end; } - floating_point->parent.id = BT_CTF_TYPE_ID_FLOAT; + floating_point->parent.id = BT_CTF_FIELD_TYPE_ID_FLOAT; floating_point->exp_dig = sizeof(float) * CHAR_BIT - FLT_MANT_DIG; floating_point->mant_dig = FLT_MANT_DIG; bt_ctf_field_type_init(&floating_point->parent, TRUE); @@ -1462,7 +1462,7 @@ int bt_ctf_field_type_floating_point_get_exponent_digits( int ret = 0; struct bt_ctf_field_type_floating_point *floating_point; - if (!type || (type->id != BT_CTF_TYPE_ID_FLOAT)) { + if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_FLOAT)) { ret = -1; goto end; } @@ -1482,7 +1482,7 @@ int bt_ctf_field_type_floating_point_set_exponent_digits( struct bt_ctf_field_type_floating_point *floating_point; if (!type || type->frozen || - (type->id != BT_CTF_TYPE_ID_FLOAT)) { + (type->id != BT_CTF_FIELD_TYPE_ID_FLOAT)) { ret = -1; goto end; } @@ -1508,7 +1508,7 @@ int bt_ctf_field_type_floating_point_get_mantissa_digits( int ret = 0; struct bt_ctf_field_type_floating_point *floating_point; - if (!type || (type->id != BT_CTF_TYPE_ID_FLOAT)) { + if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_FLOAT)) { ret = -1; goto end; } @@ -1528,7 +1528,7 @@ int bt_ctf_field_type_floating_point_set_mantissa_digits( struct bt_ctf_field_type_floating_point *floating_point; if (!type || type->frozen || - (type->id != BT_CTF_TYPE_ID_FLOAT)) { + (type->id != BT_CTF_FIELD_TYPE_ID_FLOAT)) { ret = -1; goto end; } @@ -1557,7 +1557,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_structure_create(void) goto error; } - structure->parent.id = BT_CTF_TYPE_ID_STRUCT; + structure->parent.id = BT_CTF_FIELD_TYPE_ID_STRUCT; structure->fields = g_ptr_array_new_with_free_func( (GDestroyNotify)destroy_structure_field); structure->field_name_to_index = g_hash_table_new(NULL, NULL); @@ -1580,7 +1580,7 @@ int bt_ctf_field_type_structure_add_field(struct bt_ctf_field_type *type, */ if (!type || !field_type || type->frozen || bt_ctf_validate_identifier(field_name) || - (type->id != BT_CTF_TYPE_ID_STRUCT) || + (type->id != BT_CTF_FIELD_TYPE_ID_STRUCT) || type == field_type) { ret = -1; goto end; @@ -1603,7 +1603,7 @@ int bt_ctf_field_type_structure_get_field_count( int ret = 0; struct bt_ctf_field_type_structure *structure; - if (!type || (type->id != BT_CTF_TYPE_ID_STRUCT)) { + if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_STRUCT)) { ret = -1; goto end; } @@ -1624,7 +1624,7 @@ int bt_ctf_field_type_structure_get_field(struct bt_ctf_field_type *type, int ret = 0; if (!type || index < 0 || - (type->id != BT_CTF_TYPE_ID_STRUCT)) { + (type->id != BT_CTF_FIELD_TYPE_ID_STRUCT)) { ret = -1; goto end; } @@ -1695,7 +1695,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_variant_create( goto error; } - variant->parent.id = BT_CTF_TYPE_ID_VARIANT; + variant->parent.id = BT_CTF_FIELD_TYPE_ID_VARIANT; variant->tag_name = g_string_new(tag_name); variant->field_name_to_index = g_hash_table_new(NULL, NULL); variant->fields = g_ptr_array_new_with_free_func( @@ -1720,7 +1720,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_variant_get_tag_type( struct bt_ctf_field_type_variant *variant; struct bt_ctf_field_type *tag_type = NULL; - if (!type || (type->id != BT_CTF_TYPE_ID_VARIANT)) { + if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_VARIANT)) { goto end; } @@ -1741,7 +1741,7 @@ const char *bt_ctf_field_type_variant_get_tag_name( struct bt_ctf_field_type_variant *variant; const char *tag_name = NULL; - if (!type || (type->id != BT_CTF_TYPE_ID_VARIANT)) { + if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_VARIANT)) { goto end; } @@ -1762,7 +1762,7 @@ int bt_ctf_field_type_variant_set_tag_name( struct bt_ctf_field_type_variant *variant; if (!type || type->frozen || - (type->id != BT_CTF_TYPE_ID_VARIANT) || + (type->id != BT_CTF_FIELD_TYPE_ID_VARIANT) || bt_ctf_validate_identifier(name)) { ret = -1; goto end; @@ -1789,7 +1789,7 @@ int bt_ctf_field_type_variant_add_field(struct bt_ctf_field_type *type, */ if (!type || !field_type || type->frozen || bt_ctf_validate_identifier(field_name) || - (type->id != BT_CTF_TYPE_ID_VARIANT) || + (type->id != BT_CTF_FIELD_TYPE_ID_VARIANT) || type == field_type) { ret = -1; goto end; @@ -1869,7 +1869,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_from_tag( struct bt_ctf_field_type *field_type = NULL; struct bt_ctf_field_type_enumeration_mapping_iterator *iter = NULL; - if (!type || !tag || type->id != BT_CTF_TYPE_ID_VARIANT) { + if (!type || !tag || type->id != BT_CTF_FIELD_TYPE_ID_VARIANT) { goto end; } @@ -1896,7 +1896,7 @@ int bt_ctf_field_type_variant_get_field_count(struct bt_ctf_field_type *type) int ret = 0; struct bt_ctf_field_type_variant *variant; - if (!type || (type->id != BT_CTF_TYPE_ID_VARIANT)) { + if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_VARIANT)) { ret = -1; goto end; } @@ -1918,7 +1918,7 @@ int bt_ctf_field_type_variant_get_field(struct bt_ctf_field_type *type, int ret = 0; if (!type || index < 0 || - (type->id != BT_CTF_TYPE_ID_VARIANT)) { + (type->id != BT_CTF_FIELD_TYPE_ID_VARIANT)) { ret = -1; goto end; } @@ -1957,7 +1957,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_array_create( goto error; } - array->parent.id = BT_CTF_TYPE_ID_ARRAY; + array->parent.id = BT_CTF_FIELD_TYPE_ID_ARRAY; bt_get(element_type); array->element_type = element_type; array->length = length; @@ -1973,7 +1973,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_array_get_element_type( struct bt_ctf_field_type *ret = NULL; struct bt_ctf_field_type_array *array; - if (!type || (type->id != BT_CTF_TYPE_ID_ARRAY)) { + if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_ARRAY)) { goto end; } @@ -1992,7 +1992,7 @@ int bt_ctf_field_type_array_set_element_type(struct bt_ctf_field_type *type, struct bt_ctf_field_type_array *array; if (!type || !element_type || - (type->id != BT_CTF_TYPE_ID_ARRAY)) { + (type->id != BT_CTF_FIELD_TYPE_ID_ARRAY)) { ret = -1; goto end; } @@ -2015,7 +2015,7 @@ int64_t bt_ctf_field_type_array_get_length(struct bt_ctf_field_type *type) int64_t ret; struct bt_ctf_field_type_array *array; - if (!type || (type->id != BT_CTF_TYPE_ID_ARRAY)) { + if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_ARRAY)) { ret = -1; goto end; } @@ -2041,7 +2041,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_sequence_create( goto error; } - sequence->parent.id = BT_CTF_TYPE_ID_SEQUENCE; + sequence->parent.id = BT_CTF_FIELD_TYPE_ID_SEQUENCE; bt_get(element_type); sequence->element_type = element_type; sequence->length_field_name = g_string_new(length_field_name); @@ -2057,7 +2057,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_sequence_get_element_type( struct bt_ctf_field_type *ret = NULL; struct bt_ctf_field_type_sequence *sequence; - if (!type || (type->id != BT_CTF_TYPE_ID_SEQUENCE)) { + if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_SEQUENCE)) { goto end; } @@ -2077,7 +2077,7 @@ int bt_ctf_field_type_sequence_set_element_type(struct bt_ctf_field_type *type, struct bt_ctf_field_type_sequence *sequence; if (!type || !element_type || - (type->id != BT_CTF_TYPE_ID_SEQUENCE)) { + (type->id != BT_CTF_FIELD_TYPE_ID_SEQUENCE)) { ret = -1; goto end; } @@ -2101,7 +2101,7 @@ const char *bt_ctf_field_type_sequence_get_length_field_name( const char *ret = NULL; struct bt_ctf_field_type_sequence *sequence; - if (!type || (type->id != BT_CTF_TYPE_ID_SEQUENCE)) { + if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_SEQUENCE)) { goto end; } @@ -2121,7 +2121,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_string_create(void) return NULL; } - string->parent.id = BT_CTF_TYPE_ID_STRING; + string->parent.id = BT_CTF_FIELD_TYPE_ID_STRING; bt_ctf_field_type_init(&string->parent, TRUE); string->encoding = BT_CTF_STRING_ENCODING_UTF8; string->parent.alignment = CHAR_BIT; @@ -2134,7 +2134,7 @@ enum bt_ctf_string_encoding bt_ctf_field_type_string_get_encoding( struct bt_ctf_field_type_string *string; enum bt_ctf_string_encoding ret = BT_CTF_STRING_ENCODING_UNKNOWN; - if (!type || (type->id != BT_CTF_TYPE_ID_STRING)) { + if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_STRING)) { goto end; } @@ -2151,7 +2151,7 @@ int bt_ctf_field_type_string_set_encoding(struct bt_ctf_field_type *type, int ret = 0; struct bt_ctf_field_type_string *string; - if (!type || type->id != BT_CTF_TYPE_ID_STRING || + if (!type || type->id != BT_CTF_FIELD_TYPE_ID_STRING || (encoding != BT_CTF_STRING_ENCODING_UTF8 && encoding != BT_CTF_STRING_ENCODING_ASCII)) { ret = -1; @@ -2167,7 +2167,7 @@ end: int bt_ctf_field_type_get_alignment(struct bt_ctf_field_type *type) { int ret; - enum bt_ctf_type_id type_id; + enum bt_ctf_field_type_id type_id; if (!type) { ret = -1; @@ -2181,7 +2181,7 @@ int bt_ctf_field_type_get_alignment(struct bt_ctf_field_type *type) type_id = bt_ctf_field_type_get_type_id(type); switch (type_id) { - case BT_CTF_TYPE_ID_SEQUENCE: + case BT_CTF_FIELD_TYPE_ID_SEQUENCE: { struct bt_ctf_field_type *element = bt_ctf_field_type_sequence_get_element_type(type); @@ -2195,7 +2195,7 @@ int bt_ctf_field_type_get_alignment(struct bt_ctf_field_type *type) bt_put(element); break; } - case BT_CTF_TYPE_ID_ARRAY: + case BT_CTF_FIELD_TYPE_ID_ARRAY: { struct bt_ctf_field_type *element = bt_ctf_field_type_array_get_element_type(type); @@ -2209,7 +2209,7 @@ int bt_ctf_field_type_get_alignment(struct bt_ctf_field_type *type) bt_put(element); break; } - case BT_CTF_TYPE_ID_STRUCT: + case BT_CTF_FIELD_TYPE_ID_STRUCT: { int i, element_count; @@ -2244,7 +2244,7 @@ int bt_ctf_field_type_get_alignment(struct bt_ctf_field_type *type) ret = (int) type->alignment; break; } - case BT_CTF_TYPE_ID_UNKNOWN: + case BT_CTF_FIELD_TYPE_ID_UNKNOWN: ret = -1; break; default: @@ -2265,7 +2265,7 @@ int bt_ctf_field_type_set_alignment(struct bt_ctf_field_type *type, unsigned int alignment) { int ret = 0; - enum bt_ctf_type_id type_id; + enum bt_ctf_field_type_id type_id; /* Alignment must be a power of two */ if (!type || type->frozen || !is_power_of_two(alignment)) { @@ -2274,20 +2274,20 @@ int bt_ctf_field_type_set_alignment(struct bt_ctf_field_type *type, } type_id = bt_ctf_field_type_get_type_id(type); - if (type_id == BT_CTF_TYPE_ID_UNKNOWN) { + if (type_id == BT_CTF_FIELD_TYPE_ID_UNKNOWN) { ret = -1; goto end; } - if (type->id == BT_CTF_TYPE_ID_STRING && + if (type->id == BT_CTF_FIELD_TYPE_ID_STRING && alignment != CHAR_BIT) { ret = -1; goto end; } - if (type_id == BT_CTF_TYPE_ID_VARIANT || - type_id == BT_CTF_TYPE_ID_SEQUENCE || - type_id == BT_CTF_TYPE_ID_ARRAY) { + if (type_id == BT_CTF_FIELD_TYPE_ID_VARIANT || + type_id == BT_CTF_FIELD_TYPE_ID_SEQUENCE || + type_id == BT_CTF_FIELD_TYPE_ID_ARRAY) { /* Setting an alignment on these types makes no sense */ ret = -1; goto end; @@ -2309,21 +2309,21 @@ enum bt_ctf_byte_order bt_ctf_field_type_get_byte_order( } switch (type->id) { - case BT_CTF_TYPE_ID_INTEGER: + case BT_CTF_FIELD_TYPE_ID_INTEGER: { struct bt_ctf_field_type_integer *integer = container_of( type, struct bt_ctf_field_type_integer, parent); ret = integer->user_byte_order; break; } - case BT_CTF_TYPE_ID_ENUM: + case BT_CTF_FIELD_TYPE_ID_ENUM: { struct bt_ctf_field_type_enumeration *enum_ft = container_of( type, struct bt_ctf_field_type_enumeration, parent); ret = bt_ctf_field_type_get_byte_order(enum_ft->container); break; } - case BT_CTF_TYPE_ID_FLOAT: + case BT_CTF_FIELD_TYPE_ID_FLOAT: { struct bt_ctf_field_type_floating_point *floating_point = container_of(type, @@ -2370,11 +2370,11 @@ end: return ret; } -enum bt_ctf_type_id bt_ctf_field_type_get_type_id( +enum bt_ctf_field_type_id bt_ctf_field_type_get_type_id( struct bt_ctf_field_type *type) { if (!type) { - return BT_CTF_TYPE_ID_UNKNOWN; + return BT_CTF_FIELD_TYPE_ID_UNKNOWN; } return type->id; @@ -2382,42 +2382,42 @@ enum bt_ctf_type_id bt_ctf_field_type_get_type_id( int bt_ctf_field_type_is_integer(struct bt_ctf_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_INTEGER; + return bt_ctf_field_type_get_type_id(type) == BT_CTF_FIELD_TYPE_ID_INTEGER; } int bt_ctf_field_type_is_floating_point(struct bt_ctf_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_FLOAT; + return bt_ctf_field_type_get_type_id(type) == BT_CTF_FIELD_TYPE_ID_FLOAT; } int bt_ctf_field_type_is_enumeration(struct bt_ctf_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_ENUM; + return bt_ctf_field_type_get_type_id(type) == BT_CTF_FIELD_TYPE_ID_ENUM; } int bt_ctf_field_type_is_string(struct bt_ctf_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_STRING; + return bt_ctf_field_type_get_type_id(type) == BT_CTF_FIELD_TYPE_ID_STRING; } int bt_ctf_field_type_is_structure(struct bt_ctf_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_STRUCT; + return bt_ctf_field_type_get_type_id(type) == BT_CTF_FIELD_TYPE_ID_STRUCT; } int bt_ctf_field_type_is_array(struct bt_ctf_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_ARRAY; + return bt_ctf_field_type_get_type_id(type) == BT_CTF_FIELD_TYPE_ID_ARRAY; } int bt_ctf_field_type_is_sequence(struct bt_ctf_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_SEQUENCE; + return bt_ctf_field_type_get_type_id(type) == BT_CTF_FIELD_TYPE_ID_SEQUENCE; } int bt_ctf_field_type_is_variant(struct bt_ctf_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_VARIANT; + return bt_ctf_field_type_get_type_id(type) == BT_CTF_FIELD_TYPE_ID_VARIANT; } void bt_ctf_field_type_get(struct bt_ctf_field_type *type) @@ -2556,7 +2556,7 @@ int bt_ctf_field_type_structure_get_field_name_index( struct bt_ctf_field_type_structure *structure; if (!type || !name || - bt_ctf_field_type_get_type_id(type) != BT_CTF_TYPE_ID_STRUCT) { + bt_ctf_field_type_get_type_id(type) != BT_CTF_FIELD_TYPE_ID_STRUCT) { ret = -1; goto end; } @@ -2587,7 +2587,7 @@ int bt_ctf_field_type_structure_set_field_index(struct bt_ctf_field_type *type, struct bt_ctf_field_type_structure *structure; if (!type || !field || - bt_ctf_field_type_get_type_id(type) != BT_CTF_TYPE_ID_STRUCT) { + bt_ctf_field_type_get_type_id(type) != BT_CTF_FIELD_TYPE_ID_STRUCT) { ret = -1; goto end; } @@ -2618,7 +2618,7 @@ int bt_ctf_field_type_variant_get_field_name_index( struct bt_ctf_field_type_variant *variant; if (!type || !name || - bt_ctf_field_type_get_type_id(type) != BT_CTF_TYPE_ID_VARIANT) { + bt_ctf_field_type_get_type_id(type) != BT_CTF_FIELD_TYPE_ID_VARIANT) { ret = -1; goto end; } @@ -2650,7 +2650,7 @@ int bt_ctf_field_type_sequence_set_length_field_path( struct bt_ctf_field_type_sequence *sequence; if (!type || bt_ctf_field_type_get_type_id(type) != - BT_CTF_TYPE_ID_SEQUENCE) { + BT_CTF_FIELD_TYPE_ID_SEQUENCE) { ret = -1; goto end; } @@ -2671,7 +2671,7 @@ int bt_ctf_field_type_variant_set_tag_field_path(struct bt_ctf_field_type *type, struct bt_ctf_field_type_variant *variant; if (!type || bt_ctf_field_type_get_type_id(type) != - BT_CTF_TYPE_ID_VARIANT) { + BT_CTF_FIELD_TYPE_ID_VARIANT) { ret = -1; goto end; } @@ -2693,7 +2693,7 @@ int bt_ctf_field_type_variant_set_tag_field_type(struct bt_ctf_field_type *type, if (!type || !tag || bt_ctf_field_type_get_type_id(tag) != - BT_CTF_TYPE_ID_ENUM) { + BT_CTF_FIELD_TYPE_ID_ENUM) { ret = -1; goto end; } @@ -2718,7 +2718,7 @@ int bt_ctf_field_type_variant_set_field_index(struct bt_ctf_field_type *type, struct bt_ctf_field_type_variant *variant; if (!type || !field || - bt_ctf_field_type_get_type_id(type) != BT_CTF_TYPE_ID_VARIANT) { + bt_ctf_field_type_get_type_id(type) != BT_CTF_FIELD_TYPE_ID_VARIANT) { ret = -1; goto end; } @@ -4076,7 +4076,7 @@ int bt_ctf_field_type_compare(struct bt_ctf_field_type *type_a, goto end; } - if (type_a->id == BT_CTF_TYPE_ID_UNKNOWN) { + if (type_a->id == BT_CTF_FIELD_TYPE_ID_UNKNOWN) { /* Both have unknown type IDs */ goto end; } @@ -4091,7 +4091,7 @@ BT_HIDDEN int bt_ctf_field_type_get_field_count(struct bt_ctf_field_type *field_type) { int field_count = -1; - enum bt_ctf_type_id type_id = bt_ctf_field_type_get_type_id(field_type); + enum bt_ctf_field_type_id type_id = bt_ctf_field_type_get_type_id(field_type); switch (type_id) { case CTF_TYPE_STRUCT: @@ -4122,7 +4122,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_get_field_at_index( struct bt_ctf_field_type *field_type, int index) { struct bt_ctf_field_type *field = NULL; - enum bt_ctf_type_id type_id = bt_ctf_field_type_get_type_id(field_type); + enum bt_ctf_field_type_id type_id = bt_ctf_field_type_get_type_id(field_type); switch (type_id) { case CTF_TYPE_STRUCT: @@ -4157,7 +4157,7 @@ int bt_ctf_field_type_get_field_index(struct bt_ctf_field_type *field_type, const char *name) { int field_index = -1; - enum bt_ctf_type_id type_id = bt_ctf_field_type_get_type_id(field_type); + enum bt_ctf_field_type_id type_id = bt_ctf_field_type_get_type_id(field_type); switch (type_id) { case CTF_TYPE_STRUCT: diff --git a/lib/ctf-ir/fields.c b/lib/ctf-ir/fields.c index 48dce566..ace87de3 100644 --- a/lib/ctf-ir/fields.c +++ b/lib/ctf-ir/fields.c @@ -182,109 +182,109 @@ int increase_packet_size(struct bt_ctf_stream_pos *pos); static struct bt_ctf_field *(* const field_create_funcs[])( struct bt_ctf_field_type *) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_integer_create, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_create, - [BT_CTF_TYPE_ID_FLOAT] = + [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_integer_create, + [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_create, + [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_floating_point_create, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_create, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_create, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_create, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_create, - [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_string_create, + [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_create, + [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_create, + [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_create, + [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_create, + [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_string_create, }; static void (* const field_destroy_funcs[])(struct bt_ctf_field *) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_integer_destroy, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_destroy, - [BT_CTF_TYPE_ID_FLOAT] = + [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_integer_destroy, + [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_destroy, + [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_floating_point_destroy, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_destroy, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_destroy, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_destroy, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_destroy, - [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_string_destroy, + [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_destroy, + [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_destroy, + [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_destroy, + [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_destroy, + [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_string_destroy, }; static int (* const field_validate_funcs[])(struct bt_ctf_field *) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_generic_validate, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_validate, - [BT_CTF_TYPE_ID_FLOAT] = bt_ctf_field_generic_validate, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_validate, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_validate, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_validate, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_validate, - [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_generic_validate, + [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_generic_validate, + [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_validate, + [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_generic_validate, + [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_validate, + [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_validate, + [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_validate, + [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_validate, + [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_generic_validate, }; static int (* const field_reset_funcs[])(struct bt_ctf_field *) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_generic_reset, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_reset, - [BT_CTF_TYPE_ID_FLOAT] = bt_ctf_field_generic_reset, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_reset, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_reset, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_reset, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_reset, - [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_string_reset, + [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_generic_reset, + [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_reset, + [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_generic_reset, + [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_reset, + [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_reset, + [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_reset, + [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_reset, + [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_string_reset, }; static int (* const field_serialize_funcs[])(struct bt_ctf_field *, struct bt_ctf_stream_pos *, enum bt_ctf_byte_order) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_integer_serialize, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_serialize, - [BT_CTF_TYPE_ID_FLOAT] = + [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_integer_serialize, + [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_serialize, + [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_floating_point_serialize, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_serialize, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_serialize, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_serialize, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_serialize, - [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_string_serialize, + [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_serialize, + [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_serialize, + [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_serialize, + [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_serialize, + [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_string_serialize, }; static int (* const field_copy_funcs[])(struct bt_ctf_field *, struct bt_ctf_field *) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_integer_copy, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_copy, - [BT_CTF_TYPE_ID_FLOAT] = bt_ctf_field_floating_point_copy, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_copy, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_copy, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_copy, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_copy, - [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_string_copy, + [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_integer_copy, + [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_copy, + [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_floating_point_copy, + [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_copy, + [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_copy, + [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_copy, + [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_copy, + [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_string_copy, }; static void (* const field_freeze_funcs[])(struct bt_ctf_field *) = { - [BT_CTF_TYPE_ID_INTEGER] = generic_field_freeze, - [BT_CTF_TYPE_ID_FLOAT] = generic_field_freeze, - [BT_CTF_TYPE_ID_STRING] = generic_field_freeze, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_freeze, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_freeze, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_freeze, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_freeze, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_freeze, + [BT_CTF_FIELD_TYPE_ID_INTEGER] = generic_field_freeze, + [BT_CTF_FIELD_TYPE_ID_FLOAT] = generic_field_freeze, + [BT_CTF_FIELD_TYPE_ID_STRING] = generic_field_freeze, + [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_freeze, + [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_freeze, + [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_freeze, + [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_freeze, + [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_freeze, }; static bool (* const field_is_set_funcs[])(struct bt_ctf_field *) = { - [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_generic_is_set, - [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_is_set, - [BT_CTF_TYPE_ID_FLOAT] = bt_ctf_field_generic_is_set, - [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_is_set, - [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_is_set, - [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_is_set, - [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_is_set, - [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_generic_is_set, + [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_generic_is_set, + [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_is_set, + [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_generic_is_set, + [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_is_set, + [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_is_set, + [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_is_set, + [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_is_set, + [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_generic_is_set, }; struct bt_ctf_field *bt_ctf_field_create(struct bt_ctf_field_type *type) { struct bt_ctf_field *field = NULL; - enum bt_ctf_type_id type_id; + enum bt_ctf_field_type_id type_id; int ret; if (!type) { @@ -292,7 +292,7 @@ struct bt_ctf_field *bt_ctf_field_create(struct bt_ctf_field_type *type) } type_id = bt_ctf_field_type_get_type_id(type); - if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || + if (type_id <= BT_CTF_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { goto error; } @@ -343,9 +343,9 @@ end: return ret; } -enum bt_ctf_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field) +enum bt_ctf_field_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field) { - enum bt_ctf_type_id ret = BT_CTF_TYPE_ID_UNKNOWN; + enum bt_ctf_field_type_id ret = BT_CTF_FIELD_TYPE_ID_UNKNOWN; if (!field) { goto end; @@ -358,42 +358,42 @@ end: int bt_ctf_field_is_integer(struct bt_ctf_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_INTEGER; + return bt_ctf_field_get_type_id(field) == BT_CTF_FIELD_TYPE_ID_INTEGER; } int bt_ctf_field_is_floating_point(struct bt_ctf_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_FLOAT; + return bt_ctf_field_get_type_id(field) == BT_CTF_FIELD_TYPE_ID_FLOAT; } int bt_ctf_field_is_enumeration(struct bt_ctf_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_ENUM; + return bt_ctf_field_get_type_id(field) == BT_CTF_FIELD_TYPE_ID_ENUM; } int bt_ctf_field_is_string(struct bt_ctf_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_STRING; + return bt_ctf_field_get_type_id(field) == BT_CTF_FIELD_TYPE_ID_STRING; } int bt_ctf_field_is_structure(struct bt_ctf_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_STRUCT; + return bt_ctf_field_get_type_id(field) == BT_CTF_FIELD_TYPE_ID_STRUCT; } int bt_ctf_field_is_array(struct bt_ctf_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_ARRAY; + return bt_ctf_field_get_type_id(field) == BT_CTF_FIELD_TYPE_ID_ARRAY; } int bt_ctf_field_is_sequence(struct bt_ctf_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_SEQUENCE; + return bt_ctf_field_get_type_id(field) == BT_CTF_FIELD_TYPE_ID_SEQUENCE; } int bt_ctf_field_is_variant(struct bt_ctf_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_VARIANT; + return bt_ctf_field_get_type_id(field) == BT_CTF_FIELD_TYPE_ID_VARIANT; } struct bt_ctf_field *bt_ctf_field_sequence_get_length( @@ -407,7 +407,7 @@ struct bt_ctf_field *bt_ctf_field_sequence_get_length( } if (bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_SEQUENCE) { + BT_CTF_FIELD_TYPE_ID_SEQUENCE) { goto end; } @@ -432,7 +432,7 @@ int bt_ctf_field_sequence_set_length(struct bt_ctf_field *field, goto end; } if (bt_ctf_field_type_get_type_id(length_field->type) != - BT_CTF_TYPE_ID_INTEGER) { + BT_CTF_FIELD_TYPE_ID_INTEGER) { ret = -1; goto end; } @@ -480,7 +480,7 @@ struct bt_ctf_field *bt_ctf_field_structure_get_field( if (!field || !name || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_STRUCT) { + BT_CTF_FIELD_TYPE_ID_STRUCT) { goto error; } @@ -531,7 +531,7 @@ struct bt_ctf_field *bt_ctf_field_structure_get_field_by_index( if (!field || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_STRUCT) { + BT_CTF_FIELD_TYPE_ID_STRUCT) { goto end; } @@ -587,7 +587,7 @@ int bt_ctf_field_structure_set_field(struct bt_ctf_field *field, if (!field || !name || !value || field->frozen || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_STRUCT) { + BT_CTF_FIELD_TYPE_ID_STRUCT) { ret = -1; goto end; } @@ -629,7 +629,7 @@ struct bt_ctf_field *bt_ctf_field_array_get_field(struct bt_ctf_field *field, struct bt_ctf_field_array *array; if (!field || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_ARRAY) { + BT_CTF_FIELD_TYPE_ID_ARRAY) { goto end; } @@ -669,7 +669,7 @@ struct bt_ctf_field *bt_ctf_field_sequence_get_field(struct bt_ctf_field *field, struct bt_ctf_field_sequence *sequence; if (!field || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_SEQUENCE) { + BT_CTF_FIELD_TYPE_ID_SEQUENCE) { goto end; } @@ -714,9 +714,9 @@ struct bt_ctf_field *bt_ctf_field_variant_get_field(struct bt_ctf_field *field, if (!field || !tag_field || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_VARIANT || + BT_CTF_FIELD_TYPE_ID_VARIANT || bt_ctf_field_type_get_type_id(tag_field->type) != - BT_CTF_TYPE_ID_ENUM) { + BT_CTF_FIELD_TYPE_ID_ENUM) { goto end; } @@ -797,7 +797,7 @@ struct bt_ctf_field *bt_ctf_field_variant_get_current_field( if (!variant_field || bt_ctf_field_type_get_type_id(variant_field->type) != - BT_CTF_TYPE_ID_VARIANT) { + BT_CTF_FIELD_TYPE_ID_VARIANT) { goto end; } @@ -822,7 +822,7 @@ struct bt_ctf_field *bt_ctf_field_variant_get_tag( if (!variant_field || bt_ctf_field_type_get_type_id(variant_field->type) != - BT_CTF_TYPE_ID_VARIANT) { + BT_CTF_FIELD_TYPE_ID_VARIANT) { goto end; } @@ -842,7 +842,7 @@ struct bt_ctf_field *bt_ctf_field_enumeration_get_container( struct bt_ctf_field_enumeration *enumeration; if (!field || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_ENUM) { + BT_CTF_FIELD_TYPE_ID_ENUM) { goto end; } @@ -928,7 +928,7 @@ int bt_ctf_field_signed_integer_get_value(struct bt_ctf_field *field, if (!field || !value || !field->payload_set || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_INTEGER) { + BT_CTF_FIELD_TYPE_ID_INTEGER) { ret = -1; goto end; } @@ -958,7 +958,7 @@ int bt_ctf_field_signed_integer_set_value(struct bt_ctf_field *field, if (!field || field->frozen || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_INTEGER) { + BT_CTF_FIELD_TYPE_ID_INTEGER) { ret = -1; goto end; } @@ -994,7 +994,7 @@ int bt_ctf_field_unsigned_integer_get_value(struct bt_ctf_field *field, if (!field || !value || !field->payload_set || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_INTEGER) { + BT_CTF_FIELD_TYPE_ID_INTEGER) { ret = -1; goto end; } @@ -1024,7 +1024,7 @@ int bt_ctf_field_unsigned_integer_set_value(struct bt_ctf_field *field, if (!field || field->frozen || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_INTEGER) { + BT_CTF_FIELD_TYPE_ID_INTEGER) { ret = -1; goto end; } @@ -1058,7 +1058,7 @@ int bt_ctf_field_floating_point_get_value(struct bt_ctf_field *field, if (!field || !value || !field->payload_set || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_FLOAT) { + BT_CTF_FIELD_TYPE_ID_FLOAT) { ret = -1; goto end; } @@ -1078,7 +1078,7 @@ int bt_ctf_field_floating_point_set_value(struct bt_ctf_field *field, if (!field || field->frozen || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_FLOAT) { + BT_CTF_FIELD_TYPE_ID_FLOAT) { ret = -1; goto end; } @@ -1097,7 +1097,7 @@ const char *bt_ctf_field_string_get_value(struct bt_ctf_field *field) if (!field || !field->payload_set || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_STRING) { + BT_CTF_FIELD_TYPE_ID_STRING) { goto end; } @@ -1116,7 +1116,7 @@ int bt_ctf_field_string_set_value(struct bt_ctf_field *field, if (!field || !value || field->frozen || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_STRING) { + BT_CTF_FIELD_TYPE_ID_STRING) { ret = -1; goto end; } @@ -1141,7 +1141,7 @@ int bt_ctf_field_string_append(struct bt_ctf_field *field, if (!field || !value || field->frozen || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_STRING) { + BT_CTF_FIELD_TYPE_ID_STRING) { ret = -1; goto end; } @@ -1170,7 +1170,7 @@ int bt_ctf_field_string_append_len(struct bt_ctf_field *field, if (!field || !value || field->frozen || bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_TYPE_ID_STRING) { + BT_CTF_FIELD_TYPE_ID_STRING) { ret = -1; goto end; } @@ -1203,7 +1203,7 @@ BT_HIDDEN int bt_ctf_field_validate(struct bt_ctf_field *field) { int ret = 0; - enum bt_ctf_type_id type_id; + enum bt_ctf_field_type_id type_id; if (!field) { ret = -1; @@ -1211,7 +1211,7 @@ int bt_ctf_field_validate(struct bt_ctf_field *field) } type_id = bt_ctf_field_type_get_type_id(field->type); - if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { + if (type_id <= BT_CTF_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { ret = -1; goto end; } @@ -1225,7 +1225,7 @@ BT_HIDDEN int bt_ctf_field_reset(struct bt_ctf_field *field) { int ret = 0; - enum bt_ctf_type_id type_id; + enum bt_ctf_field_type_id type_id; if (!field) { ret = -1; @@ -1233,7 +1233,7 @@ int bt_ctf_field_reset(struct bt_ctf_field *field) } type_id = bt_ctf_field_type_get_type_id(field->type); - if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { + if (type_id <= BT_CTF_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { ret = -1; goto end; } @@ -1249,7 +1249,7 @@ int bt_ctf_field_serialize(struct bt_ctf_field *field, enum bt_ctf_byte_order native_byte_order) { int ret = 0; - enum bt_ctf_type_id type_id; + enum bt_ctf_field_type_id type_id; if (!field || !pos) { ret = -1; @@ -1257,7 +1257,7 @@ int bt_ctf_field_serialize(struct bt_ctf_field *field, } type_id = bt_ctf_field_type_get_type_id(field->type); - if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { + if (type_id <= BT_CTF_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { ret = -1; goto end; } @@ -1272,14 +1272,14 @@ BT_HIDDEN bool bt_ctf_field_is_set(struct bt_ctf_field *field) { bool is_set = false; - enum bt_ctf_type_id type_id; + enum bt_ctf_field_type_id type_id; if (!field) { goto end; } type_id = bt_ctf_field_type_get_type_id(field->type); - if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { + if (type_id <= BT_CTF_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { goto end; } @@ -1292,14 +1292,14 @@ struct bt_ctf_field *bt_ctf_field_copy(struct bt_ctf_field *field) { int ret; struct bt_ctf_field *copy = NULL; - enum bt_ctf_type_id type_id; + enum bt_ctf_field_type_id type_id; if (!field) { goto end; } type_id = bt_ctf_field_type_get_type_id(field->type); - if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { + if (type_id <= BT_CTF_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { goto end; } @@ -1428,12 +1428,12 @@ void bt_ctf_field_destroy(struct bt_object *obj) { struct bt_ctf_field *field; struct bt_ctf_field_type *type; - enum bt_ctf_type_id type_id; + enum bt_ctf_field_type_id type_id; field = container_of(obj, struct bt_ctf_field, base); type = field->type; type_id = bt_ctf_field_type_get_type_id(type); - if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || + if (type_id <= BT_CTF_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { return; } @@ -2405,14 +2405,14 @@ void bt_ctf_field_sequence_freeze(struct bt_ctf_field *field) BT_HIDDEN void bt_ctf_field_freeze(struct bt_ctf_field *field) { - enum bt_ctf_type_id type_id; + enum bt_ctf_field_type_id type_id; if (!field) { goto end; } type_id = bt_ctf_field_get_type_id(field); - if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || + if (type_id <= BT_CTF_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { goto end; } diff --git a/lib/ctf-ir/resolve.c b/lib/ctf-ir/resolve.c index 41dd6c5d..f72652ef 100644 --- a/lib/ctf-ir/resolve.c +++ b/lib/ctf-ir/resolve.c @@ -394,7 +394,7 @@ int ptokens_to_field_path(GList *ptokens, struct bt_ctf_field_path *field_path, int child_index; struct bt_ctf_field_type *child_type; const char *field_name = ptoken_get_string(cur_ptoken); - enum bt_ctf_type_id type_id = + enum bt_ctf_field_type_id type_id = bt_ctf_field_type_get_type_id(type); /* Find to which index corresponds the current path token */ diff --git a/lib/ctf-ir/stream-class.c b/lib/ctf-ir/stream-class.c index fbf81942..776ced90 100644 --- a/lib/ctf-ir/stream-class.c +++ b/lib/ctf-ir/stream-class.c @@ -585,7 +585,7 @@ int bt_ctf_stream_class_set_packet_context_type( if (packet_context_type && bt_ctf_field_type_get_type_id(packet_context_type) != - BT_CTF_TYPE_ID_STRUCT) { + BT_CTF_FIELD_TYPE_ID_STRUCT) { /* A packet context must be a structure. */ ret = -1; goto end; @@ -626,7 +626,7 @@ int bt_ctf_stream_class_set_event_header_type( if (event_header_type && bt_ctf_field_type_get_type_id(event_header_type) != - BT_CTF_TYPE_ID_STRUCT) { + BT_CTF_FIELD_TYPE_ID_STRUCT) { /* An event header must be a structure. */ ret = -1; goto end; @@ -666,7 +666,7 @@ int bt_ctf_stream_class_set_event_context_type( if (event_context_type && bt_ctf_field_type_get_type_id(event_context_type) != - BT_CTF_TYPE_ID_STRUCT) { + BT_CTF_FIELD_TYPE_ID_STRUCT) { /* A packet context must be a structure. */ ret = -1; goto end; diff --git a/lib/ctf-ir/stream.c b/lib/ctf-ir/stream.c index 39d490c3..a06cbbbf 100644 --- a/lib/ctf-ir/stream.c +++ b/lib/ctf-ir/stream.c @@ -66,7 +66,7 @@ int set_integer_field_value(struct bt_ctf_field* field, uint64_t value) assert(field_type); if (bt_ctf_field_type_get_type_id(field_type) != - BT_CTF_TYPE_ID_INTEGER) { + BT_CTF_FIELD_TYPE_ID_INTEGER) { /* Not an integer and the value is unset, error. */ ret = -1; goto end; @@ -112,7 +112,7 @@ int set_packet_header_magic(struct bt_ctf_stream *stream) assert(magic_field_type); if (bt_ctf_field_type_get_type_id(magic_field_type) != - BT_CTF_TYPE_ID_INTEGER) { + BT_CTF_FIELD_TYPE_ID_INTEGER) { /* Magic field is not an integer. Not an error, skip. */ goto end; } @@ -163,7 +163,7 @@ int set_packet_header_uuid(struct bt_ctf_stream *stream) uuid_field_type = bt_ctf_field_get_type(uuid_field); assert(uuid_field_type); if (bt_ctf_field_type_get_type_id(uuid_field_type) != - BT_CTF_TYPE_ID_ARRAY) { + BT_CTF_FIELD_TYPE_ID_ARRAY) { /* UUID field is not an array. Not an error, skip. */ goto end; } @@ -180,7 +180,7 @@ int set_packet_header_uuid(struct bt_ctf_stream *stream) uuid_field_type); assert(element_field_type); if (bt_ctf_field_type_get_type_id(element_field_type) != - BT_CTF_TYPE_ID_INTEGER) { + BT_CTF_FIELD_TYPE_ID_INTEGER) { /* UUID array elements are not integers. Not an error, skip */ goto end; } @@ -236,7 +236,7 @@ int set_packet_header_stream_id(struct bt_ctf_stream *stream) stream_id_field_type = bt_ctf_field_get_type(stream_id_field); assert(stream_id_field_type); if (bt_ctf_field_type_get_type_id(stream_id_field_type) != - BT_CTF_TYPE_ID_INTEGER) { + BT_CTF_FIELD_TYPE_ID_INTEGER) { /* stream_id field is not an integer. Not an error, skip. */ goto end; } @@ -841,7 +841,7 @@ int get_event_header_timestamp(struct bt_ctf_field *event_header, uint64_t *time timestamp_field_type = bt_ctf_field_get_type(timestamp_field); assert(timestamp_field_type); if (bt_ctf_field_type_get_type_id(timestamp_field_type) != - BT_CTF_TYPE_ID_INTEGER) { + BT_CTF_FIELD_TYPE_ID_INTEGER) { ret = -1; goto end; } @@ -1158,7 +1158,7 @@ int _set_structure_field_integer(struct bt_ctf_field *structure, char *name, field_type = bt_ctf_field_get_type(integer); assert(field_type); - if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_TYPE_ID_INTEGER) { + if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_INTEGER) { /* * The user most likely meant for us to populate this field * automatically. However, we can only do this if the field diff --git a/lib/ctf-ir/trace.c b/lib/ctf-ir/trace.c index c16686a0..90432dba 100644 --- a/lib/ctf-ir/trace.c +++ b/lib/ctf-ir/trace.c @@ -1046,7 +1046,7 @@ int bt_ctf_trace_set_packet_header_type(struct bt_ctf_trace *trace, /* packet_header_type must be a structure. */ if (packet_header_type && bt_ctf_field_type_get_type_id(packet_header_type) != - BT_CTF_TYPE_ID_STRUCT) { + BT_CTF_FIELD_TYPE_ID_STRUCT) { ret = -1; goto end; } diff --git a/lib/ctf-ir/validation.c b/lib/ctf-ir/validation.c index dc2a3a93..ea29c530 100644 --- a/lib/ctf-ir/validation.c +++ b/lib/ctf-ir/validation.c @@ -190,15 +190,15 @@ static int field_type_contains_sequence_or_variant_ft(struct bt_ctf_field_type *type) { int ret = 0; - enum bt_ctf_type_id type_id = bt_ctf_field_type_get_type_id(type); + enum bt_ctf_field_type_id type_id = bt_ctf_field_type_get_type_id(type); switch (type_id) { - case BT_CTF_TYPE_ID_SEQUENCE: - case BT_CTF_TYPE_ID_VARIANT: + case BT_CTF_FIELD_TYPE_ID_SEQUENCE: + case BT_CTF_FIELD_TYPE_ID_VARIANT: ret = 1; goto end; - case BT_CTF_TYPE_ID_ARRAY: - case BT_CTF_TYPE_ID_STRUCT: + case BT_CTF_FIELD_TYPE_ID_ARRAY: + case BT_CTF_FIELD_TYPE_ID_STRUCT: { int i; int field_count = bt_ctf_field_type_get_field_count(type); diff --git a/plugins/ctf/common/btr/btr.c b/plugins/ctf/common/btr/btr.c index a7486793..e7762a3d 100644 --- a/plugins/ctf/common/btr/btr.c +++ b/plugins/ctf/common/btr/btr.c @@ -206,18 +206,18 @@ int64_t get_compound_field_type_length(struct bt_ctf_btr *btr, int64_t length; switch (bt_ctf_field_type_get_type_id(field_type)) { - case BT_CTF_TYPE_ID_STRUCT: + case BT_CTF_FIELD_TYPE_ID_STRUCT: length = (int64_t) bt_ctf_field_type_structure_get_field_count( field_type); break; - case BT_CTF_TYPE_ID_VARIANT: + case BT_CTF_FIELD_TYPE_ID_VARIANT: /* Variant field types always "contain" a single type */ length = 1; break; - case BT_CTF_TYPE_ID_ARRAY: + case BT_CTF_FIELD_TYPE_ID_ARRAY: length = bt_ctf_field_type_array_get_length(field_type); break; - case BT_CTF_TYPE_ID_SEQUENCE: + case BT_CTF_FIELD_TYPE_ID_SEQUENCE: length = btr->user.cbs.query.get_sequence_length(field_type, btr->user.data); break; @@ -373,10 +373,10 @@ int get_basic_field_type_size(struct bt_ctf_btr *btr, int size; switch (bt_ctf_field_type_get_type_id(field_type)) { - case BT_CTF_TYPE_ID_INTEGER: + case BT_CTF_FIELD_TYPE_ID_INTEGER: size = bt_ctf_field_type_integer_get_size(field_type); break; - case BT_CTF_TYPE_ID_FLOAT: + case BT_CTF_FIELD_TYPE_ID_FLOAT: { int exp_dig, mant_dig; @@ -394,7 +394,7 @@ int get_basic_field_type_size(struct bt_ctf_btr *btr, size = exp_dig + mant_dig; break; } - case BT_CTF_TYPE_ID_ENUM: + case BT_CTF_FIELD_TYPE_ID_ENUM: { struct bt_ctf_field_type *int_type; @@ -986,16 +986,16 @@ enum bt_ctf_btr_status read_basic_begin_state(struct bt_ctf_btr *btr) assert(btr->cur_basic_field_type); switch (bt_ctf_field_type_get_type_id(btr->cur_basic_field_type)) { - case BT_CTF_TYPE_ID_INTEGER: + case BT_CTF_FIELD_TYPE_ID_INTEGER: status = read_basic_int_type_and_call_begin(btr); break; - case BT_CTF_TYPE_ID_FLOAT: + case BT_CTF_FIELD_TYPE_ID_FLOAT: status = read_basic_float_type_and_call_begin(btr); break; - case BT_CTF_TYPE_ID_ENUM: + case BT_CTF_FIELD_TYPE_ID_ENUM: status = read_basic_enum_type_and_call_begin(btr); break; - case BT_CTF_TYPE_ID_STRING: + case BT_CTF_FIELD_TYPE_ID_STRING: status = read_basic_string_type_and_call(btr, true); break; default: @@ -1013,16 +1013,16 @@ enum bt_ctf_btr_status read_basic_continue_state(struct bt_ctf_btr *btr) assert(btr->cur_basic_field_type); switch (bt_ctf_field_type_get_type_id(btr->cur_basic_field_type)) { - case BT_CTF_TYPE_ID_INTEGER: + case BT_CTF_FIELD_TYPE_ID_INTEGER: status = read_basic_int_type_and_call_continue(btr); break; - case BT_CTF_TYPE_ID_FLOAT: + case BT_CTF_FIELD_TYPE_ID_FLOAT: status = read_basic_float_type_and_call_continue(btr); break; - case BT_CTF_TYPE_ID_ENUM: + case BT_CTF_FIELD_TYPE_ID_ENUM: status = read_basic_enum_type_and_call_continue(btr); break; - case BT_CTF_TYPE_ID_STRING: + case BT_CTF_FIELD_TYPE_ID_STRING: status = read_basic_string_type_and_call(btr, false); break; default: @@ -1103,10 +1103,10 @@ end: static inline bool is_compound_type(struct bt_ctf_field_type *field_type) { - enum bt_ctf_type_id id = bt_ctf_field_type_get_type_id(field_type); + enum bt_ctf_field_type_id id = bt_ctf_field_type_get_type_id(field_type); - return id == BT_CTF_TYPE_ID_STRUCT || id == BT_CTF_TYPE_ID_ARRAY || - id == BT_CTF_TYPE_ID_SEQUENCE || id == BT_CTF_TYPE_ID_VARIANT; + return id == BT_CTF_FIELD_TYPE_ID_STRUCT || id == BT_CTF_FIELD_TYPE_ID_ARRAY || + id == BT_CTF_FIELD_TYPE_ID_SEQUENCE || id == BT_CTF_FIELD_TYPE_ID_VARIANT; } static inline @@ -1148,7 +1148,7 @@ enum bt_ctf_btr_status next_field_state(struct bt_ctf_btr *btr) /* Get next field's type */ switch (bt_ctf_field_type_get_type_id(top->base_type)) { - case BT_CTF_TYPE_ID_STRUCT: + case BT_CTF_FIELD_TYPE_ID_STRUCT: ret = bt_ctf_field_type_structure_get_field( top->base_type, NULL, &next_field_type, top->index); @@ -1156,17 +1156,17 @@ enum bt_ctf_btr_status next_field_state(struct bt_ctf_btr *btr) next_field_type = NULL; } break; - case BT_CTF_TYPE_ID_ARRAY: + case BT_CTF_FIELD_TYPE_ID_ARRAY: next_field_type = bt_ctf_field_type_array_get_element_type( top->base_type); break; - case BT_CTF_TYPE_ID_SEQUENCE: + case BT_CTF_FIELD_TYPE_ID_SEQUENCE: next_field_type = bt_ctf_field_type_sequence_get_element_type( top->base_type); break; - case BT_CTF_TYPE_ID_VARIANT: + case BT_CTF_FIELD_TYPE_ID_VARIANT: /* Variant types are dynamic: query the user, he should know! */ next_field_type = btr->user.cbs.query.get_variant_type( diff --git a/plugins/ctf/common/notif-iter/notif-iter.c b/plugins/ctf/common/notif-iter/notif-iter.c index 319575df..5b27899c 100644 --- a/plugins/ctf/common/notif-iter/notif-iter.c +++ b/plugins/ctf/common/notif-iter/notif-iter.c @@ -601,14 +601,14 @@ static inline bool is_struct_type(struct bt_ctf_field_type *field_type) { return bt_ctf_field_type_get_type_id(field_type) == - BT_CTF_TYPE_ID_STRUCT; + BT_CTF_FIELD_TYPE_ID_STRUCT; } static inline bool is_variant_type(struct bt_ctf_field_type *field_type) { return bt_ctf_field_type_get_type_id(field_type) == - BT_CTF_TYPE_ID_VARIANT; + BT_CTF_FIELD_TYPE_ID_VARIANT; } static @@ -1412,17 +1412,17 @@ struct bt_ctf_field *get_next_field(struct bt_ctf_notif_iter *notit) } switch (bt_ctf_field_type_get_type_id(base_type)) { - case BT_CTF_TYPE_ID_STRUCT: + case BT_CTF_FIELD_TYPE_ID_STRUCT: next_field = bt_ctf_field_structure_get_field_by_index( base_field, index); break; - case BT_CTF_TYPE_ID_ARRAY: + case BT_CTF_FIELD_TYPE_ID_ARRAY: next_field = bt_ctf_field_array_get_field(base_field, index); break; - case BT_CTF_TYPE_ID_SEQUENCE: + case BT_CTF_FIELD_TYPE_ID_SEQUENCE: next_field = bt_ctf_field_sequence_get_field(base_field, index); break; - case BT_CTF_TYPE_ID_VARIANT: + case BT_CTF_FIELD_TYPE_ID_VARIANT: next_field = bt_ctf_field_variant_get_current_field(base_field); break; default: @@ -1555,12 +1555,12 @@ enum bt_ctf_btr_status btr_unsigned_int_common(uint64_t value, } switch(bt_ctf_field_type_get_type_id(type)) { - case BT_CTF_TYPE_ID_INTEGER: + case BT_CTF_FIELD_TYPE_ID_INTEGER: /* Integer field is created field */ BT_MOVE(int_field, field); bt_get(type); break; - case BT_CTF_TYPE_ID_ENUM: + case BT_CTF_FIELD_TYPE_ID_ENUM: int_field = bt_ctf_field_enumeration_get_container(field); type = bt_ctf_field_get_type(int_field); break; @@ -1650,12 +1650,12 @@ enum bt_ctf_btr_status btr_signed_int_cb(int64_t value, } switch(bt_ctf_field_type_get_type_id(type)) { - case BT_CTF_TYPE_ID_INTEGER: + case BT_CTF_FIELD_TYPE_ID_INTEGER: /* Integer field is created field */ BT_MOVE(int_field, field); bt_get(type); break; - case BT_CTF_TYPE_ID_ENUM: + case BT_CTF_FIELD_TYPE_ID_ENUM: int_field = bt_ctf_field_enumeration_get_container(field); type = bt_ctf_field_get_type(int_field); break; diff --git a/plugins/debug-info/copy.c b/plugins/debug-info/copy.c index 892d8799..6c392602 100644 --- a/plugins/debug-info/copy.c +++ b/plugins/debug-info/copy.c @@ -61,7 +61,7 @@ struct bt_ctf_field *get_payload_field(FILE *err, goto end; } - if (bt_ctf_field_type_get_type_id(sec_type) != BT_CTF_TYPE_ID_STRUCT) { + if (bt_ctf_field_type_get_type_id(sec_type) != BT_CTF_FIELD_TYPE_ID_STRUCT) { fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); goto end; @@ -96,7 +96,7 @@ struct bt_ctf_field *get_stream_event_context_field(FILE *err, goto end; } - if (bt_ctf_field_type_get_type_id(sec_type) != BT_CTF_TYPE_ID_STRUCT) { + if (bt_ctf_field_type_get_type_id(sec_type) != BT_CTF_FIELD_TYPE_ID_STRUCT) { fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); goto end; @@ -133,7 +133,7 @@ int get_stream_event_context_unsigned_int_field_value(FILE *err, goto error; } - if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_TYPE_ID_INTEGER) { + if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_INTEGER) { fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); goto error; @@ -176,7 +176,7 @@ int get_stream_event_context_int_field_value(FILE *err, struct bt_ctf_event *eve goto error; } - if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_TYPE_ID_INTEGER) { + if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_INTEGER) { fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); goto error; @@ -222,7 +222,7 @@ int get_payload_unsigned_int_field_value(FILE *err, goto error; } - if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_TYPE_ID_INTEGER) { + if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_INTEGER) { fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); goto error; @@ -267,7 +267,7 @@ int get_payload_int_field_value(FILE *err, struct bt_ctf_event *event, goto error; } - if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_TYPE_ID_INTEGER) { + if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_INTEGER) { fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); goto error; @@ -313,7 +313,7 @@ int get_payload_string_field_value(FILE *err, goto error; } - if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_TYPE_ID_STRING) { + if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_STRING) { fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); goto error; @@ -364,7 +364,7 @@ int get_payload_build_id_field_value(FILE *err, goto error; } - if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_TYPE_ID_SEQUENCE) { + if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_SEQUENCE) { fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); goto error; @@ -1273,7 +1273,7 @@ int copy_set_debug_info_stream_event_context(FILE *err, * If it is not a structure, we did not modify it to add the debug info * fields, so just assign it as is. */ - if (bt_ctf_field_type_get_type_id(writer_event_context_type) != BT_CTF_TYPE_ID_STRUCT) { + if (bt_ctf_field_type_get_type_id(writer_event_context_type) != BT_CTF_FIELD_TYPE_ID_STRUCT) { ret = bt_ctf_event_set_event_context(writer_event, event_context); goto end; } diff --git a/plugins/libctfcopytrace/clock-fields.c b/plugins/libctfcopytrace/clock-fields.c index 7400f1ce..68fb5b75 100644 --- a/plugins/libctfcopytrace/clock-fields.c +++ b/plugins/libctfcopytrace/clock-fields.c @@ -124,23 +124,23 @@ int find_update_clock_fields(FILE *err, struct bt_ctf_field_type *type, int ret; switch (bt_ctf_field_type_get_type_id(type)) { - case BT_CTF_TYPE_ID_INTEGER: + case BT_CTF_FIELD_TYPE_ID_INTEGER: return update_header_clock_int_field_type(err, type, writer_clock_class); - case BT_CTF_TYPE_ID_STRUCT: + case BT_CTF_FIELD_TYPE_ID_STRUCT: return find_update_struct_clock_fields(err, type, writer_clock_class); - case BT_CTF_TYPE_ID_ARRAY: + case BT_CTF_FIELD_TYPE_ID_ARRAY: return find_update_array_clock_fields(err, type, writer_clock_class); - case BT_CTF_TYPE_ID_SEQUENCE: + case BT_CTF_FIELD_TYPE_ID_SEQUENCE: return find_update_sequence_clock_fields(err, type, writer_clock_class); case BT_CTF_TYPE_ID_UNTAGGED_VARIANT: - case BT_CTF_TYPE_ID_VARIANT: + case BT_CTF_FIELD_TYPE_ID_VARIANT: return find_update_variant_clock_fields(err, type, writer_clock_class); - case BT_CTF_TYPE_ID_ENUM: + case BT_CTF_FIELD_TYPE_ID_ENUM: return find_update_enum_clock_fields(err, type, writer_clock_class); break; @@ -343,7 +343,7 @@ struct bt_ctf_field_type *override_header_type(FILE *err, goto error; } - if (bt_ctf_field_type_get_type_id(new_type) != BT_CTF_TYPE_ID_STRUCT) { + if (bt_ctf_field_type_get_type_id(new_type) != BT_CTF_FIELD_TYPE_ID_STRUCT) { fprintf(err, "[error] Unexpected header field type\n"); goto error; } @@ -440,39 +440,39 @@ int copy_override_field(FILE *err, struct bt_ctf_event *event, } switch (bt_ctf_field_type_get_type_id(type)) { - case BT_CTF_TYPE_ID_INTEGER: + case BT_CTF_FIELD_TYPE_ID_INTEGER: ret = copy_find_clock_int_field(err, event, writer_event, field, type, copy_field); break; - case BT_CTF_TYPE_ID_STRUCT: + case BT_CTF_FIELD_TYPE_ID_STRUCT: ret = copy_find_clock_struct_field(err, event, writer_event, field, type, copy_field); break; - case BT_CTF_TYPE_ID_FLOAT: + case BT_CTF_FIELD_TYPE_ID_FLOAT: ret = copy_float_field(err, field, type, copy_field); break; - case BT_CTF_TYPE_ID_ENUM: + case BT_CTF_FIELD_TYPE_ID_ENUM: ret = copy_find_clock_enum_field(err, event, writer_event, field, type, copy_field); break; - case BT_CTF_TYPE_ID_STRING: + case BT_CTF_FIELD_TYPE_ID_STRING: ret = copy_string_field(err, field, type, copy_field); break; - case BT_CTF_TYPE_ID_ARRAY: + case BT_CTF_FIELD_TYPE_ID_ARRAY: ret = copy_find_clock_array_field(err, event, writer_event, field, type, copy_field); break; - case BT_CTF_TYPE_ID_SEQUENCE: + case BT_CTF_FIELD_TYPE_ID_SEQUENCE: ret = copy_find_clock_sequence_field(err, event, writer_event, field, type, copy_field); break; case BT_CTF_TYPE_ID_UNTAGGED_VARIANT: - case BT_CTF_TYPE_ID_VARIANT: + case BT_CTF_FIELD_TYPE_ID_VARIANT: ret = copy_find_clock_variant_field(err, event, writer_event, field, type, copy_field); break; /* No default, we want to catch missing field types. */ - case BT_CTF_TYPE_ID_UNKNOWN: + case BT_CTF_FIELD_TYPE_ID_UNKNOWN: case BT_CTF_NR_TYPE_IDS: break; } diff --git a/plugins/libctfcopytrace/ctfcopytrace.c b/plugins/libctfcopytrace/ctfcopytrace.c index 39c394bd..ee983651 100644 --- a/plugins/libctfcopytrace/ctfcopytrace.c +++ b/plugins/libctfcopytrace/ctfcopytrace.c @@ -475,7 +475,7 @@ enum bt_component_status ctf_copy_packet_context_field(FILE *err, /* * Only support for integers for now. */ - if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_TYPE_ID_INTEGER) { + if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_INTEGER) { fprintf(err, "[error] Unsupported packet context field type\n"); ret = BT_COMPONENT_STATUS_ERROR; goto error; @@ -593,7 +593,7 @@ struct bt_ctf_field *ctf_copy_packet_context(FILE *err, continue; } - if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_TYPE_ID_INTEGER) { + if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_INTEGER) { fprintf(err, "[error] Unexpected packet context field type\n"); goto error; } diff --git a/plugins/text/print.c b/plugins/text/print.c index a1298583..c155e6ff 100644 --- a/plugins/text/print.c +++ b/plugins/text/print.c @@ -1003,7 +1003,7 @@ enum bt_component_status print_array(struct text_component *text, { enum bt_component_status ret = BT_COMPONENT_STATUS_OK; struct bt_ctf_field_type *array_type = NULL, *field_type = NULL; - enum bt_ctf_type_id type_id; + enum bt_ctf_field_type_id type_id; int64_t len; uint64_t i; bool is_string = false; @@ -1024,7 +1024,7 @@ enum bt_component_status print_array(struct text_component *text, goto end; } type_id = bt_ctf_field_type_get_type_id(field_type); - if (type_id == BT_CTF_TYPE_ID_INTEGER) { + if (type_id == BT_CTF_FIELD_TYPE_ID_INTEGER) { enum bt_ctf_string_encoding encoding; encoding = bt_ctf_field_type_integer_get_encoding(field_type); @@ -1115,7 +1115,7 @@ enum bt_component_status print_sequence(struct text_component *text, enum bt_component_status ret = BT_COMPONENT_STATUS_OK; struct bt_ctf_field_type *seq_type = NULL, *field_type = NULL; struct bt_ctf_field *length_field = NULL; - enum bt_ctf_type_id type_id; + enum bt_ctf_field_type_id type_id; uint64_t len; uint64_t i; bool is_string = false; @@ -1140,7 +1140,7 @@ enum bt_component_status print_sequence(struct text_component *text, goto end; } type_id = bt_ctf_field_type_get_type_id(field_type); - if (type_id == BT_CTF_TYPE_ID_INTEGER) { + if (type_id == BT_CTF_FIELD_TYPE_ID_INTEGER) { enum bt_ctf_string_encoding encoding; encoding = bt_ctf_field_type_integer_get_encoding(field_type); @@ -1261,7 +1261,7 @@ enum bt_component_status print_field(struct text_component *text, struct bt_ctf_field *field, bool print_names, GQuark *filter_fields, int filter_array_len) { - enum bt_ctf_type_id type_id; + enum bt_ctf_field_type_id type_id; type_id = bt_ctf_field_get_type_id(field); switch (type_id) { diff --git a/plugins/utils/trimmer/copy.c b/plugins/utils/trimmer/copy.c index c485448e..9d0d8141 100644 --- a/plugins/utils/trimmer/copy.c +++ b/plugins/utils/trimmer/copy.c @@ -121,7 +121,7 @@ enum bt_component_status update_packet_context_field(FILE *err, BT_PUT(field); continue; } - if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_TYPE_ID_INTEGER) { + if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_INTEGER) { fprintf(err, "[error] Unexpected packet context field type\n"); goto error; } diff --git a/tests/lib/test_ctf_writer.c b/tests/lib/test_ctf_writer.c index d139b4ff..eca6a310 100644 --- a/tests/lib/test_ctf_writer.c +++ b/tests/lib/test_ctf_writer.c @@ -1800,10 +1800,10 @@ void type_field_tests() "bt_ctf_field_type_get_byte_order handles NULL correctly"); ok(bt_ctf_field_type_get_type_id(NULL) == - BT_CTF_TYPE_ID_UNKNOWN, + BT_CTF_FIELD_TYPE_ID_UNKNOWN, "bt_ctf_field_type_get_type_id handles NULL correctly"); ok(bt_ctf_field_type_get_type_id(uint_12_type) == - BT_CTF_TYPE_ID_INTEGER, + BT_CTF_FIELD_TYPE_ID_INTEGER, "bt_ctf_field_type_get_type_id returns a correct value with an integer type"); ok(bt_ctf_field_type_integer_get_base(NULL) == @@ -1840,7 +1840,7 @@ void type_field_tests() bt_ctf_field_type_sequence_create(int_16_type, "seq_len"); ok(sequence_type, "Create a sequence of int16_t type"); ok(bt_ctf_field_type_get_type_id(sequence_type) == - BT_CTF_TYPE_ID_SEQUENCE, + BT_CTF_FIELD_TYPE_ID_SEQUENCE, "bt_ctf_field_type_get_type_id returns a correct value with a sequence type"); ok(bt_ctf_field_type_sequence_get_length_field_name(NULL) == NULL, @@ -1878,7 +1878,7 @@ void type_field_tests() structure_seq_type = bt_ctf_field_type_structure_create(); ok(bt_ctf_field_type_get_type_id(structure_seq_type) == - BT_CTF_TYPE_ID_STRUCT, + BT_CTF_FIELD_TYPE_ID_STRUCT, "bt_ctf_field_type_get_type_id returns a correct value with a structure type"); ok(structure_seq_type, "Create a structure type"); ok(bt_ctf_field_type_structure_add_field(structure_seq_type, @@ -3166,7 +3166,7 @@ int main(int argc, char **argv) stream_class); ok(ret_field_type, "bt_ctf_stream_class_get_event_header_type returns an event header type"); - ok(bt_ctf_field_type_get_type_id(ret_field_type) == BT_CTF_TYPE_ID_STRUCT, + ok(bt_ctf_field_type_get_type_id(ret_field_type) == BT_CTF_FIELD_TYPE_ID_STRUCT, "Default event header type is a structure"); event_header_field_type = bt_ctf_field_type_structure_get_field_type_by_name( @@ -3174,7 +3174,7 @@ int main(int argc, char **argv) ok(event_header_field_type, "Default event header type contains an \"id\" field"); ok(bt_ctf_field_type_get_type_id( - event_header_field_type) == BT_CTF_TYPE_ID_INTEGER, + event_header_field_type) == BT_CTF_FIELD_TYPE_ID_INTEGER, "Default event header \"id\" field is an integer"); bt_put(event_header_field_type); event_header_field_type = @@ -3183,7 +3183,7 @@ int main(int argc, char **argv) ok(event_header_field_type, "Default event header type contains a \"timestamp\" field"); ok(bt_ctf_field_type_get_type_id( - event_header_field_type) == BT_CTF_TYPE_ID_INTEGER, + event_header_field_type) == BT_CTF_FIELD_TYPE_ID_INTEGER, "Default event header \"timestamp\" field is an integer"); bt_put(event_header_field_type); bt_put(ret_field_type); @@ -3194,7 +3194,7 @@ int main(int argc, char **argv) packet_header_type = bt_ctf_trace_get_packet_header_type(trace); ok(packet_header_type, "bt_ctf_trace_get_packet_header_type returns a packet header"); - ok(bt_ctf_field_type_get_type_id(packet_header_type) == BT_CTF_TYPE_ID_STRUCT, + ok(bt_ctf_field_type_get_type_id(packet_header_type) == BT_CTF_FIELD_TYPE_ID_STRUCT, "bt_ctf_trace_get_packet_header_type returns a packet header of type struct"); ret_field_type = bt_ctf_field_type_structure_get_field_type_by_name( packet_header_type, "magic"); @@ -3226,7 +3226,7 @@ int main(int argc, char **argv) packet_context_type = bt_ctf_stream_class_get_packet_context_type(stream_class); ok(packet_context_type, "bt_ctf_stream_class_get_packet_context_type returns a packet context type."); - ok(bt_ctf_field_type_get_type_id(packet_context_type) == BT_CTF_TYPE_ID_STRUCT, + ok(bt_ctf_field_type_get_type_id(packet_context_type) == BT_CTF_FIELD_TYPE_ID_STRUCT, "Packet context is a structure"); ok(bt_ctf_stream_class_set_packet_context_type(NULL, packet_context_type), -- 2.34.1