int bt_ctf_stream_get_discarded_events_count( struct bt_ctf_stream *stream, uint64_t *count) { int64_t ret = 0; int field_signed; struct bt_ctf_field *events_discarded_field = NULL; struct bt_ctf_field_type *events_discarded_field_type = NULL; if (!stream || !count || !stream->packet_context) { ret = -1; goto end; } events_discarded_field = bt_ctf_field_structure_get_field( stream->packet_context, "events_discarded"); if (!events_discarded_field) { ret = -1; goto end; } events_discarded_field_type = bt_ctf_field_get_type( events_discarded_field); if (!events_discarded_field_type) { ret = -1; goto end; } field_signed = bt_ctf_field_type_integer_get_signed( events_discarded_field_type); if (field_signed < 0) { ret = field_signed; goto end; } if (field_signed) { int64_t signed_count; ret = bt_ctf_field_signed_integer_get_value( events_discarded_field, &signed_count); if (ret) { goto end; } if (signed_count < 0) { /* Invalid value */ ret = -1; goto end; } *count = (uint64_t) signed_count; } else { ret = bt_ctf_field_unsigned_integer_get_value( events_discarded_field, count); if (ret) { goto end; } } end: bt_put(events_discarded_field); bt_put(events_discarded_field_type); return ret; }
static void bt_ctf_stream_destroy(struct bt_object *obj) { struct bt_ctf_stream *stream; stream = container_of(obj, struct bt_ctf_stream, base); ctf_fini_pos(&stream->pos); if (stream->pos.fd >= 0 && close(stream->pos.fd)) { perror("close"); } if (stream->events) { g_ptr_array_free(stream->events, TRUE); } if (stream->name) { g_string_free(stream->name, TRUE); } if (stream->clock_values) { g_hash_table_destroy(stream->clock_values); } bt_put(stream->packet_header); bt_put(stream->packet_context); g_free(stream); }
BT_HIDDEN int bt_ctf_stream_set_packet_context(struct bt_ctf_stream *stream, struct bt_ctf_field *field) { int ret = 0; struct bt_ctf_field_type *field_type; if (!stream || !field || stream->pos.fd < 0) { ret = -1; goto end; } field_type = bt_ctf_field_get_type(field); if (bt_ctf_field_type_compare(field_type, stream->stream_class->packet_context_type)) { ret = -1; goto end; } bt_put(field_type); bt_get(field); bt_put(stream->packet_context); stream->packet_context = field; end: return ret; }
BT_HIDDEN int bt_ctf_event_set_header(struct bt_ctf_event *event, struct bt_ctf_field *header) { int ret = 0; struct bt_ctf_field_type *field_type = NULL; struct bt_ctf_stream_class *stream_class = NULL; if (!event || !header || event->frozen) { ret = -1; goto end; } stream_class = (struct bt_ctf_stream_class *) bt_object_get_parent( event->event_class); /* * Ensure the provided header's type matches the one registered to the * stream class. */ field_type = bt_ctf_field_get_type(header); if (bt_ctf_field_type_compare(field_type, stream_class->event_header_type)) { ret = -1; goto end; } bt_get(header); bt_put(event->event_header); event->event_header = header; end: bt_put(stream_class); bt_put(field_type); return ret; }
BT_HIDDEN int bt_ctf_event_set_event_context(struct bt_ctf_event *event, struct bt_ctf_field *context) { int ret = 0; struct bt_ctf_field_type *field_type = NULL; if (!event || !context || event->frozen) { ret = -1; goto end; } field_type = bt_ctf_field_get_type(context); if (bt_ctf_field_type_compare(field_type, event->event_class->context)) { ret = -1; goto end; } bt_get(context); bt_put(event->context_payload); event->context_payload = context; end: bt_put(field_type); return ret; }
BT_HIDDEN int bt_ctf_event_set_payload_field(struct bt_ctf_event *event, struct bt_ctf_field *payload) { int ret = 0; struct bt_ctf_field_type *payload_type = NULL; if (!event || !payload || event->frozen) { ret = -1; goto end; } payload_type = bt_ctf_field_get_type(payload); if (!payload_type) { ret = -1; goto end; } if (bt_ctf_field_type_get_type_id(payload_type) != CTF_TYPE_STRUCT) { ret = -1; goto end; } bt_get(payload); bt_put(event->fields_payload); event->fields_payload = payload; end: bt_put(payload_type); return ret; }
int bt_ctf_event_set_payload(struct bt_ctf_event *event, const char *name, struct bt_ctf_field *payload) { int ret = 0; if (!event || !payload || event->frozen) { ret = -1; goto end; } if (name) { ret = bt_ctf_field_structure_set_field(event->fields_payload, name, payload); } else { struct bt_ctf_field_type *payload_type; payload_type = bt_ctf_field_get_type(payload); if (bt_ctf_field_type_compare(payload_type, event->event_class->fields) == 0) { bt_put(event->fields_payload); bt_get(payload); event->fields_payload = payload; } else { ret = -1; } bt_put(payload_type); } end: return ret; }
BT_HIDDEN struct bt_ctf_clock *bt_ctf_event_get_clock(struct bt_ctf_event *event) { struct bt_ctf_clock *clock = NULL; struct bt_ctf_event_class *event_class; struct bt_ctf_stream_class *stream_class; if (!event) { goto end; } event_class = bt_ctf_event_get_class(event); if (!event_class) { goto end; } stream_class = bt_ctf_event_class_get_stream_class(event_class); if (!stream_class) { goto error_put_event_class; } clock = bt_ctf_stream_class_get_clock(stream_class); if (!clock) { goto error_put_stream_class; } error_put_stream_class: bt_put(stream_class); error_put_event_class: bt_put(event_class); end: return clock; }
BT_HIDDEN int bt_ctf_stream_set_packet_header(struct bt_ctf_stream *stream, struct bt_ctf_field *field) { int ret = 0; struct bt_ctf_trace *trace = NULL; struct bt_ctf_field_type *field_type = NULL; if (!stream || !field || stream->pos.fd < 0) { ret = -1; goto end; } trace = (struct bt_ctf_trace *) bt_object_get_parent(stream); field_type = bt_ctf_field_get_type(field); if (bt_ctf_field_type_compare(field_type, trace->packet_header_type)) { ret = -1; goto end; } bt_get(field); bt_put(stream->packet_header); stream->packet_header = field; end: BT_PUT(trace); bt_put(field_type); return ret; }
BT_HIDDEN struct bt_ctf_packet *trimmer_new_packet( struct trimmer_iterator *trim_it, struct bt_ctf_packet *packet) { struct bt_ctf_stream *stream = NULL; struct bt_ctf_field *writer_packet_context = NULL; struct bt_ctf_packet *writer_packet = NULL; int int_ret; stream = bt_ctf_packet_get_stream(packet); if (!stream) { fprintf(trim_it->err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); goto error; } /* * If a packet was already opened, close it and remove it from * the HT. */ writer_packet = lookup_packet(trim_it, packet); if (writer_packet) { g_hash_table_remove(trim_it->packet_map, packet); BT_PUT(writer_packet); } writer_packet = insert_new_packet(trim_it, packet, stream); if (!writer_packet) { fprintf(trim_it->err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); goto error; } bt_get(writer_packet); writer_packet_context = ctf_copy_packet_context(trim_it->err, packet, stream); if (!writer_packet_context) { fprintf(trim_it->err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); goto error; } int_ret = bt_ctf_packet_set_context(writer_packet, writer_packet_context); if (int_ret) { fprintf(trim_it->err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); goto error; } goto end; error: BT_PUT(writer_packet); end: bt_put(writer_packet_context); bt_put(stream); return writer_packet; }
void bt_ctf_stream_append_discarded_events(struct bt_ctf_stream *stream, uint64_t event_count) { int ret; int field_signed; uint64_t previous_count; uint64_t new_count; struct bt_ctf_field *events_discarded_field = NULL; struct bt_ctf_field_type *events_discarded_field_type = NULL; if (!stream || !stream->packet_context) { goto end; } ret = bt_ctf_stream_get_discarded_events_count(stream, &previous_count); if (ret) { goto end; } events_discarded_field = bt_ctf_field_structure_get_field( stream->packet_context, "events_discarded"); if (!events_discarded_field) { goto end; } events_discarded_field_type = bt_ctf_field_get_type( events_discarded_field); if (!events_discarded_field_type) { goto end; } field_signed = bt_ctf_field_type_integer_get_signed( events_discarded_field_type); if (field_signed < 0) { goto end; } new_count = previous_count + event_count; if (field_signed) { ret = bt_ctf_field_signed_integer_set_value( events_discarded_field, (int64_t) new_count); if (ret) { goto end; } } else { ret = bt_ctf_field_unsigned_integer_set_value( events_discarded_field, new_count); if (ret) { goto end; } } end: bt_put(events_discarded_field); bt_put(events_discarded_field_type); }
static void bt_ctf_packet_destroy(struct bt_object *obj) { struct bt_ctf_packet *packet; packet = container_of(obj, struct bt_ctf_packet, base); bt_put(packet->header); bt_put(packet->context); bt_put(packet->stream); g_free(packet); }
static void bt_ctf_event_class_destroy(struct bt_object *obj) { struct bt_ctf_event_class *event_class; event_class = container_of(obj, struct bt_ctf_event_class, base); bt_ctf_attributes_destroy(event_class->attributes); bt_put(event_class->context); bt_put(event_class->fields); g_free(event_class); }
BT_HIDDEN int bt_ctf_event_populate_event_header(struct bt_ctf_event *event) { int ret = 0; struct bt_ctf_field *id_field = NULL, *timestamp_field = NULL; if (!event || event->frozen) { ret = -1; goto end; } id_field = bt_ctf_field_structure_get_field(event->event_header, "id"); if (id_field) { ret = set_integer_field_value(id_field, (uint64_t) bt_ctf_event_class_get_id( event->event_class)); if (ret) { goto end; } } timestamp_field = bt_ctf_field_structure_get_field(event->event_header, "timestamp"); if (timestamp_field) { struct bt_ctf_field_type *timestamp_field_type = bt_ctf_field_get_type(timestamp_field); struct bt_ctf_clock *mapped_clock; assert(timestamp_field_type); mapped_clock = bt_ctf_field_type_integer_get_mapped_clock( timestamp_field_type); bt_put(timestamp_field_type); if (mapped_clock) { int64_t timestamp; ret = bt_ctf_clock_get_time(mapped_clock, ×tamp); bt_put(mapped_clock); if (ret) { goto end; } ret = set_integer_field_value(timestamp_field, timestamp); if (ret) { goto end; } } } end: bt_put(id_field); bt_put(timestamp_field); return ret; }
static int set_structure_field_integer(struct bt_ctf_field *structure, char *name, uint64_t value) { int ret = 0; struct bt_ctf_field_type *field_type = NULL; struct bt_ctf_field *integer = bt_ctf_field_structure_get_field(structure, name); if (!structure || !name) { ret = -1; goto end; } if (!integer) { /* Field not found, not an error. */ goto end; } /* Make sure the payload has not already been set. */ if (!bt_ctf_field_validate(integer)) { /* Payload already set, not an error */ 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) { /* * The user most likely meant for us to populate this field * automatically. However, we can only do this if the field * is an integer. Return an error. */ ret = -1; goto end; } if (bt_ctf_field_type_integer_get_signed(field_type)) { ret = bt_ctf_field_signed_integer_set_value(integer, (int64_t) value); } else { ret = bt_ctf_field_unsigned_integer_set_value(integer, value); } end: bt_put(integer); bt_put(field_type); return ret; }
static int set_packet_header_magic(struct bt_ctf_stream *stream) { int ret = 0; struct bt_ctf_field_type *magic_field_type = NULL; struct bt_ctf_field *magic_field = bt_ctf_field_structure_get_field( stream->packet_header, "magic"); if (!magic_field) { /* No magic field found. Not an error, skip. */ goto end; } if (!bt_ctf_field_validate(magic_field)) { /* Value already set. Not an error, skip. */ goto end; } magic_field_type = bt_ctf_field_get_type(magic_field); assert(magic_field_type); if (bt_ctf_field_type_get_type_id(magic_field_type) != CTF_TYPE_INTEGER) { /* Magic field is not an integer. Not an error, skip. */ goto end; } if (bt_ctf_field_type_integer_get_size(magic_field_type) != 32) { /* * Magic field is not of the expected size. * Not an error, skip. */ goto end; } ret = bt_ctf_field_type_integer_get_signed(magic_field_type); assert(ret >= 0); if (ret) { ret = bt_ctf_field_signed_integer_set_value(magic_field, (int64_t) 0xC1FC1FC1); } else { ret = bt_ctf_field_unsigned_integer_set_value(magic_field, (uint64_t) 0xC1FC1FC1); } end: bt_put(magic_field); bt_put(magic_field_type); return ret; }
BT_HIDDEN int bt_ctf_event_set_stream_event_context(struct bt_ctf_event *event, struct bt_ctf_field *stream_event_context) { int ret = 0; struct bt_ctf_field_type *field_type = NULL; struct bt_ctf_stream_class *stream_class = NULL; if (!event || !stream_event_context || event->frozen) { ret = -1; goto end; } stream_class = bt_ctf_event_class_get_stream_class(event->event_class); /* * We should not have been able to create the event without associating * the event class to a stream class. */ assert(stream_class); field_type = bt_ctf_field_get_type(stream_event_context); if (bt_ctf_field_type_compare(field_type, stream_class->event_context_type)) { ret = -1; goto end; } bt_get(stream_event_context); BT_MOVE(event->stream_event_context, stream_event_context); end: BT_PUT(stream_class); bt_put(field_type); return ret; }
struct bt_config *bt_config_cli_args_create_with_default(int argc, const char *argv[], int *retcode) { struct bt_value *initial_plugin_paths; struct bt_config *cfg = NULL; int ret; initial_plugin_paths = bt_value_array_create(); if (!initial_plugin_paths) { goto error; } ret = bt_config_append_plugin_paths(initial_plugin_paths, CONFIG_IN_TREE_PLUGIN_PATH); if (ret) { goto error; } cfg = bt_config_cli_args_create(argc, argv, retcode, true, true, BT_ENABLE_DEBUG_INFO == 0, initial_plugin_paths); goto end; error: *retcode = 1; BT_PUT(cfg); end: bt_put(initial_plugin_paths); return cfg; }
int bt_ctf_stream_append_event(struct bt_ctf_stream *stream, struct bt_ctf_event *event) { int ret = 0; if (!stream || !event || stream->pos.fd < 0) { ret = -1; goto end; } /* * The event is not supposed to have a parent stream at this * point. The only other way an event can have a parent stream * is if it was assigned when setting a packet to the event, * in which case the packet's stream is not a writer stream, * and thus the user is trying to append an event which belongs * to another stream. */ if (event->base.parent) { ret = -1; goto end; } bt_object_set_parent(event, stream); ret = bt_ctf_event_populate_event_header(event); if (ret) { goto error; } /* Make sure the various scopes of the event are set */ ret = bt_ctf_event_validate(event); if (ret) { goto error; } /* Save the new event and freeze it */ bt_ctf_event_freeze(event); g_ptr_array_add(stream->events, event); /* * Event had to hold a reference to its event class as long as it wasn't * part of the same trace hierarchy. From now on, the event and its * class share the same lifetime guarantees and the reference is no * longer needed. */ bt_put(event->event_class); end: return ret; error: /* * Orphan the event; we were not successful in associating it to * a stream. */ bt_object_set_parent(event, NULL); return ret; }
void loop_states(void) { char c; for(;;) { for(;robot_state == CONNECTED;) { //wait for commands if(!bt_rx_empty()) { c = bt_get_block(); if (is_endchar(c)) { char buffer[128]; if (bt_get_command(buffer)) { // interpret command if (interpret_command(buffer) && robot_state == CONNECTED) { tty_puts("COMMAND: "); tty_puts(buffer); tty_puts("\r\n"); } } } } } for(;robot_state == DISCONNECTED;) { //loopback BLUETOOTH <--> UART1 interface (ttyUSB) if (!tty_rx_empty()) { c = tty_get_noblock(); bt_put(c); } if(!bt_rx_empty()) { c = bt_get_noblock(); tty_put(c); //still check for commands as connected disconnected if (is_endchar(c)) { char buffer[128]; if (bt_get_command(buffer)) { interpret_command(buffer); } } } } } }
static int get_event_header_timestamp(struct bt_ctf_field *event_header, uint64_t *timestamp) { int ret = 0; struct bt_ctf_field *timestamp_field = NULL; struct bt_ctf_field_type *timestamp_field_type = NULL; timestamp_field = bt_ctf_field_structure_get_field(event_header, "timestamp"); if (!timestamp_field) { ret = -1; 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) { ret = -1; goto end; } if (bt_ctf_field_type_integer_get_signed(timestamp_field_type)) { int64_t val; ret = bt_ctf_field_signed_integer_get_value(timestamp_field, &val); if (ret) { goto end; } *timestamp = (uint64_t) val; } else { ret = bt_ctf_field_unsigned_integer_get_value(timestamp_field, timestamp); if (ret) { goto end; } } end: bt_put(timestamp_field); bt_put(timestamp_field_type); return ret; }
static int set_packet_header_stream_id(struct bt_ctf_stream *stream) { int ret = 0; uint32_t stream_id; struct bt_ctf_field_type *stream_id_field_type = NULL; struct bt_ctf_field *stream_id_field = bt_ctf_field_structure_get_field( stream->packet_header, "stream_id"); if (!stream_id_field) { /* No stream_id field found. Not an error, skip. */ goto end; } if (!bt_ctf_field_validate(stream_id_field)) { /* Value already set. 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) { /* stream_id field is not an integer. Not an error, skip. */ goto end; } stream_id = stream->stream_class->id; ret = bt_ctf_field_type_integer_get_signed(stream_id_field_type); assert(ret >= 0); if (ret) { ret = bt_ctf_field_signed_integer_set_value(stream_id_field, (int64_t) stream_id); } else { ret = bt_ctf_field_unsigned_integer_set_value(stream_id_field, (uint64_t) stream_id); } end: bt_put(stream_id_field); bt_put(stream_id_field_type); return ret; }
BT_HIDDEN void debug_info_handle_event(FILE *err, struct bt_event *event, struct debug_info *debug_info) { struct bt_event_class *event_class; const char *event_name; GQuark q_event_name; if (!debug_info || !event) { goto end; } event_class = bt_event_get_class(event); if (!event_class) { goto end; } event_name = bt_event_class_get_name(event_class); if (!event_name) { goto end_put_class; } q_event_name = g_quark_try_string(event_name); if (q_event_name == debug_info->q_statedump_bin_info) { /* State dump */ handle_statedump_bin_info_event(err, debug_info, event); } else if (q_event_name == debug_info->q_dl_open || q_event_name == debug_info->q_lib_load) { /* * dl_open and lib_load events are both checked for since * only dl_open was produced as of lttng-ust 2.8. * * lib_load, which is produced from lttng-ust 2.9+, is a lot * more reliable since it will be emitted when other functions * of the dlopen family are called (e.g. dlmopen) and when * library are transitively loaded. */ handle_lib_load_event(err, debug_info, event); } else if (q_event_name == debug_info->q_statedump_start) { /* Start state dump */ handle_statedump_start(err, debug_info, event); } else if (q_event_name == debug_info->q_statedump_debug_link) { /* Debug link info */ handle_statedump_debug_link_event(err, debug_info, event); } else if (q_event_name == debug_info->q_statedump_build_id) { /* Build ID info */ handle_statedump_build_id_event(err, debug_info, event); } else if (q_event_name == debug_info-> q_lib_unload) { handle_lib_unload_event(err, debug_info, event); } end_put_class: bt_put(event_class); end: return; }
static void init_weak_refs(struct bt_ctf_trace *tc, struct bt_ctf_trace **tc1, struct bt_ctf_stream_class **sc1, struct bt_ctf_stream_class **sc2, struct bt_ctf_event_class **ec1, struct bt_ctf_event_class **ec2, struct bt_ctf_event_class **ec3) { *tc1 = tc; *sc1 = bt_ctf_trace_get_stream_class(tc, 0); *sc2 = bt_ctf_trace_get_stream_class(tc, 1); *ec1 = bt_ctf_stream_class_get_event_class(*sc1, 0); *ec2 = bt_ctf_stream_class_get_event_class(*sc1, 1); *ec3 = bt_ctf_stream_class_get_event_class(*sc2, 0); bt_put(*sc1); bt_put(*sc2); bt_put(*ec1); bt_put(*ec2); bt_put(*ec3); }
void bt_event_destroy(struct bt_object *obj) { struct bt_event *event; event = container_of(obj, struct bt_event, base); BT_LOGD("Destroying event: addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, event, bt_event_class_get_name(event->event_class), bt_event_class_get_id(event->event_class)); if (!event->base.parent) { /* * Event was keeping a reference to its class since it shared no * common ancestor with it to guarantee they would both have the * same lifetime. */ bt_put(event->event_class); } g_hash_table_destroy(event->clock_values); BT_LOGD_STR("Putting event's header field."); bt_put(event->event_header); BT_LOGD_STR("Putting event's stream event context field."); bt_put(event->stream_event_context); BT_LOGD_STR("Putting event's context field."); bt_put(event->context_payload); BT_LOGD_STR("Putting event's payload field."); bt_put(event->fields_payload); BT_LOGD_STR("Putting event's packet."); bt_put(event->packet); g_free(event); }
static enum bt_btr_status read_basic_enum_and_call_cb(struct bt_btr *btr, const uint8_t *buf, size_t at) { struct bt_field_type *int_field_type; enum bt_btr_status status = BT_BTR_STATUS_OK; int_field_type = bt_field_type_enumeration_get_container_type( btr->cur_basic_field_type); assert(int_field_type); status = read_basic_int_and_call(btr, buf, at, int_field_type, btr->cur_basic_field_type); bt_put(int_field_type); return status; }
int bt_ctf_stream_set_event_context(struct bt_ctf_stream *stream, struct bt_ctf_field *field) { int ret = 0; struct bt_ctf_field_type *field_type = NULL; if (!stream || !field) { ret = -1; goto end; } field_type = bt_ctf_field_get_type(field); if (field_type != stream->stream_class->event_context_type) { ret = -1; goto end; } bt_get(field); bt_put(stream->event_context); stream->event_context = field; end: bt_put(field_type); return ret; }
int bt_ctf_stream_set_packet_header(struct bt_ctf_stream *stream, struct bt_ctf_field *field) { int ret = 0; struct bt_ctf_field_type *field_type = NULL; if (!stream || !field) { ret = -1; goto end; } field_type = bt_ctf_field_get_type(field); if (field_type != stream->trace->packet_header_type) { ret = -1; goto end; } bt_get(field); bt_put(stream->packet_header); stream->packet_header = field; end: bt_put(field_type); return ret; }
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; }
BT_HIDDEN int bt_ctf_event_class_set_payload_type(struct bt_ctf_event_class *event_class, struct bt_ctf_field_type *payload) { int ret = 0; if (!event_class || !payload || bt_ctf_field_type_get_type_id(payload) != CTF_TYPE_STRUCT) { ret = -1; goto end; } bt_get(payload); bt_put(event_class->fields); event_class->fields = payload; end: return ret; }