rem_(g_quark_to_string(definition->name)));
}
- if (elem->id == CTF_TYPE_INTEGER) {
+ if (elem->id == BT_CTF_TYPE_ID_INTEGER) {
struct declaration_integer *integer_declaration =
container_of(elem, struct declaration_integer, p);
rem_(g_quark_to_string(definition->name)));
}
- if (elem->id == CTF_TYPE_INTEGER) {
+ if (elem->id == BT_CTF_TYPE_ID_INTEGER) {
struct declaration_integer *integer_declaration =
container_of(elem, struct declaration_integer, p);
static
rw_dispatch read_dispatch_table[] = {
- [ CTF_TYPE_INTEGER ] = ctf_integer_read,
- [ CTF_TYPE_FLOAT ] = ctf_float_read,
- [ CTF_TYPE_ENUM ] = ctf_enum_read,
- [ CTF_TYPE_STRING ] = ctf_string_read,
- [ CTF_TYPE_STRUCT ] = ctf_struct_rw,
- [ CTF_TYPE_VARIANT ] = ctf_variant_rw,
- [ CTF_TYPE_ARRAY ] = ctf_array_read,
- [ CTF_TYPE_SEQUENCE ] = ctf_sequence_read,
+ [ BT_CTF_TYPE_ID_INTEGER ] = ctf_integer_read,
+ [ BT_CTF_TYPE_ID_FLOAT ] = ctf_float_read,
+ [ BT_CTF_TYPE_ID_ENUM ] = ctf_enum_read,
+ [ BT_CTF_TYPE_ID_STRING ] = ctf_string_read,
+ [ BT_CTF_TYPE_ID_STRUCT ] = ctf_struct_rw,
+ [ BT_CTF_TYPE_ID_VARIANT ] = ctf_variant_rw,
+ [ BT_CTF_TYPE_ID_ARRAY ] = ctf_array_read,
+ [ BT_CTF_TYPE_ID_SEQUENCE ] = ctf_sequence_read,
};
static
rw_dispatch write_dispatch_table[] = {
- [ CTF_TYPE_INTEGER ] = ctf_integer_write,
- [ CTF_TYPE_FLOAT ] = ctf_float_write,
- [ CTF_TYPE_ENUM ] = ctf_enum_write,
- [ CTF_TYPE_STRING ] = ctf_string_write,
- [ CTF_TYPE_STRUCT ] = ctf_struct_rw,
- [ CTF_TYPE_VARIANT ] = ctf_variant_rw,
- [ CTF_TYPE_ARRAY ] = ctf_array_write,
- [ CTF_TYPE_SEQUENCE ] = ctf_sequence_write,
+ [ BT_CTF_TYPE_ID_INTEGER ] = ctf_integer_write,
+ [ BT_CTF_TYPE_ID_FLOAT ] = ctf_float_write,
+ [ BT_CTF_TYPE_ID_ENUM ] = ctf_enum_write,
+ [ BT_CTF_TYPE_ID_STRING ] = ctf_string_write,
+ [ BT_CTF_TYPE_ID_STRUCT ] = ctf_struct_rw,
+ [ BT_CTF_TYPE_ID_VARIANT ] = ctf_variant_rw,
+ [ BT_CTF_TYPE_ID_ARRAY ] = ctf_array_write,
+ [ BT_CTF_TYPE_ID_SEQUENCE ] = ctf_sequence_write,
};
static
}
default:
goto warning;
-
+
}
/* eventually return an error instead of warning */
uint8_t uuidval[BABELTRACE_UUID_LEN];
field = bt_struct_definition_get_field_from_index(file_stream->parent.trace_packet_header, len_index);
- assert(field->declaration->id == CTF_TYPE_ARRAY);
+ assert(field->declaration->id == BT_CTF_TYPE_ID_ARRAY);
defarray = container_of(field, struct definition_array, p);
assert(bt_array_len(defarray) == BABELTRACE_UUID_LEN);
ret = -EINVAL;
goto error;
}
- stream->trace_packet_header =
+ stream->trace_packet_header =
container_of(definition, struct definition_struct, p);
stream->parent_def_scope = stream->trace_packet_header->p.scope;
}
static
struct bt_ctf_field *(* const field_create_funcs[])(
struct bt_ctf_field_type *) = {
- [CTF_TYPE_INTEGER] = bt_ctf_field_integer_create,
- [CTF_TYPE_ENUM] = bt_ctf_field_enumeration_create,
- [CTF_TYPE_FLOAT] =
+ [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_floating_point_create,
- [CTF_TYPE_STRUCT] = bt_ctf_field_structure_create,
- [CTF_TYPE_VARIANT] = bt_ctf_field_variant_create,
- [CTF_TYPE_ARRAY] = bt_ctf_field_array_create,
- [CTF_TYPE_SEQUENCE] = bt_ctf_field_sequence_create,
- [CTF_TYPE_STRING] = bt_ctf_field_string_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,
};
static
void (* const field_destroy_funcs[])(struct bt_ctf_field *) = {
- [CTF_TYPE_INTEGER] = bt_ctf_field_integer_destroy,
- [CTF_TYPE_ENUM] = bt_ctf_field_enumeration_destroy,
- [CTF_TYPE_FLOAT] =
+ [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_floating_point_destroy,
- [CTF_TYPE_STRUCT] = bt_ctf_field_structure_destroy,
- [CTF_TYPE_VARIANT] = bt_ctf_field_variant_destroy,
- [CTF_TYPE_ARRAY] = bt_ctf_field_array_destroy,
- [CTF_TYPE_SEQUENCE] = bt_ctf_field_sequence_destroy,
- [CTF_TYPE_STRING] = bt_ctf_field_string_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,
};
static
int (* const field_validate_funcs[])(struct bt_ctf_field *) = {
- [CTF_TYPE_INTEGER] = bt_ctf_field_generic_validate,
- [CTF_TYPE_ENUM] = bt_ctf_field_enumeration_validate,
- [CTF_TYPE_FLOAT] = bt_ctf_field_generic_validate,
- [CTF_TYPE_STRUCT] = bt_ctf_field_structure_validate,
- [CTF_TYPE_VARIANT] = bt_ctf_field_variant_validate,
- [CTF_TYPE_ARRAY] = bt_ctf_field_array_validate,
- [CTF_TYPE_SEQUENCE] = bt_ctf_field_sequence_validate,
- [CTF_TYPE_STRING] = bt_ctf_field_generic_validate,
+ [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,
};
static
int (* const field_reset_funcs[])(struct bt_ctf_field *) = {
- [CTF_TYPE_INTEGER] = bt_ctf_field_generic_reset,
- [CTF_TYPE_ENUM] = bt_ctf_field_enumeration_reset,
- [CTF_TYPE_FLOAT] = bt_ctf_field_generic_reset,
- [CTF_TYPE_STRUCT] = bt_ctf_field_structure_reset,
- [CTF_TYPE_VARIANT] = bt_ctf_field_variant_reset,
- [CTF_TYPE_ARRAY] = bt_ctf_field_array_reset,
- [CTF_TYPE_SEQUENCE] = bt_ctf_field_sequence_reset,
- [CTF_TYPE_STRING] = bt_ctf_field_string_reset,
+ [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,
};
static
int (* const field_serialize_funcs[])(struct bt_ctf_field *,
struct ctf_stream_pos *) = {
- [CTF_TYPE_INTEGER] = bt_ctf_field_integer_serialize,
- [CTF_TYPE_ENUM] = bt_ctf_field_enumeration_serialize,
- [CTF_TYPE_FLOAT] =
+ [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_floating_point_serialize,
- [CTF_TYPE_STRUCT] = bt_ctf_field_structure_serialize,
- [CTF_TYPE_VARIANT] = bt_ctf_field_variant_serialize,
- [CTF_TYPE_ARRAY] = bt_ctf_field_array_serialize,
- [CTF_TYPE_SEQUENCE] = bt_ctf_field_sequence_serialize,
- [CTF_TYPE_STRING] = bt_ctf_field_string_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,
};
static
int (* const field_copy_funcs[])(struct bt_ctf_field *,
struct bt_ctf_field *) = {
- [CTF_TYPE_INTEGER] = bt_ctf_field_integer_copy,
- [CTF_TYPE_ENUM] = bt_ctf_field_enumeration_copy,
- [CTF_TYPE_FLOAT] = bt_ctf_field_floating_point_copy,
- [CTF_TYPE_STRUCT] = bt_ctf_field_structure_copy,
- [CTF_TYPE_VARIANT] = bt_ctf_field_variant_copy,
- [CTF_TYPE_ARRAY] = bt_ctf_field_array_copy,
- [CTF_TYPE_SEQUENCE] = bt_ctf_field_sequence_copy,
- [CTF_TYPE_STRING] = bt_ctf_field_string_copy,
+ [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,
};
struct bt_ctf_field *bt_ctf_field_create(struct bt_ctf_field_type *type)
{
struct bt_ctf_field *field = NULL;
- enum ctf_type_id type_id;
+ enum bt_ctf_type_id type_id;
int ret;
if (!type) {
}
type_id = bt_ctf_field_type_get_type_id(type);
- if (type_id <= CTF_TYPE_UNKNOWN || type_id >= NR_CTF_TYPES) {
+ if (type_id <= BT_CTF_TYPE_ID_UNKNOWN ||
+ type_id >= BT_CTF_NR_TYPE_IDS) {
goto error;
}
return ret;
}
-enum ctf_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field)
+enum bt_ctf_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field)
{
- enum ctf_type_id ret = CTF_TYPE_UNKNOWN;
+ enum bt_ctf_type_id ret = BT_CTF_TYPE_ID_UNKNOWN;
if (!field) {
goto end;
int bt_ctf_field_is_integer(struct bt_ctf_field *field)
{
- return bt_ctf_field_get_type_id(field) == CTF_TYPE_INTEGER;
+ return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_INTEGER;
}
int bt_ctf_field_is_floating_point(struct bt_ctf_field *field)
{
- return bt_ctf_field_get_type_id(field) == CTF_TYPE_FLOAT;
+ return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_FLOAT;
}
int bt_ctf_field_is_enumeration(struct bt_ctf_field *field)
{
- return bt_ctf_field_get_type_id(field) == CTF_TYPE_ENUM;
+ return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_ENUM;
}
int bt_ctf_field_is_string(struct bt_ctf_field *field)
{
- return bt_ctf_field_get_type_id(field) == CTF_TYPE_STRING;
+ return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_STRING;
}
int bt_ctf_field_is_structure(struct bt_ctf_field *field)
{
- return bt_ctf_field_get_type_id(field) == CTF_TYPE_STRUCT;
+ return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_STRUCT;
}
int bt_ctf_field_is_array(struct bt_ctf_field *field)
{
- return bt_ctf_field_get_type_id(field) == CTF_TYPE_ARRAY;
+ return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_ARRAY;
}
int bt_ctf_field_is_sequence(struct bt_ctf_field *field)
{
- return bt_ctf_field_get_type_id(field) == CTF_TYPE_SEQUENCE;
+ return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_SEQUENCE;
}
int bt_ctf_field_is_variant(struct bt_ctf_field *field)
{
- return bt_ctf_field_get_type_id(field) == CTF_TYPE_VARIANT;
+ return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_VARIANT;
}
struct bt_ctf_field *bt_ctf_field_sequence_get_length(
}
if (bt_ctf_field_type_get_type_id(field->type) !=
- CTF_TYPE_SEQUENCE) {
+ BT_CTF_TYPE_ID_SEQUENCE) {
goto end;
}
goto end;
}
if (bt_ctf_field_type_get_type_id(length_field->type) !=
- CTF_TYPE_INTEGER) {
+ BT_CTF_TYPE_ID_INTEGER) {
ret = -1;
goto end;
}
if (!field || !name ||
bt_ctf_field_type_get_type_id(field->type) !=
- CTF_TYPE_STRUCT) {
+ BT_CTF_TYPE_ID_STRUCT) {
goto error;
}
struct bt_ctf_field *ret_field = NULL;
if (!field ||
- bt_ctf_field_type_get_type_id(field->type) != CTF_TYPE_STRUCT) {
+ bt_ctf_field_type_get_type_id(field->type) !=
+ BT_CTF_TYPE_ID_STRUCT) {
goto end;
}
if (!field || !name || !value ||
bt_ctf_field_type_get_type_id(field->type) !=
- CTF_TYPE_STRUCT) {
+ BT_CTF_TYPE_ID_STRUCT) {
ret = -1;
goto end;
}
struct bt_ctf_field_array *array;
if (!field || bt_ctf_field_type_get_type_id(field->type) !=
- CTF_TYPE_ARRAY) {
+ BT_CTF_TYPE_ID_ARRAY) {
goto end;
}
struct bt_ctf_field_sequence *sequence;
if (!field || bt_ctf_field_type_get_type_id(field->type) !=
- CTF_TYPE_SEQUENCE) {
+ BT_CTF_TYPE_ID_SEQUENCE) {
goto end;
}
if (!field || !tag_field ||
bt_ctf_field_type_get_type_id(field->type) !=
- CTF_TYPE_VARIANT ||
+ BT_CTF_TYPE_ID_VARIANT ||
bt_ctf_field_type_get_type_id(tag_field->type) !=
- CTF_TYPE_ENUM) {
+ BT_CTF_TYPE_ID_ENUM) {
goto end;
}
if (!variant_field ||
bt_ctf_field_type_get_type_id(variant_field->type) !=
- CTF_TYPE_VARIANT) {
+ BT_CTF_TYPE_ID_VARIANT) {
goto end;
}
struct bt_ctf_field_enumeration *enumeration;
if (!field || bt_ctf_field_type_get_type_id(field->type) !=
- CTF_TYPE_ENUM) {
+ BT_CTF_TYPE_ID_ENUM) {
goto end;
}
if (!field || !value || !field->payload_set ||
bt_ctf_field_type_get_type_id(field->type) !=
- CTF_TYPE_INTEGER) {
+ BT_CTF_TYPE_ID_INTEGER) {
ret = -1;
goto end;
}
if (!field ||
bt_ctf_field_type_get_type_id(field->type) !=
- CTF_TYPE_INTEGER) {
+ BT_CTF_TYPE_ID_INTEGER) {
ret = -1;
goto end;
}
if (!field || !value || !field->payload_set ||
bt_ctf_field_type_get_type_id(field->type) !=
- CTF_TYPE_INTEGER) {
+ BT_CTF_TYPE_ID_INTEGER) {
ret = -1;
goto end;
}
if (!field ||
bt_ctf_field_type_get_type_id(field->type) !=
- CTF_TYPE_INTEGER) {
+ BT_CTF_TYPE_ID_INTEGER) {
ret = -1;
goto end;
}
if (!field || !value || !field->payload_set ||
bt_ctf_field_type_get_type_id(field->type) !=
- CTF_TYPE_FLOAT) {
+ BT_CTF_TYPE_ID_FLOAT) {
ret = -1;
goto end;
}
if (!field ||
bt_ctf_field_type_get_type_id(field->type) !=
- CTF_TYPE_FLOAT) {
+ BT_CTF_TYPE_ID_FLOAT) {
ret = -1;
goto end;
}
if (!field || !field->payload_set ||
bt_ctf_field_type_get_type_id(field->type) !=
- CTF_TYPE_STRING) {
+ BT_CTF_TYPE_ID_STRING) {
goto end;
}
if (!field || !value ||
bt_ctf_field_type_get_type_id(field->type) !=
- CTF_TYPE_STRING) {
+ BT_CTF_TYPE_ID_STRING) {
ret = -1;
goto end;
}
if (!field || !value ||
bt_ctf_field_type_get_type_id(field->type) !=
- CTF_TYPE_STRING) {
+ BT_CTF_TYPE_ID_STRING) {
ret = -1;
goto end;
}
if (!field || !value ||
bt_ctf_field_type_get_type_id(field->type) !=
- CTF_TYPE_STRING) {
+ BT_CTF_TYPE_ID_STRING) {
ret = -1;
goto end;
}
int bt_ctf_field_validate(struct bt_ctf_field *field)
{
int ret = 0;
- enum ctf_type_id type_id;
+ enum bt_ctf_type_id type_id;
if (!field) {
ret = -1;
}
type_id = bt_ctf_field_type_get_type_id(field->type);
- if (type_id <= CTF_TYPE_UNKNOWN || type_id >= NR_CTF_TYPES) {
+ if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) {
ret = -1;
goto end;
}
int bt_ctf_field_reset(struct bt_ctf_field *field)
{
int ret = 0;
- enum ctf_type_id type_id;
+ enum bt_ctf_type_id type_id;
if (!field) {
ret = -1;
}
type_id = bt_ctf_field_type_get_type_id(field->type);
- if (type_id <= CTF_TYPE_UNKNOWN || type_id >= NR_CTF_TYPES) {
+ if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) {
ret = -1;
goto end;
}
struct ctf_stream_pos *pos)
{
int ret = 0;
- enum ctf_type_id type_id;
+ enum bt_ctf_type_id type_id;
if (!field || !pos) {
ret = -1;
}
type_id = bt_ctf_field_type_get_type_id(field->type);
- if (type_id <= CTF_TYPE_UNKNOWN || type_id >= NR_CTF_TYPES) {
+ if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) {
ret = -1;
goto end;
}
{
int ret;
struct bt_ctf_field *copy = NULL;
- enum ctf_type_id type_id;
+ enum bt_ctf_type_id type_id;
if (!field) {
goto end;
}
type_id = bt_ctf_field_type_get_type_id(field->type);
- if (type_id <= CTF_TYPE_UNKNOWN || type_id >= NR_CTF_TYPES) {
+ if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) {
goto end;
}
{
struct bt_ctf_field *field;
struct bt_ctf_field_type *type;
- enum ctf_type_id type_id;
+ enum bt_ctf_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 <= CTF_TYPE_UNKNOWN ||
- type_id >= NR_CTF_TYPES) {
+ if (type_id <= BT_CTF_TYPE_ID_UNKNOWN ||
+ type_id >= BT_CTF_NR_TYPE_IDS) {
return;
}
static
void (* const type_destroy_funcs[])(struct bt_ctf_field_type *) = {
- [CTF_TYPE_INTEGER] = bt_ctf_field_type_integer_destroy,
- [CTF_TYPE_ENUM] =
+ [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_destroy,
+ [BT_CTF_TYPE_ID_ENUM] =
bt_ctf_field_type_enumeration_destroy,
- [CTF_TYPE_FLOAT] =
+ [BT_CTF_TYPE_ID_FLOAT] =
bt_ctf_field_type_floating_point_destroy,
- [CTF_TYPE_STRUCT] = bt_ctf_field_type_structure_destroy,
- [CTF_TYPE_VARIANT] = bt_ctf_field_type_variant_destroy,
- [CTF_TYPE_ARRAY] = bt_ctf_field_type_array_destroy,
- [CTF_TYPE_SEQUENCE] = bt_ctf_field_type_sequence_destroy,
- [CTF_TYPE_STRING] = bt_ctf_field_type_string_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,
};
static
static
type_freeze_func const type_freeze_funcs[] = {
- [CTF_TYPE_INTEGER] = generic_field_type_freeze,
- [CTF_TYPE_ENUM] = bt_ctf_field_type_enumeration_freeze,
- [CTF_TYPE_FLOAT] = generic_field_type_freeze,
- [CTF_TYPE_STRUCT] = bt_ctf_field_type_structure_freeze,
- [CTF_TYPE_VARIANT] = bt_ctf_field_type_variant_freeze,
- [CTF_TYPE_ARRAY] = bt_ctf_field_type_array_freeze,
- [CTF_TYPE_SEQUENCE] = bt_ctf_field_type_sequence_freeze,
- [CTF_TYPE_STRING] = generic_field_type_freeze,
+ [BT_CTF_TYPE_ID_INTEGER] = generic_field_type_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,
};
static
static
type_serialize_func const type_serialize_funcs[] = {
- [CTF_TYPE_INTEGER] = bt_ctf_field_type_integer_serialize,
- [CTF_TYPE_ENUM] =
+ [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_serialize,
+ [BT_CTF_TYPE_ID_ENUM] =
bt_ctf_field_type_enumeration_serialize,
- [CTF_TYPE_FLOAT] =
+ [BT_CTF_TYPE_ID_FLOAT] =
bt_ctf_field_type_floating_point_serialize,
- [CTF_TYPE_STRUCT] =
+ [BT_CTF_TYPE_ID_STRUCT] =
bt_ctf_field_type_structure_serialize,
- [CTF_TYPE_VARIANT] = bt_ctf_field_type_variant_serialize,
- [CTF_TYPE_ARRAY] = bt_ctf_field_type_array_serialize,
- [CTF_TYPE_SEQUENCE] = bt_ctf_field_type_sequence_serialize,
- [CTF_TYPE_STRING] = bt_ctf_field_type_string_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,
};
static
static
void (* const set_byte_order_funcs[])(struct bt_ctf_field_type *,
int byte_order, int set_native) = {
- [CTF_TYPE_INTEGER] = bt_ctf_field_type_integer_set_byte_order,
- [CTF_TYPE_ENUM] =
+ [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_set_byte_order,
+ [BT_CTF_TYPE_ID_ENUM] =
bt_ctf_field_type_enumeration_set_byte_order,
- [CTF_TYPE_FLOAT] =
+ [BT_CTF_TYPE_ID_FLOAT] =
bt_ctf_field_type_floating_point_set_byte_order,
- [CTF_TYPE_STRUCT] =
+ [BT_CTF_TYPE_ID_STRUCT] =
bt_ctf_field_type_structure_set_byte_order,
- [CTF_TYPE_VARIANT] = bt_ctf_field_type_variant_set_byte_order,
- [CTF_TYPE_ARRAY] = bt_ctf_field_type_array_set_byte_order,
- [CTF_TYPE_SEQUENCE] = bt_ctf_field_type_sequence_set_byte_order,
- [CTF_TYPE_STRING] = NULL,
+ [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,
};
static
static
struct bt_ctf_field_type *(* const type_copy_funcs[])(
struct bt_ctf_field_type *) = {
- [CTF_TYPE_INTEGER] = bt_ctf_field_type_integer_copy,
- [CTF_TYPE_ENUM] = bt_ctf_field_type_enumeration_copy,
- [CTF_TYPE_FLOAT] = bt_ctf_field_type_floating_point_copy,
- [CTF_TYPE_STRUCT] = bt_ctf_field_type_structure_copy,
- [CTF_TYPE_VARIANT] = bt_ctf_field_type_variant_copy,
- [CTF_TYPE_ARRAY] = bt_ctf_field_type_array_copy,
- [CTF_TYPE_SEQUENCE] = bt_ctf_field_type_sequence_copy,
- [CTF_TYPE_STRING] = bt_ctf_field_type_string_copy,
+ [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,
};
static
static
int (* const type_compare_funcs[])(struct bt_ctf_field_type *,
struct bt_ctf_field_type *) = {
- [CTF_TYPE_INTEGER] = bt_ctf_field_type_integer_compare,
- [CTF_TYPE_ENUM] = bt_ctf_field_type_enumeration_compare,
- [CTF_TYPE_FLOAT] = bt_ctf_field_type_floating_point_compare,
- [CTF_TYPE_STRUCT] = bt_ctf_field_type_structure_compare,
- [CTF_TYPE_VARIANT] = bt_ctf_field_type_variant_compare,
- [CTF_TYPE_ARRAY] = bt_ctf_field_type_array_compare,
- [CTF_TYPE_SEQUENCE] = bt_ctf_field_type_sequence_compare,
- [CTF_TYPE_STRING] = bt_ctf_field_type_string_compare,
+ [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,
};
static
static
int (* const type_validate_funcs[])(struct bt_ctf_field_type *) = {
- [CTF_TYPE_INTEGER] = NULL,
- [CTF_TYPE_FLOAT] = NULL,
- [CTF_TYPE_STRING] = NULL,
- [CTF_TYPE_ENUM] = bt_ctf_field_type_enumeration_validate,
- [CTF_TYPE_STRUCT] = bt_ctf_field_type_structure_validate,
- [CTF_TYPE_VARIANT] = bt_ctf_field_type_variant_validate,
- [CTF_TYPE_ARRAY] = bt_ctf_field_type_array_validate,
- [CTF_TYPE_SEQUENCE] = bt_ctf_field_type_sequence_validate,
+ [BT_CTF_TYPE_ID_INTEGER] = NULL,
+ [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,
};
static
static
void bt_ctf_field_type_init(struct bt_ctf_field_type *type, int init_bo)
{
- enum ctf_type_id type_id = type->declaration->id;
+ enum bt_ctf_type_id type_id = type->declaration->id;
- assert(type && (type_id > CTF_TYPE_UNKNOWN) &&
- (type_id < NR_CTF_TYPES));
+ assert(type && (type_id > BT_CTF_TYPE_ID_UNKNOWN) &&
+ (type_id < BT_CTF_NR_TYPE_IDS));
bt_object_init(type, bt_ctf_field_type_destroy);
type->freeze = type_freeze_funcs[type_id];
void bt_ctf_field_type_destroy(struct bt_object *obj)
{
struct bt_ctf_field_type *type;
- enum ctf_type_id type_id;
+ enum bt_ctf_type_id type_id;
type = container_of(obj, struct bt_ctf_field_type, base);
type_id = type->declaration->id;
- if (type_id <= CTF_TYPE_UNKNOWN ||
- type_id >= NR_CTF_TYPES) {
+ if (type_id <= BT_CTF_TYPE_ID_UNKNOWN ||
+ type_id >= BT_CTF_NR_TYPE_IDS) {
return;
}
int bt_ctf_field_type_validate(struct bt_ctf_field_type *type)
{
int ret = 0;
- enum ctf_type_id id = bt_ctf_field_type_get_type_id(type);
+ enum bt_ctf_type_id id = bt_ctf_field_type_get_type_id(type);
if (!type) {
ret = -1;
}
integer->parent.declaration = &integer->declaration.p;
- integer->parent.declaration->id = CTF_TYPE_INTEGER;
+ integer->parent.declaration->id = BT_CTF_TYPE_ID_INTEGER;
integer->declaration.len = size;
integer->declaration.base = BT_CTF_INTEGER_BASE_DECIMAL;
integer->declaration.encoding = BT_CTF_STRING_ENCODING_NONE;
int ret = 0;
struct bt_ctf_field_type_integer *integer;
- if (!type || type->declaration->id != CTF_TYPE_INTEGER) {
+ if (!type || type->declaration->id != BT_CTF_TYPE_ID_INTEGER) {
ret = -1;
goto end;
}
int ret = 0;
struct bt_ctf_field_type_integer *integer;
- if (!type || type->declaration->id != CTF_TYPE_INTEGER) {
+ if (!type || type->declaration->id != BT_CTF_TYPE_ID_INTEGER) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_integer *integer;
if (!type || type->frozen ||
- type->declaration->id != CTF_TYPE_INTEGER) {
+ type->declaration->id != BT_CTF_TYPE_ID_INTEGER) {
ret = -1;
goto end;
}
enum bt_ctf_integer_base ret = BT_CTF_INTEGER_BASE_UNKNOWN;
struct bt_ctf_field_type_integer *integer;
- if (!type || type->declaration->id != CTF_TYPE_INTEGER) {
+ if (!type || type->declaration->id != BT_CTF_TYPE_ID_INTEGER) {
goto end;
}
int ret = 0;
if (!type || type->frozen ||
- type->declaration->id != CTF_TYPE_INTEGER) {
+ type->declaration->id != BT_CTF_TYPE_ID_INTEGER) {
ret = -1;
goto end;
}
enum bt_ctf_string_encoding ret = BT_CTF_STRING_ENCODING_UNKNOWN;
struct bt_ctf_field_type_integer *integer;
- if (!type || type->declaration->id != CTF_TYPE_INTEGER) {
+ if (!type || type->declaration->id != BT_CTF_TYPE_ID_INTEGER) {
goto end;
}
struct bt_ctf_field_type_integer *integer;
if (!type || type->frozen ||
- (type->declaration->id != CTF_TYPE_INTEGER) ||
+ (type->declaration->id != BT_CTF_TYPE_ID_INTEGER) ||
(encoding < BT_CTF_STRING_ENCODING_NONE) ||
(encoding >= BT_CTF_STRING_ENCODING_UNKNOWN)) {
ret = -1;
goto error;
}
- if (integer_container_type->declaration->id != CTF_TYPE_INTEGER) {
+ if (integer_container_type->declaration->id != BT_CTF_TYPE_ID_INTEGER) {
goto error;
}
}
enumeration->parent.declaration = &enumeration->declaration.p;
- enumeration->parent.declaration->id = CTF_TYPE_ENUM;
+ enumeration->parent.declaration->id = BT_CTF_TYPE_ID_ENUM;
bt_get(integer_container_type);
enumeration->container = integer_container_type;
enumeration->entries = g_ptr_array_new_with_free_func(
goto end;
}
- if (type->declaration->id != CTF_TYPE_ENUM) {
+ if (type->declaration->id != BT_CTF_TYPE_ID_ENUM) {
goto end;
}
struct range_overlap_query query;
char *escaped_string;
- if (!type || (type->declaration->id != CTF_TYPE_ENUM) ||
+ if (!type || (type->declaration->id != BT_CTF_TYPE_ID_ENUM) ||
type->frozen ||
(range_end < range_start)) {
ret = -1;
struct range_overlap_query query;
char *escaped_string;
- if (!type || (type->declaration->id != CTF_TYPE_ENUM) ||
+ if (!type || (type->declaration->id != BT_CTF_TYPE_ID_ENUM) ||
type->frozen ||
(range_end < range_start)) {
ret = -1;
int ret = 0;
struct bt_ctf_field_type_enumeration *enumeration;
- if (!type || (type->declaration->id != CTF_TYPE_ENUM)) {
+ if (!type || (type->declaration->id != BT_CTF_TYPE_ID_ENUM)) {
ret = -1;
goto end;
}
int ret = 0;
if (!type || index < 0 || !string || !range_start || !range_end ||
- (type->declaration->id != CTF_TYPE_ENUM)) {
+ (type->declaration->id != BT_CTF_TYPE_ID_ENUM)) {
ret = -1;
goto end;
}
int ret = 0;
if (!type || index < 0 || !string || !range_start || !range_end ||
- (type->declaration->id != CTF_TYPE_ENUM)) {
+ (type->declaration->id != BT_CTF_TYPE_ID_ENUM)) {
ret = -1;
goto end;
}
int i, ret = 0;
if (!type || !name ||
- (type->declaration->id != CTF_TYPE_ENUM)) {
+ (type->declaration->id != BT_CTF_TYPE_ID_ENUM)) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_enumeration *enumeration;
int i, ret = 0;
- if (!type || (type->declaration->id != CTF_TYPE_ENUM)) {
+ if (!type || (type->declaration->id != BT_CTF_TYPE_ID_ENUM)) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_enumeration *enumeration;
int i, ret = 0;
- if (!type || (type->declaration->id != CTF_TYPE_ENUM)) {
+ if (!type || (type->declaration->id != BT_CTF_TYPE_ID_ENUM)) {
ret = -1;
goto end;
}
floating_point->declaration.exp = &floating_point->exp;
floating_point->sign.len = 1;
floating_point->parent.declaration = &floating_point->declaration.p;
- floating_point->parent.declaration->id = CTF_TYPE_FLOAT;
+ floating_point->parent.declaration->id = BT_CTF_TYPE_ID_FLOAT;
floating_point->declaration.exp->len =
sizeof(float) * CHAR_BIT - FLT_MANT_DIG;
floating_point->declaration.mantissa->len = FLT_MANT_DIG - 1;
int ret = 0;
struct bt_ctf_field_type_floating_point *floating_point;
- if (!type || (type->declaration->id != CTF_TYPE_FLOAT)) {
+ if (!type || (type->declaration->id != BT_CTF_TYPE_ID_FLOAT)) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_floating_point *floating_point;
if (!type || type->frozen ||
- (type->declaration->id != CTF_TYPE_FLOAT)) {
+ (type->declaration->id != BT_CTF_TYPE_ID_FLOAT)) {
ret = -1;
goto end;
}
int ret = 0;
struct bt_ctf_field_type_floating_point *floating_point;
- if (!type || (type->declaration->id != CTF_TYPE_FLOAT)) {
+ if (!type || (type->declaration->id != BT_CTF_TYPE_ID_FLOAT)) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_floating_point *floating_point;
if (!type || type->frozen ||
- (type->declaration->id != CTF_TYPE_FLOAT)) {
+ (type->declaration->id != BT_CTF_TYPE_ID_FLOAT)) {
ret = -1;
goto end;
}
}
structure->parent.declaration = &structure->declaration.p;
- structure->parent.declaration->id = CTF_TYPE_STRUCT;
+ structure->parent.declaration->id = BT_CTF_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);
if (!type || !field_type || type->frozen ||
bt_ctf_validate_identifier(field_name) ||
- (type->declaration->id != CTF_TYPE_STRUCT)) {
+ (type->declaration->id != BT_CTF_TYPE_ID_STRUCT)) {
ret = -1;
goto end;
}
int ret = 0;
struct bt_ctf_field_type_structure *structure;
- if (!type || (type->declaration->id != CTF_TYPE_STRUCT)) {
+ if (!type || (type->declaration->id != BT_CTF_TYPE_ID_STRUCT)) {
ret = -1;
goto end;
}
struct structure_field *field;
int ret = 0;
- if (!type || index < 0 || (type->declaration->id != CTF_TYPE_STRUCT)) {
+ if (!type || index < 0 ||
+ (type->declaration->id != BT_CTF_TYPE_ID_STRUCT)) {
ret = -1;
goto end;
}
}
variant->parent.declaration = &variant->declaration.p;
- variant->parent.declaration->id = CTF_TYPE_VARIANT;
+ variant->parent.declaration->id = BT_CTF_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(
struct bt_ctf_field_type_variant *variant;
struct bt_ctf_field_type *tag_type = NULL;
- if (!type || (type->declaration->id != CTF_TYPE_VARIANT)) {
+ if (!type || (type->declaration->id != BT_CTF_TYPE_ID_VARIANT)) {
goto end;
}
struct bt_ctf_field_type_variant *variant;
const char *tag_name = NULL;
- if (!type || (type->declaration->id != CTF_TYPE_VARIANT)) {
+ if (!type || (type->declaration->id != BT_CTF_TYPE_ID_VARIANT)) {
goto end;
}
struct bt_ctf_field_type_variant *variant;
if (!type || type->frozen ||
- (type->declaration->id != CTF_TYPE_VARIANT) ||
+ (type->declaration->id != BT_CTF_TYPE_ID_VARIANT) ||
bt_ctf_validate_identifier(name)) {
ret = -1;
goto end;
if (!type || !field_type || type->frozen ||
bt_ctf_validate_identifier(field_name) ||
- (type->declaration->id != CTF_TYPE_VARIANT)) {
+ (type->declaration->id != BT_CTF_TYPE_ID_VARIANT)) {
ret = -1;
goto end;
}
const char *enum_value;
struct bt_ctf_field_type *field_type = NULL;
- if (!type || !tag || type->declaration->id != CTF_TYPE_VARIANT) {
+ if (!type || !tag || type->declaration->id != BT_CTF_TYPE_ID_VARIANT) {
goto end;
}
int ret = 0;
struct bt_ctf_field_type_variant *variant;
- if (!type || (type->declaration->id != CTF_TYPE_VARIANT)) {
+ if (!type || (type->declaration->id != BT_CTF_TYPE_ID_VARIANT)) {
ret = -1;
goto end;
}
struct structure_field *field;
int ret = 0;
- if (!type || index < 0 || (type->declaration->id != CTF_TYPE_VARIANT)) {
+ if (!type || index < 0 ||
+ (type->declaration->id != BT_CTF_TYPE_ID_VARIANT)) {
ret = -1;
goto end;
}
}
array->parent.declaration = &array->declaration.p;
- array->parent.declaration->id = CTF_TYPE_ARRAY;
+ array->parent.declaration->id = BT_CTF_TYPE_ID_ARRAY;
bt_get(element_type);
array->element_type = element_type;
struct bt_ctf_field_type *ret = NULL;
struct bt_ctf_field_type_array *array;
- if (!type || (type->declaration->id != CTF_TYPE_ARRAY)) {
+ if (!type || (type->declaration->id != BT_CTF_TYPE_ID_ARRAY)) {
goto end;
}
struct bt_ctf_field_type_array *array;
if (!type || !element_type ||
- (type->declaration->id != CTF_TYPE_ARRAY)) {
+ (type->declaration->id != BT_CTF_TYPE_ID_ARRAY)) {
ret = -1;
goto end;
}
int64_t ret;
struct bt_ctf_field_type_array *array;
- if (!type || (type->declaration->id != CTF_TYPE_ARRAY)) {
+ if (!type || (type->declaration->id != BT_CTF_TYPE_ID_ARRAY)) {
ret = -1;
goto end;
}
}
sequence->parent.declaration = &sequence->declaration.p;
- sequence->parent.declaration->id = CTF_TYPE_SEQUENCE;
+ sequence->parent.declaration->id = BT_CTF_TYPE_ID_SEQUENCE;
bt_get(element_type);
sequence->element_type = element_type;
sequence->length_field_name = g_string_new(length_field_name);
struct bt_ctf_field_type *ret = NULL;
struct bt_ctf_field_type_sequence *sequence;
- if (!type || (type->declaration->id != CTF_TYPE_SEQUENCE)) {
+ if (!type || (type->declaration->id != BT_CTF_TYPE_ID_SEQUENCE)) {
goto end;
}
struct bt_ctf_field_type_sequence *sequence;
if (!type || !element_type ||
- (type->declaration->id != CTF_TYPE_SEQUENCE)) {
+ (type->declaration->id != BT_CTF_TYPE_ID_SEQUENCE)) {
ret = -1;
goto end;
}
const char *ret = NULL;
struct bt_ctf_field_type_sequence *sequence;
- if (!type || (type->declaration->id != CTF_TYPE_SEQUENCE)) {
+ if (!type || (type->declaration->id != BT_CTF_TYPE_ID_SEQUENCE)) {
goto end;
}
}
string->parent.declaration = &string->declaration.p;
- string->parent.declaration->id = CTF_TYPE_STRING;
+ string->parent.declaration->id = BT_CTF_TYPE_ID_STRING;
bt_ctf_field_type_init(&string->parent, TRUE);
string->declaration.encoding = BT_CTF_STRING_ENCODING_UTF8;
string->parent.declaration->alignment = CHAR_BIT;
struct bt_ctf_field_type_string *string;
enum bt_ctf_string_encoding ret = BT_CTF_STRING_ENCODING_UNKNOWN;
- if (!type || (type->declaration->id != CTF_TYPE_STRING)) {
+ if (!type || (type->declaration->id != BT_CTF_TYPE_ID_STRING)) {
goto end;
}
int ret = 0;
struct bt_ctf_field_type_string *string;
- if (!type || type->declaration->id != CTF_TYPE_STRING ||
+ if (!type || type->declaration->id != BT_CTF_TYPE_ID_STRING ||
(encoding != BT_CTF_STRING_ENCODING_UTF8 &&
encoding != BT_CTF_STRING_ENCODING_ASCII)) {
ret = -1;
int bt_ctf_field_type_get_alignment(struct bt_ctf_field_type *type)
{
int ret;
- enum ctf_type_id type_id;
+ enum bt_ctf_type_id type_id;
if (!type) {
ret = -1;
type_id = bt_ctf_field_type_get_type_id(type);
switch (type_id) {
- case CTF_TYPE_SEQUENCE:
+ case BT_CTF_TYPE_ID_SEQUENCE:
{
struct bt_ctf_field_type *element =
bt_ctf_field_type_sequence_get_element_type(type);
bt_put(element);
break;
}
- case CTF_TYPE_ARRAY:
+ case BT_CTF_TYPE_ID_ARRAY:
{
struct bt_ctf_field_type *element =
bt_ctf_field_type_array_get_element_type(type);
bt_put(element);
break;
}
- case CTF_TYPE_STRUCT:
+ case BT_CTF_TYPE_ID_STRUCT:
{
int i, element_count;
ret = (int) type->declaration->alignment;
break;
}
- case CTF_TYPE_UNKNOWN:
+ case BT_CTF_TYPE_ID_UNKNOWN:
ret = -1;
break;
default:
unsigned int alignment)
{
int ret = 0;
- enum ctf_type_id type_id;
+ enum bt_ctf_type_id type_id;
/* Alignment must be a power of two */
if (!type || type->frozen || !is_power_of_two(alignment)) {
}
type_id = bt_ctf_field_type_get_type_id(type);
- if (type_id == CTF_TYPE_UNKNOWN) {
+ if (type_id == BT_CTF_TYPE_ID_UNKNOWN) {
ret = -1;
goto end;
}
- if (type->declaration->id == CTF_TYPE_STRING &&
+ if (type->declaration->id == BT_CTF_TYPE_ID_STRING &&
alignment != CHAR_BIT) {
ret = -1;
goto end;
}
- if (type_id == CTF_TYPE_VARIANT || type_id == CTF_TYPE_SEQUENCE ||
- type_id == CTF_TYPE_ARRAY) {
+ if (type_id == BT_CTF_TYPE_ID_VARIANT ||
+ type_id == BT_CTF_TYPE_ID_SEQUENCE ||
+ type_id == BT_CTF_TYPE_ID_ARRAY) {
/* Setting an alignment on these types makes no sense */
ret = -1;
goto end;
}
switch (type->declaration->id) {
- case CTF_TYPE_INTEGER:
+ case BT_CTF_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 CTF_TYPE_FLOAT:
+ case BT_CTF_TYPE_ID_FLOAT:
{
struct bt_ctf_field_type_floating_point *floating_point =
container_of(type,
{
int ret = 0;
int internal_byte_order;
- enum ctf_type_id type_id;
+ enum bt_ctf_type_id type_id;
if (!type || type->frozen) {
ret = -1;
return ret;
}
-enum ctf_type_id bt_ctf_field_type_get_type_id(
+enum bt_ctf_type_id bt_ctf_field_type_get_type_id(
struct bt_ctf_field_type *type)
{
if (!type) {
- return CTF_TYPE_UNKNOWN;
+ return BT_CTF_TYPE_ID_UNKNOWN;
}
return type->declaration->id;
int bt_ctf_field_type_is_integer(struct bt_ctf_field_type *type)
{
- return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_INTEGER;
+ return bt_ctf_field_type_get_type_id(type) == BT_CTF_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) == CTF_TYPE_FLOAT;
+ return bt_ctf_field_type_get_type_id(type) == BT_CTF_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) == CTF_TYPE_ENUM;
+ return bt_ctf_field_type_get_type_id(type) == BT_CTF_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) == CTF_TYPE_STRING;
+ return bt_ctf_field_type_get_type_id(type) == BT_CTF_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) == CTF_TYPE_STRUCT;
+ return bt_ctf_field_type_get_type_id(type) == BT_CTF_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) == CTF_TYPE_ARRAY;
+ return bt_ctf_field_type_get_type_id(type) == BT_CTF_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) == CTF_TYPE_SEQUENCE;
+ return bt_ctf_field_type_get_type_id(type) == BT_CTF_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) == CTF_TYPE_VARIANT;
+ return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_VARIANT;
}
void bt_ctf_field_type_get(struct bt_ctf_field_type *type)
struct bt_ctf_field_type_structure *structure;
if (!type || !name ||
- bt_ctf_field_type_get_type_id(type) != CTF_TYPE_STRUCT) {
+ bt_ctf_field_type_get_type_id(type) != BT_CTF_TYPE_ID_STRUCT) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_structure *structure;
if (!type || !field ||
- bt_ctf_field_type_get_type_id(type) != CTF_TYPE_STRUCT) {
+ bt_ctf_field_type_get_type_id(type) != BT_CTF_TYPE_ID_STRUCT) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_variant *variant;
if (!type || !name ||
- bt_ctf_field_type_get_type_id(type) != CTF_TYPE_VARIANT) {
+ bt_ctf_field_type_get_type_id(type) != BT_CTF_TYPE_ID_VARIANT) {
ret = -1;
goto end;
}
int ret = 0;
struct bt_ctf_field_type_sequence *sequence;
- if (!type || bt_ctf_field_type_get_type_id(type) != CTF_TYPE_SEQUENCE) {
+ if (!type || bt_ctf_field_type_get_type_id(type) !=
+ BT_CTF_TYPE_ID_SEQUENCE) {
ret = -1;
goto end;
}
int ret = 0;
struct bt_ctf_field_type_variant *variant;
- if (!type || bt_ctf_field_type_get_type_id(type) != CTF_TYPE_VARIANT) {
+ if (!type || bt_ctf_field_type_get_type_id(type) !=
+ BT_CTF_TYPE_ID_VARIANT) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_variant *variant;
if (!type || !tag ||
- bt_ctf_field_type_get_type_id(tag) != CTF_TYPE_ENUM) {
+ bt_ctf_field_type_get_type_id(tag) !=
+ BT_CTF_TYPE_ID_ENUM) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_variant *variant;
if (!type || !field ||
- bt_ctf_field_type_get_type_id(type) != CTF_TYPE_VARIANT) {
+ bt_ctf_field_type_get_type_id(type) != BT_CTF_TYPE_ID_VARIANT) {
ret = -1;
goto end;
}
goto end;
}
- if (type_a->declaration->id == CTF_TYPE_UNKNOWN) {
+ if (type_a->declaration->id == BT_CTF_TYPE_ID_UNKNOWN) {
/* Both have unknown type IDs */
goto end;
}
int ret = 0;
if (!event_class || !payload ||
- bt_ctf_field_type_get_type_id(payload) != CTF_TYPE_STRUCT) {
+ bt_ctf_field_type_get_type_id(payload) !=
+ BT_CTF_TYPE_ID_STRUCT) {
ret = -1;
goto end;
}
}
if (bt_ctf_field_type_get_type_id(event_class->fields) !=
- CTF_TYPE_STRUCT) {
+ BT_CTF_TYPE_ID_STRUCT) {
ret = -1;
goto end;
}
}
if (bt_ctf_field_type_get_type_id(event_class->fields) !=
- CTF_TYPE_STRUCT) {
+ BT_CTF_TYPE_ID_STRUCT) {
ret = -1;
goto end;
}
}
if (bt_ctf_field_type_get_type_id(event_class->fields) !=
- CTF_TYPE_STRUCT) {
+ BT_CTF_TYPE_ID_STRUCT) {
ret = -1;
goto end;
}
}
if (bt_ctf_field_type_get_type_id(event_class->fields) !=
- CTF_TYPE_STRUCT) {
+ BT_CTF_TYPE_ID_STRUCT) {
goto end;
}
goto end;
}
- if (bt_ctf_field_type_get_type_id(context) != CTF_TYPE_STRUCT) {
+ if (bt_ctf_field_type_get_type_id(context) != BT_CTF_TYPE_ID_STRUCT) {
ret = -1;
goto end;
}
goto end;
}
- if (bt_ctf_field_type_get_type_id(payload_type) != CTF_TYPE_STRUCT) {
+ if (bt_ctf_field_type_get_type_id(payload_type) !=
+ BT_CTF_TYPE_ID_STRUCT) {
ret = -1;
goto end;
}
field_type = bt_ctf_field_get_type(field);
assert(field_type);
- if (bt_ctf_field_type_get_type_id(field_type) != CTF_TYPE_INTEGER) {
+ if (bt_ctf_field_type_get_type_id(field_type) !=
+ BT_CTF_TYPE_ID_INTEGER) {
/* Not an integer and the value is unset, error. */
ret = -1;
goto end;
goto end;
}
if (bt_ctf_field_type_get_type_id(packet_context_type) !=
- CTF_TYPE_STRUCT) {
+ BT_CTF_TYPE_ID_STRUCT) {
/* A packet context must be a structure */
ret = -1;
goto end;
goto end;
}
if (bt_ctf_field_type_get_type_id(event_header_type) !=
- CTF_TYPE_STRUCT) {
+ BT_CTF_TYPE_ID_STRUCT) {
/* An event header must be a structure */
ret = -1;
goto end;
}
if (bt_ctf_field_type_get_type_id(event_context_type) !=
- CTF_TYPE_STRUCT) {
+ BT_CTF_TYPE_ID_STRUCT) {
/* A packet context must be a structure */
ret = -1;
goto end;
assert(magic_field_type);
if (bt_ctf_field_type_get_type_id(magic_field_type) !=
- CTF_TYPE_INTEGER) {
+ BT_CTF_TYPE_ID_INTEGER) {
/* Magic field is not an integer. Not an error, skip. */
goto end;
}
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) !=
- CTF_TYPE_ARRAY) {
+ BT_CTF_TYPE_ID_ARRAY) {
/* UUID field is not an array. Not an error, skip. */
goto end;
}
uuid_field_type);
assert(element_field_type);
if (bt_ctf_field_type_get_type_id(element_field_type) !=
- CTF_TYPE_INTEGER) {
+ BT_CTF_TYPE_ID_INTEGER) {
/* UUID array elements are not integers. Not an error, skip */
goto end;
}
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) !=
- CTF_TYPE_INTEGER) {
+ BT_CTF_TYPE_ID_INTEGER) {
/* stream_id field is not an integer. Not an error, skip. */
goto end;
}
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) !=
- CTF_TYPE_INTEGER) {
+ BT_CTF_TYPE_ID_INTEGER) {
ret = -1;
goto end;
}
field_type = bt_ctf_field_get_type(integer);
/* Something is serioulsly wrong */
assert(field_type);
- if (bt_ctf_field_type_get_type_id(field_type) != CTF_TYPE_INTEGER) {
+ if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_TYPE_ID_INTEGER) {
/*
* The user most likely meant for us to populate this field
* automatically. However, we can only do this if the field
/* packet_header_type must be a structure */
if (bt_ctf_field_type_get_type_id(packet_header_type) !=
- CTF_TYPE_STRUCT) {
+ BT_CTF_TYPE_ID_STRUCT) {
ret = -1;
goto end;
}
int field_type_contains_sequence_or_variant_ft(struct bt_ctf_field_type *type)
{
int ret = 0;
- enum ctf_type_id type_id = bt_ctf_field_type_get_type_id(type);
+ enum bt_ctf_type_id type_id = bt_ctf_field_type_get_type_id(type);
switch (type_id) {
- case CTF_TYPE_SEQUENCE:
- case CTF_TYPE_VARIANT:
+ case BT_CTF_TYPE_ID_SEQUENCE:
+ case BT_CTF_TYPE_ID_VARIANT:
ret = 1;
goto end;
- case CTF_TYPE_ARRAY:
- case CTF_TYPE_STRUCT:
+ case BT_CTF_TYPE_ID_ARRAY:
+ case BT_CTF_TYPE_ID_STRUCT:
{
int i;
int field_count = bt_ctf_field_type_get_field_count(type);
fprintf(fd, "[error] %s: cannot find typealias \"%s\".\n", __func__, g_quark_to_string(alias_q));
return NULL;
}
- if (nested_declaration->id == CTF_TYPE_INTEGER) {
+ if (nested_declaration->id == BT_CTF_TYPE_ID_INTEGER) {
struct declaration_integer *integer_declaration =
container_of(nested_declaration, struct declaration_integer, p);
/* For base to 16 for pointers (expected pretty-print) */
fprintf(fd, "[error] %s: expecting length field reference or value.\n", __func__);
return NULL;
}
- first = _bt_list_first_entry(&node_type_declarator->u.type_declarator.u.nested.length,
+ first = _bt_list_first_entry(&node_type_declarator->u.type_declarator.u.nested.length,
struct ctf_node, siblings);
if (first->type != NODE_UNARY_EXPRESSION) {
return NULL;
* Don't allow typedef and typealias of untagged
* variants.
*/
- if (type_declaration->id == CTF_TYPE_UNTAGGED_VARIANT) {
+ if (type_declaration->id == BT_CTF_TYPE_ID_UNTAGGED_VARIANT) {
fprintf(fd, "[error] %s: typedef of untagged variant is not permitted.\n", __func__);
bt_declaration_unref(type_declaration);
return -EPERM;
* Don't allow typedef and typealias of untagged
* variants.
*/
- if (type_declaration->id == CTF_TYPE_UNTAGGED_VARIANT) {
+ if (type_declaration->id == BT_CTF_TYPE_ID_UNTAGGED_VARIANT) {
fprintf(fd, "[error] %s: typedef of untagged variant is not permitted.\n", __func__);
bt_declaration_unref(type_declaration);
return -EPERM;
fprintf(fd, "[error] %s: unable to create container type for enumeration\n", __func__);
return NULL;
}
- if (declaration->id != CTF_TYPE_INTEGER) {
+ if (declaration->id != BT_CTF_TYPE_ID_INTEGER) {
fprintf(fd, "[error] %s: container type for enumeration is not integer\n", __func__);
return NULL;
}
switch (right->u.unary_expression.type) {
case UNARY_UNSIGNED_CONSTANT:
switch (right->u.unary_expression.u.unsigned_constant) {
- case 2:
+ case 2:
case 8:
case 10:
case 16:
ret = -EPERM;
goto error;
}
- if (declaration->id != CTF_TYPE_STRUCT) {
+ if (declaration->id != BT_CTF_TYPE_ID_STRUCT) {
ret = -EPERM;
goto error;
}
ret = -EPERM;
goto error;
}
- if (declaration->id != CTF_TYPE_STRUCT) {
+ if (declaration->id != BT_CTF_TYPE_ID_STRUCT) {
ret = -EPERM;
goto error;
}
return ret;
}
-
+
static
int ctf_stream_declaration_visit(FILE *fd, int depth, struct ctf_node *node, struct ctf_stream_declaration *stream, struct ctf_trace *trace)
{
ret = -EPERM;
goto error;
}
- if (declaration->id != CTF_TYPE_STRUCT) {
+ if (declaration->id != BT_CTF_TYPE_ID_STRUCT) {
ret = -EPERM;
goto error;
}
ret = -EPERM;
goto error;
}
- if (declaration->id != CTF_TYPE_STRUCT) {
+ if (declaration->id != BT_CTF_TYPE_ID_STRUCT) {
ret = -EPERM;
goto error;
}
ret = -EPERM;
goto error;
}
- if (declaration->id != CTF_TYPE_STRUCT) {
+ if (declaration->id != BT_CTF_TYPE_ID_STRUCT) {
ret = -EPERM;
goto error;
}
ret = -EPERM;
goto error;
}
- if (declaration->id != CTF_TYPE_STRUCT) {
+ if (declaration->id != BT_CTF_TYPE_ID_STRUCT) {
ret = -EPERM;
goto error;
}
struct ctf_stream_pos *pos =
container_of(ppos, struct ctf_stream_pos, parent);
- if (elem->id == CTF_TYPE_INTEGER) {
+ if (elem->id == BT_CTF_TYPE_ID_INTEGER) {
struct declaration_integer *integer_declaration =
container_of(elem, struct declaration_integer, p);
struct ctf_stream_pos *pos =
container_of(ppos, struct ctf_stream_pos, parent);
- if (elem->id == CTF_TYPE_INTEGER) {
+ if (elem->id == BT_CTF_TYPE_ID_INTEGER) {
struct declaration_integer *integer_declaration =
container_of(elem, struct declaration_integer, p);
struct bt_declaration *elem = sequence_declaration->elem;
struct ctf_stream_pos *pos = ctf_pos(ppos);
- if (elem->id == CTF_TYPE_INTEGER) {
+ if (elem->id == BT_CTF_TYPE_ID_INTEGER) {
struct declaration_integer *integer_declaration =
container_of(elem, struct declaration_integer, p);
struct bt_declaration *elem = sequence_declaration->elem;
struct ctf_stream_pos *pos = ctf_pos(ppos);
- if (elem->id == CTF_TYPE_INTEGER) {
+ if (elem->id == BT_CTF_TYPE_ID_INTEGER) {
struct declaration_integer *integer_declaration =
container_of(elem, struct declaration_integer, p);
*
* Returns the field's ctf_type_id, CTF_TYPE_UNKNOWN on error.
*/
-extern enum ctf_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field);
+extern enum bt_ctf_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field);
/*
* bt_ctf_field_is_integer: returns whether or not a given field
* http://www.efficios.com/ctf
*/
-#include <babeltrace/ctf/events.h>
#include <stdint.h>
#ifdef __cplusplus
struct bt_ctf_field;
struct bt_ctf_field_path;
+/*
+ * 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
+ * in new code. Both new enumerations are compatible with their legacy
+ * counterpart.
+ */
+enum ctf_type_id {
+ CTF_TYPE_UNKNOWN = 0,
+ CTF_TYPE_INTEGER,
+ CTF_TYPE_FLOAT,
+ CTF_TYPE_ENUM,
+ CTF_TYPE_STRING,
+ CTF_TYPE_STRUCT,
+ CTF_TYPE_UNTAGGED_VARIANT,
+ CTF_TYPE_VARIANT,
+ CTF_TYPE_ARRAY,
+ CTF_TYPE_SEQUENCE,
+ NR_CTF_TYPES,
+};
+
+/*
+ * Old enum.
+ */
+enum ctf_string_encoding {
+ CTF_STRING_NONE = 0,
+ CTF_STRING_UTF8,
+ CTF_STRING_ASCII,
+ CTF_STRING_UNKNOWN,
+};
+
+enum bt_ctf_type_id {
+ BT_CTF_TYPE_ID_UNKNOWN = CTF_TYPE_UNKNOWN,
+ BT_CTF_TYPE_ID_INTEGER = CTF_TYPE_INTEGER,
+ BT_CTF_TYPE_ID_FLOAT = CTF_TYPE_FLOAT,
+ BT_CTF_TYPE_ID_ENUM = CTF_TYPE_ENUM,
+ BT_CTF_TYPE_ID_STRING = CTF_TYPE_STRING,
+ BT_CTF_TYPE_ID_STRUCT = CTF_TYPE_STRUCT,
+ BT_CTF_TYPE_ID_UNTAGGED_VARIANT = CTF_TYPE_UNTAGGED_VARIANT,
+ BT_CTF_TYPE_ID_VARIANT = CTF_TYPE_VARIANT,
+ BT_CTF_TYPE_ID_ARRAY = CTF_TYPE_ARRAY,
+ BT_CTF_TYPE_ID_SEQUENCE = CTF_TYPE_SEQUENCE,
+ BT_CTF_NR_TYPE_IDS,
+};
+
enum bt_ctf_integer_base {
BT_CTF_INTEGER_BASE_UNKNOWN = -1,
BT_CTF_INTEGER_BASE_BINARY = 2,
struct bt_ctf_field_type *type_b);
/*
- * bt_ctf_field_type_get_type_id: get a field type's ctf_type_id.
+ * bt_ctf_field_type_get_type_id: get a field type's bt_ctf_type_id.
*
* @param type Field type.
*
- * Returns the field type's ctf_type_id, CTF_TYPE_UNKNOWN on error.
+ * Returns the field type's bt_ctf_type_id, CTF_TYPE_UNKNOWN on error.
*/
-extern enum ctf_type_id bt_ctf_field_type_get_type_id(
+extern enum bt_ctf_type_id bt_ctf_field_type_get_type_id(
struct bt_ctf_field_type *type);
/*
*/
#include <glib.h>
-#include <babeltrace/ctf/events.h>
+#include <babeltrace/babeltrace-internal.h>
+
+struct bt_ctf_iter;
+struct ctf_stream_definition;
struct bt_callback {
int prio; /* Callback order priority. Lower first. Dynamically assigned from dependency graph. */
#include <babeltrace/ctf/callbacks.h>
#include <babeltrace/ctf/callbacks-internal.h>
#include <babeltrace/ctf-ir/metadata.h>
+#include <babeltrace/ctf-ir/event-types.h>
#include <glib.h>
struct ctf_stream_definition;
struct packet_index *prev_index,
struct packet_index *cur_index);
+struct bt_definition;
+struct bt_declaration;
+struct bt_ctf_event;
+struct bt_ctf_event_decl;
+struct bt_ctf_field_decl;
+
+/*
+ * the top-level scopes in CTF
+ */
+enum ctf_scope {
+ BT_TRACE_PACKET_HEADER = 0,
+ BT_STREAM_PACKET_CONTEXT = 1,
+ BT_STREAM_EVENT_HEADER = 2,
+ BT_STREAM_EVENT_CONTEXT = 3,
+ BT_EVENT_CONTEXT = 4,
+ BT_EVENT_FIELDS = 5,
+};
+
+/*
+ * bt_ctf_get_top_level_scope: return a definition of the top-level scope
+ *
+ * Top-level scopes are defined in the ctf_scope enum.
+ * In order to get a field or a field list, the user needs to pass a
+ * scope as argument, this scope can be a top-level scope or a scope
+ * relative to an arbitrary field. This function provides the mapping
+ * between the enum and the actual definition of top-level scopes.
+ * On error return NULL.
+ */
+const struct bt_definition *bt_ctf_get_top_level_scope(const struct bt_ctf_event *event,
+ enum ctf_scope scope);
+
+/*
+ * bt_ctf_event_get_name: returns the name of the event or NULL on error
+ */
+const char *bt_ctf_event_name(const struct bt_ctf_event *event);
+
+/*
+ * bt_ctf_get_cycles: returns the timestamp of the event as written
+ * in the packet (in cycles) or -1ULL on error.
+ */
+uint64_t bt_ctf_get_cycles(const struct bt_ctf_event *event);
+
+/*
+ * bt_ctf_get_timestamp: get the timestamp of the event offsetted
+ * with the system clock source (in ns) in *timestamp.
+ *
+ * Return 0 on success, or -1ULL on error.
+ */
+int bt_ctf_get_timestamp(const struct bt_ctf_event *event, int64_t *timestamp);
+
+/*
+ * bt_ctf_get_field_list: obtain the list of fields for compound type
+ *
+ * This function can be used to obtain the list of fields contained
+ * within a top-level scope of an event or a compound type: array,
+ * sequence, structure, or variant.
+
+ * This function sets the "list" pointer to an array of definition
+ * pointers and set count to the number of elements in the array.
+ * Return 0 on success and a negative value on error.
+ *
+ * The content pointed to by "list" should *not* be freed. It stays
+ * valid as long as the event is unchanged (as long as the iterator
+ * from which the event is extracted is unchanged).
+ */
+int bt_ctf_get_field_list(const struct bt_ctf_event *event,
+ const struct bt_definition *scope,
+ struct bt_definition const * const **list,
+ unsigned int *count);
+
+/*
+ * bt_ctf_get_field: returns the definition of a specific field
+ */
+const struct bt_definition *bt_ctf_get_field(const struct bt_ctf_event *event,
+ const struct bt_definition *scope,
+ const char *field);
+
+/*
+ * bt_ctf_get_index: if the field is an array or a sequence, return the element
+ * at position index, otherwise return NULL;
+ */
+const struct bt_definition *bt_ctf_get_index(const struct bt_ctf_event *event,
+ const struct bt_definition *field,
+ unsigned int index);
+
+/*
+ * bt_ctf_field_name: returns the name of a field or NULL on error
+ */
+const char *bt_ctf_field_name(const struct bt_definition *def);
+
+/*
+ * bt_ctf_get_decl_from_def: return the declaration of a field from
+ * its definition or NULL on error
+ */
+const struct bt_declaration *bt_ctf_get_decl_from_def(const struct bt_definition *def);
+
+/*
+ * bt_ctf_get_decl_from_field_decl: return the declaration of a field from
+ * a field_decl or NULL on error
+ */
+const struct bt_declaration *bt_ctf_get_decl_from_field_decl(
+ const struct bt_ctf_field_decl *field);
+
+/*
+ * bt_ctf_field_type: returns the type of a field or -1 if unknown
+ */
+enum ctf_type_id bt_ctf_field_type(const struct bt_declaration *decl);
+
+/*
+ * bt_ctf_get_int_signedness: return the signedness of an integer
+ *
+ * return 0 if unsigned
+ * return 1 if signed
+ * return -1 on error
+ */
+int bt_ctf_get_int_signedness(const struct bt_declaration *decl);
+
+/*
+ * bt_ctf_get_int_base: return the base of an int or a negative value on error
+ */
+int bt_ctf_get_int_base(const struct bt_declaration *decl);
+
+/*
+ * bt_ctf_get_int_byte_order: return the byte order of an int or a negative
+ * value on error
+ */
+int bt_ctf_get_int_byte_order(const struct bt_declaration *decl);
+
+/*
+ * bt_ctf_get_int_len: return the size, in bits, of an int or a negative
+ * value on error
+ */
+ssize_t bt_ctf_get_int_len(const struct bt_declaration *decl);
+
+/*
+ * bt_ctf_get_encoding: return the encoding of an int, a string, or of
+ * the integer contained in a char array or a sequence.
+ * return a negative value on error
+ */
+enum ctf_string_encoding bt_ctf_get_encoding(const struct bt_declaration *decl);
+
+/*
+ * bt_ctf_get_array_len: return the len of an array or a negative
+ * value on error
+ */
+int bt_ctf_get_array_len(const struct bt_declaration *decl);
+
+/*
+ * bt_ctf_get_struct_field_count: return the number of fields in a structure.
+ * Returns a negative value on error.
+ */
+uint64_t bt_ctf_get_struct_field_count(const struct bt_definition *field);
+
+/*
+ * Field access functions
+ *
+ * These functions return the value associated with the field passed in
+ * parameter.
+ *
+ * If the field does not exist or is not of the type requested, the value
+ * returned is undefined. To check if an error occured, use the
+ * bt_ctf_field_get_error() function after accessing a field.
+ *
+ * bt_ctf_get_enum_int gets the integer field of an enumeration.
+ * bt_ctf_get_enum_str gets the string matching the current enumeration
+ * value, or NULL if the current value does not match any string.
+ */
+uint64_t bt_ctf_get_uint64(const struct bt_definition *field);
+int64_t bt_ctf_get_int64(const struct bt_definition *field);
+const struct bt_definition *bt_ctf_get_enum_int(const struct bt_definition *field);
+const char *bt_ctf_get_enum_str(const struct bt_definition *field);
+char *bt_ctf_get_char_array(const struct bt_definition *field);
+char *bt_ctf_get_string(const struct bt_definition *field);
+double bt_ctf_get_float(const struct bt_definition *field);
+const struct bt_definition *bt_ctf_get_variant(const struct bt_definition *field);
+const struct bt_definition *bt_ctf_get_struct_field_index(
+ const struct bt_definition *field, uint64_t i);
+
+/*
+ * bt_ctf_field_get_error: returns the last error code encountered while
+ * accessing a field and reset the error flag.
+ * Return 0 if no error, a negative value otherwise.
+ */
+int bt_ctf_field_get_error(void);
+
+/*
+ * bt_ctf_get_event_decl_list: get a list of all the event declarations in
+ * a trace.
+ *
+ * The list array is pointed to the array of event declarations.
+ * The number of events in the array is written in count.
+ *
+ * Return 0 on success and a negative value on error.
+ *
+ * The content pointed to by "list" should *not* be freed. It stays
+ * valid as long as the trace is opened.
+ */
+int bt_ctf_get_event_decl_list(int handle_id, struct bt_context *ctx,
+ struct bt_ctf_event_decl * const **list,
+ unsigned int *count);
+
+/*
+ * bt_ctf_get_decl_event_name: return the name of the event or NULL on error
+ */
+const char *bt_ctf_get_decl_event_name(const struct bt_ctf_event_decl *event);
+
+/*
+ * bt_ctf_get_decl_event_id: return the event-ID of the event or -1ULL on error
+ */
+uint64_t bt_ctf_get_decl_event_id(const struct bt_ctf_event_decl *event);
+
+/*
+ * bt_ctf_get_decl_fields: get all field declarations in a scope of an event
+ *
+ * The list array is pointed to the array of field declaration.
+ * The number of field declaration in the array is written in count.
+ *
+ * Returns 0 on success and a negative value on error
+ *
+ * The content pointed to by "list" should *not* be freed. It stays
+ * valid as long as the trace is opened.
+ */
+int bt_ctf_get_decl_fields(struct bt_ctf_event_decl *event_decl,
+ enum ctf_scope scope,
+ struct bt_ctf_field_decl const * const **list,
+ unsigned int *count);
+
+/*
+ * bt_ctf_get_decl_field_name: return the name of a field decl or NULL on error
+ */
+const char *bt_ctf_get_decl_field_name(const struct bt_ctf_field_decl *field);
+
#endif /*_BABELTRACE_CTF_EVENTS_INTERNAL_H */
#include <stdint.h>
#include <babeltrace/context.h>
#include <babeltrace/clock-types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct bt_definition;
-struct bt_declaration;
-struct bt_ctf_event;
-struct bt_ctf_event_decl;
-struct bt_ctf_field_decl;
-
-/*
- * the top-level scopes in CTF
- */
-enum ctf_scope {
- BT_TRACE_PACKET_HEADER = 0,
- BT_STREAM_PACKET_CONTEXT = 1,
- BT_STREAM_EVENT_HEADER = 2,
- BT_STREAM_EVENT_CONTEXT = 3,
- BT_EVENT_CONTEXT = 4,
- BT_EVENT_FIELDS = 5,
-};
-
-/*
- * the supported CTF types
- */
-enum ctf_type_id {
- CTF_TYPE_UNKNOWN = 0,
- CTF_TYPE_INTEGER,
- CTF_TYPE_FLOAT,
- CTF_TYPE_ENUM,
- CTF_TYPE_STRING,
- CTF_TYPE_STRUCT,
- CTF_TYPE_UNTAGGED_VARIANT,
- CTF_TYPE_VARIANT,
- CTF_TYPE_ARRAY,
- CTF_TYPE_SEQUENCE,
- NR_CTF_TYPES,
-};
-
-/*
- * the supported CTF string encodings
- */
-enum ctf_string_encoding {
- CTF_STRING_NONE = 0,
- CTF_STRING_UTF8,
- CTF_STRING_ASCII,
- CTF_STRING_UNKNOWN,
-};
-
-/*
- * bt_ctf_get_top_level_scope: return a definition of the top-level scope
- *
- * Top-level scopes are defined in the ctf_scope enum.
- * In order to get a field or a field list, the user needs to pass a
- * scope as argument, this scope can be a top-level scope or a scope
- * relative to an arbitrary field. This function provides the mapping
- * between the enum and the actual definition of top-level scopes.
- * On error return NULL.
- */
-const struct bt_definition *bt_ctf_get_top_level_scope(const struct bt_ctf_event *event,
- enum ctf_scope scope);
-
-/*
- * bt_ctf_event_get_name: returns the name of the event or NULL on error
- */
-const char *bt_ctf_event_name(const struct bt_ctf_event *event);
-
-/*
- * bt_ctf_get_cycles: returns the timestamp of the event as written
- * in the packet (in cycles) or -1ULL on error.
- */
-uint64_t bt_ctf_get_cycles(const struct bt_ctf_event *event);
-
-/*
- * bt_ctf_get_timestamp: get the timestamp of the event offsetted
- * with the system clock source (in ns) in *timestamp.
- *
- * Return 0 on success, or -1ULL on error.
- */
-int bt_ctf_get_timestamp(const struct bt_ctf_event *event, int64_t *timestamp);
+#include <babeltrace/ctf-ir/event-types.h>
/*
- * bt_ctf_get_field_list: obtain the list of fields for compound type
- *
- * This function can be used to obtain the list of fields contained
- * within a top-level scope of an event or a compound type: array,
- * sequence, structure, or variant.
-
- * This function sets the "list" pointer to an array of definition
- * pointers and set count to the number of elements in the array.
- * Return 0 on success and a negative value on error.
- *
- * The content pointed to by "list" should *not* be freed. It stays
- * valid as long as the event is unchanged (as long as the iterator
- * from which the event is extracted is unchanged).
- */
-int bt_ctf_get_field_list(const struct bt_ctf_event *event,
- const struct bt_definition *scope,
- struct bt_definition const * const **list,
- unsigned int *count);
-
-/*
- * bt_ctf_get_field: returns the definition of a specific field
- */
-const struct bt_definition *bt_ctf_get_field(const struct bt_ctf_event *event,
- const struct bt_definition *scope,
- const char *field);
-
-/*
- * bt_ctf_get_index: if the field is an array or a sequence, return the element
- * at position index, otherwise return NULL;
- */
-const struct bt_definition *bt_ctf_get_index(const struct bt_ctf_event *event,
- const struct bt_definition *field,
- unsigned int index);
-
-/*
- * bt_ctf_field_name: returns the name of a field or NULL on error
- */
-const char *bt_ctf_field_name(const struct bt_definition *def);
-
-/*
- * bt_ctf_get_decl_from_def: return the declaration of a field from
- * its definition or NULL on error
- */
-const struct bt_declaration *bt_ctf_get_decl_from_def(const struct bt_definition *def);
-
-/*
- * bt_ctf_get_decl_from_field_decl: return the declaration of a field from
- * a field_decl or NULL on error
- */
-const struct bt_declaration *bt_ctf_get_decl_from_field_decl(
- const struct bt_ctf_field_decl *field);
-
-/*
- * bt_ctf_field_type: returns the type of a field or -1 if unknown
- */
-enum ctf_type_id bt_ctf_field_type(const struct bt_declaration *decl);
-
-/*
- * bt_ctf_get_int_signedness: return the signedness of an integer
- *
- * return 0 if unsigned
- * return 1 if signed
- * return -1 on error
+ * This header must exist in Babeltrace 2 because it contained
+ * enumerations that were used in CTF writer's API. Those enumerations
+ * are now located in ctf-ir/event-types.h.
*/
-int bt_ctf_get_int_signedness(const struct bt_declaration *decl);
-
-/*
- * bt_ctf_get_int_base: return the base of an int or a negative value on error
- */
-int bt_ctf_get_int_base(const struct bt_declaration *decl);
-
-/*
- * bt_ctf_get_int_byte_order: return the byte order of an int or a negative
- * value on error
- */
-int bt_ctf_get_int_byte_order(const struct bt_declaration *decl);
-
-/*
- * bt_ctf_get_int_len: return the size, in bits, of an int or a negative
- * value on error
- */
-ssize_t bt_ctf_get_int_len(const struct bt_declaration *decl);
-
-/*
- * bt_ctf_get_encoding: return the encoding of an int, a string, or of
- * the integer contained in a char array or a sequence.
- * return a negative value on error
- */
-enum ctf_string_encoding bt_ctf_get_encoding(const struct bt_declaration *decl);
-
-/*
- * bt_ctf_get_array_len: return the len of an array or a negative
- * value on error
- */
-int bt_ctf_get_array_len(const struct bt_declaration *decl);
-
-/*
- * bt_ctf_get_struct_field_count: return the number of fields in a structure.
- * Returns a negative value on error.
- */
-uint64_t bt_ctf_get_struct_field_count(const struct bt_definition *field);
-
-/*
- * Field access functions
- *
- * These functions return the value associated with the field passed in
- * parameter.
- *
- * If the field does not exist or is not of the type requested, the value
- * returned is undefined. To check if an error occured, use the
- * bt_ctf_field_get_error() function after accessing a field.
- *
- * bt_ctf_get_enum_int gets the integer field of an enumeration.
- * bt_ctf_get_enum_str gets the string matching the current enumeration
- * value, or NULL if the current value does not match any string.
- */
-uint64_t bt_ctf_get_uint64(const struct bt_definition *field);
-int64_t bt_ctf_get_int64(const struct bt_definition *field);
-const struct bt_definition *bt_ctf_get_enum_int(const struct bt_definition *field);
-const char *bt_ctf_get_enum_str(const struct bt_definition *field);
-char *bt_ctf_get_char_array(const struct bt_definition *field);
-char *bt_ctf_get_string(const struct bt_definition *field);
-double bt_ctf_get_float(const struct bt_definition *field);
-const struct bt_definition *bt_ctf_get_variant(const struct bt_definition *field);
-const struct bt_definition *bt_ctf_get_struct_field_index(
- const struct bt_definition *field, uint64_t i);
-
-/*
- * bt_ctf_field_get_error: returns the last error code encountered while
- * accessing a field and reset the error flag.
- * Return 0 if no error, a negative value otherwise.
- */
-int bt_ctf_field_get_error(void);
-
-/*
- * bt_ctf_get_event_decl_list: get a list of all the event declarations in
- * a trace.
- *
- * The list array is pointed to the array of event declarations.
- * The number of events in the array is written in count.
- *
- * Return 0 on success and a negative value on error.
- *
- * The content pointed to by "list" should *not* be freed. It stays
- * valid as long as the trace is opened.
- */
-int bt_ctf_get_event_decl_list(int handle_id, struct bt_context *ctx,
- struct bt_ctf_event_decl * const **list,
- unsigned int *count);
-
-/*
- * bt_ctf_get_decl_event_name: return the name of the event or NULL on error
- */
-const char *bt_ctf_get_decl_event_name(const struct bt_ctf_event_decl *event);
-
-/*
- * bt_ctf_get_decl_event_id: return the event-ID of the event or -1ULL on error
- */
-uint64_t bt_ctf_get_decl_event_id(const struct bt_ctf_event_decl *event);
-
-/*
- * bt_ctf_get_decl_fields: get all field declarations in a scope of an event
- *
- * The list array is pointed to the array of field declaration.
- * The number of field declaration in the array is written in count.
- *
- * Returns 0 on success and a negative value on error
- *
- * The content pointed to by "list" should *not* be freed. It stays
- * valid as long as the trace is opened.
- */
-int bt_ctf_get_decl_fields(struct bt_ctf_event_decl *event_decl,
- enum ctf_scope scope,
- struct bt_ctf_field_decl const * const **list,
- unsigned int *count);
-
-/*
- * bt_ctf_get_decl_field_name: return the name of a field decl or NULL on error
- */
-const char *bt_ctf_get_decl_field_name(const struct bt_ctf_field_decl *field);
-
-#ifdef __cplusplus
-}
-#endif
#endif /* _BABELTRACE_CTF_EVENTS_H */
};
struct bt_declaration {
- enum ctf_type_id id;
+ enum bt_ctf_type_id id;
size_t alignment; /* type alignment, in bits */
int ref; /* number of references to the type */
/*
static inline
int generic_rw(struct bt_stream_pos *pos, struct bt_definition *definition)
{
- enum ctf_type_id dispatch_id = definition->declaration->id;
+ enum bt_ctf_type_id dispatch_id = definition->declaration->id;
rw_dispatch call;
assert(pos->rw_table[dispatch_id] != NULL);
"bt_ctf_field_type_get_byte_order handles NULL correctly");
ok(bt_ctf_field_type_get_type_id(NULL) ==
- CTF_TYPE_UNKNOWN,
+ BT_CTF_TYPE_ID_UNKNOWN,
"bt_ctf_field_type_get_type_id handles NULL correctly");
ok(bt_ctf_field_type_get_type_id(uint_12_type) ==
- CTF_TYPE_INTEGER,
+ BT_CTF_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) ==
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) ==
- CTF_TYPE_SEQUENCE,
+ BT_CTF_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,
structure_seq_type = bt_ctf_field_type_structure_create();
ok(bt_ctf_field_type_get_type_id(structure_seq_type) ==
- CTF_TYPE_STRUCT,
+ BT_CTF_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,
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) == CTF_TYPE_STRUCT,
+ ok(bt_ctf_field_type_get_type_id(ret_field_type) == BT_CTF_TYPE_ID_STRUCT,
"Default event header type is a structure");
event_header_field_type =
bt_ctf_field_type_structure_get_field_type_by_name(
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) == CTF_TYPE_INTEGER,
+ event_header_field_type) == BT_CTF_TYPE_ID_INTEGER,
"Default event header \"id\" field is an integer");
bt_put(event_header_field_type);
event_header_field_type =
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) == CTF_TYPE_INTEGER,
+ event_header_field_type) == BT_CTF_TYPE_ID_INTEGER,
"Default event header \"timestamp\" field is an integer");
bt_put(event_header_field_type);
bt_put(ret_field_type);
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) == CTF_TYPE_STRUCT,
+ ok(bt_ctf_field_type_get_type_id(packet_header_type) == BT_CTF_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");
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) == CTF_TYPE_STRUCT,
+ ok(bt_ctf_field_type_get_type_id(packet_context_type) == BT_CTF_TYPE_ID_STRUCT,
"Packet context is a structure");
ok(bt_ctf_stream_class_set_packet_context_type(NULL, packet_context_type),
#include <babeltrace/context.h>
#include <babeltrace/iterator.h>
#include <babeltrace/ctf/iterator.h>
-#include <babeltrace/ctf/events.h>
+#include <babeltrace/ctf/events-internal.h>
#include <babeltrace/babeltrace-internal.h> /* For symbol side-effects */
#include <stdio.h>
bt_declaration_ref(elem_declaration);
array_declaration->elem = elem_declaration;
array_declaration->scope = bt_new_declaration_scope(parent_scope);
- declaration->id = CTF_TYPE_ARRAY;
+ declaration->id = BT_CTF_TYPE_ID_ARRAY;
declaration->alignment = elem_declaration->alignment;
declaration->declaration_free = _array_declaration_free;
declaration->definition_new = _array_definition_new;
array->string = NULL;
array->elems = NULL;
- if (array_declaration->elem->id == CTF_TYPE_INTEGER) {
+ if (array_declaration->elem->id == BT_CTF_TYPE_ID_INTEGER) {
struct declaration_integer *integer_declaration =
container_of(array_declaration->elem, struct declaration_integer, p);
array_definition = container_of(field, struct definition_array, p);
array_declaration = array_definition->declaration;
elem = array_declaration->elem;
- if (elem->id == CTF_TYPE_INTEGER) {
+ if (elem->id == BT_CTF_TYPE_ID_INTEGER) {
struct declaration_integer *integer_declaration =
container_of(elem, struct declaration_integer, p);
bt_declaration_ref(elem_declaration);
sequence_declaration->elem = elem_declaration;
sequence_declaration->scope = bt_new_declaration_scope(parent_scope);
- declaration->id = CTF_TYPE_SEQUENCE;
+ declaration->id = BT_CTF_TYPE_ID_SEQUENCE;
declaration->alignment = elem_declaration->alignment;
declaration->declaration_free = _sequence_declaration_free;
declaration->definition_new = _sequence_definition_new;
sequence->string = NULL;
sequence->elems = NULL;
- if (sequence_declaration->elem->id == CTF_TYPE_INTEGER) {
+ if (sequence_declaration->elem->id == BT_CTF_TYPE_ID_INTEGER) {
struct declaration_integer *integer_declaration =
container_of(sequence_declaration->elem, struct declaration_integer, p);
lookup = bt_lookup_definition(definition, field_name);
if (!lookup)
return NULL;
- if (lookup->declaration->id != CTF_TYPE_INTEGER)
+ if (lookup->declaration->id != BT_CTF_TYPE_ID_INTEGER)
return NULL;
lookup_integer = container_of(lookup, struct definition_integer, p);
if (lookup_integer->declaration->signedness != signedness)
lookup = bt_lookup_definition(definition, field_name);
if (!lookup)
return NULL;
- if (lookup->declaration->id != CTF_TYPE_ENUM)
+ if (lookup->declaration->id != BT_CTF_TYPE_ID_ENUM)
return NULL;
lookup_enum = container_of(lookup, struct definition_enum, p);
if (lookup_enum->integer->declaration->signedness != signedness)
lookup = bt_lookup_definition(definition, field_name);
if (!lookup)
return NULL;
- if (lookup->declaration->id != CTF_TYPE_VARIANT)
+ if (lookup->declaration->id != BT_CTF_TYPE_ID_VARIANT)
return NULL;
bt_lookup_variant = container_of(lookup, struct definition_variant, p);
lookup = bt_variant_get_current_field(bt_lookup_variant);