-static
-int init_trace_packet_header(struct bt_ctf_trace *trace)
-{
- int ret = 0;
- struct bt_ctf_field *magic = NULL, *uuid_array = NULL;
- struct bt_ctf_field_type *_uint32_t =
- get_field_type(FIELD_TYPE_ALIAS_UINT32_T);
- struct bt_ctf_field_type *_uint8_t =
- get_field_type(FIELD_TYPE_ALIAS_UINT8_T);
- struct bt_ctf_field_type *trace_packet_header_type =
- bt_ctf_field_type_structure_create();
- struct bt_ctf_field_type *uuid_array_type =
- bt_ctf_field_type_array_create(_uint8_t, 16);
-
- if (!trace_packet_header_type || !uuid_array_type) {
- ret = -1;
- goto end;
- }
-
- ret = bt_ctf_field_type_structure_add_field(trace_packet_header_type,
- _uint32_t, "magic");
- if (ret) {
- goto end;
- }
-
- ret = bt_ctf_field_type_structure_add_field(trace_packet_header_type,
- uuid_array_type, "uuid");
- if (ret) {
- goto end;
- }
-
- ret = bt_ctf_field_type_structure_add_field(trace_packet_header_type,
- _uint32_t, "stream_id");
- if (ret) {
- goto end;
- }
-
- ret = bt_ctf_trace_set_packet_header_type(trace,
- trace_packet_header_type);
- if (ret) {
- goto end;
- }
-end:
- bt_put(uuid_array_type);
- bt_put(_uint32_t);
- bt_put(_uint8_t);
- bt_put(magic);
- bt_put(uuid_array);
- bt_put(trace_packet_header_type);
- return ret;
-}
-