#define BT_LOG_TAG "CTF-WRITER-STREAM"
#include <babeltrace/lib-logging-internal.h>
-#include <babeltrace/ref.h>
-#include <babeltrace/ctf-ir/event-class-internal.h>
-#include <babeltrace/ctf-writer/writer-internal.h>
-#include <babeltrace/ctf-writer/stream.h>
-#include <babeltrace/ctf-writer/stream-internal.h>
-#include <babeltrace/ctf-writer/stream-class-internal.h>
+#include <babeltrace/assert-pre-internal.h>
+#include <babeltrace/align-internal.h>
+#include <babeltrace/assert-internal.h>
+#include <babeltrace/compiler-internal.h>
+#include <babeltrace/ctf-writer/event-class-internal.h>
+#include <babeltrace/ctf-writer/event-internal.h>
#include <babeltrace/ctf-writer/field-types.h>
#include <babeltrace/ctf-writer/fields-internal.h>
+#include <babeltrace/ctf-writer/stream-class-internal.h>
+#include <babeltrace/ctf-writer/stream-class.h>
+#include <babeltrace/ctf-writer/stream-internal.h>
+#include <babeltrace/ctf-writer/stream.h>
#include <babeltrace/ctf-writer/trace-internal.h>
-#include <babeltrace/ctf-writer/event-internal.h>
-#include <babeltrace/compiler-internal.h>
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/assert-pre-internal.h>
-#include <unistd.h>
-#include <stdint.h>
+#include <babeltrace/ctf-writer/trace.h>
+#include <babeltrace/ctf-writer/writer-internal.h>
+#include <babeltrace/ctf-writer/object.h>
#include <inttypes.h>
+#include <stdint.h>
+#include <unistd.h>
+
+BT_HIDDEN
+void bt_ctf_stream_common_finalize(struct bt_ctf_stream_common *stream)
+{
+ BT_LOGD("Finalizing common stream object: addr=%p, name=\"%s\"",
+ stream, bt_ctf_stream_common_get_name(stream));
+
+ if (stream->name) {
+ g_string_free(stream->name, TRUE);
+ }
+}
+
+BT_HIDDEN
+int bt_ctf_stream_common_initialize(
+ struct bt_ctf_stream_common *stream,
+ struct bt_ctf_stream_class_common *stream_class, const char *name,
+ uint64_t id, bt_ctf_object_release_func release_func)
+{
+ int ret = 0;
+ struct bt_ctf_trace_common *trace = NULL;
+
+ bt_ctf_object_init_shared_with_parent(&stream->base, release_func);
+
+ if (!stream_class) {
+ BT_LOGW_STR("Invalid parameter: stream class is NULL.");
+ goto error;
+ }
+
+ BT_LOGD("Initializing common stream object: stream-class-addr=%p, "
+ "stream-class-name=\"%s\", stream-name=\"%s\", "
+ "stream-id=%" PRIu64,
+ stream_class, bt_ctf_stream_class_common_get_name(stream_class),
+ name, id);
+ trace = bt_ctf_stream_class_common_borrow_trace(stream_class);
+ if (!trace) {
+ BT_LOGW("Invalid parameter: cannot create stream from a stream class which is not part of trace: "
+ "stream-class-addr=%p, stream-class-name=\"%s\", "
+ "stream-name=\"%s\"",
+ stream_class,
+ bt_ctf_stream_class_common_get_name(stream_class), name);
+ goto error;
+ }
+
+ if (id != -1ULL) {
+ /*
+ * Validate that the given ID is unique amongst all the
+ * existing trace's streams created from the same stream
+ * class.
+ */
+ size_t i;
+
+ for (i = 0; i < trace->streams->len; i++) {
+ struct bt_ctf_stream_common *trace_stream =
+ g_ptr_array_index(trace->streams, i);
+
+ if (trace_stream->stream_class != (void *) stream_class) {
+ continue;
+ }
+
+ if (trace_stream->id == id) {
+ BT_LOGW_STR("Invalid parameter: another stream in the same trace already has this ID.");
+ goto error;
+ }
+ }
+ }
+
+ /*
+ * Acquire reference to parent since stream will become publicly
+ * reachable; it needs its parent to remain valid.
+ */
+ bt_ctf_object_set_parent(&stream->base, &trace->base);
+ stream->stream_class = stream_class;
+ stream->id = (int64_t) id;
+
+ if (name) {
+ stream->name = g_string_new(name);
+ if (!stream->name) {
+ BT_LOGE_STR("Failed to allocate a GString.");
+ goto error;
+ }
+ }
+
+ BT_LOGD("Set common stream's trace parent: trace-addr=%p", trace);
+
+ /* Add this stream to the trace's streams */
+ BT_LOGD("Created common stream object: addr=%p", stream);
+ goto end;
+
+error:
+ ret = -1;
+
+end:
+ return ret;
+}
static
-void bt_ctf_stream_destroy(struct bt_object *obj);
+void bt_ctf_stream_destroy(struct bt_ctf_object *obj);
static
int try_set_structure_field_integer(struct bt_ctf_field *, char *, uint64_t);
BT_LOGW("Invalid parameter: field's type is not an integer field type: "
"field-addr=%p, ft-addr=%p, ft-id=%s",
field, field_type,
- bt_common_field_type_id_string((int)
+ bt_ctf_field_type_id_string((int)
bt_ctf_field_type_get_type_id(field_type)));
ret = -1;
goto end;
}
}
end:
- bt_put(field_type);
+ bt_ctf_object_put_ref(field_type);
return ret;
}
magic_field, (uint64_t) magic_value);
}
end:
- bt_put(magic_field);
+ bt_ctf_object_put_ref(magic_field);
return ret;
}
goto end;
}
- trace = (struct bt_ctf_trace *) bt_object_get_parent(stream);
+ trace = (struct bt_ctf_trace *)
+ bt_ctf_object_get_parent(&stream->common.base);
+
for (i = 0; i < 16; i++) {
struct bt_ctf_field *uuid_element =
bt_ctf_field_array_get_field(uuid_field, i);
ret = bt_ctf_field_integer_unsigned_set_value(
uuid_element, (uint64_t) trace->common.uuid[i]);
- bt_put(uuid_element);
+ bt_ctf_object_put_ref(uuid_element);
if (ret) {
BT_LOGW("Cannot set integer field's value (for `uuid` packet header field): "
"stream-addr=%p, stream-name=\"%s\", field-addr=%p, "
stream, bt_ctf_stream_get_name(stream), uuid_field);
end:
- bt_put(uuid_field);
- BT_PUT(trace);
+ bt_ctf_object_put_ref(uuid_field);
+ BT_CTF_OBJECT_PUT_REF_AND_RESET(trace);
return ret;
}
static
}
end:
- bt_put(stream_id_field);
+ bt_ctf_object_put_ref(stream_id_field);
return ret;
}
}
end:
- bt_put(field);
+ bt_ctf_object_put_ref(field);
return ret;
}
}
end:
- bt_put(field);
+ bt_ctf_object_put_ref(field);
return ret;
}
}
end:
- bt_put(field);
+ bt_ctf_object_put_ref(field);
return ret;
}
int visit_field_update_clock_value(struct bt_ctf_field *field, uint64_t *val)
{
int ret = 0;
- struct bt_field_common *field_common = (void *) field;
+ struct bt_ctf_field_common *field_common = (void *) field;
if (!field) {
goto end;
goto end;
}
- bt_put(cc);
+ bt_ctf_object_put_ref(cc);
val_size = bt_ctf_field_type_integer_get_size(
(void *) field_common->type);
BT_ASSERT(val_size >= 1);
BT_ASSERT(int_field);
ret = visit_field_update_clock_value(int_field, val);
- bt_put(int_field);
+ bt_ctf_object_put_ref(int_field);
break;
}
case BT_CTF_FIELD_TYPE_ID_ARRAY:
BT_ASSERT(elem_field);
ret = visit_field_update_clock_value(elem_field, val);
- bt_put(elem_field);
+ bt_ctf_object_put_ref(elem_field);
if (ret) {
goto end;
}
case BT_CTF_FIELD_TYPE_ID_SEQUENCE:
{
uint64_t i;
- int64_t len = bt_field_common_sequence_get_int_length(
+ int64_t len = bt_ctf_field_common_sequence_get_length(
(void *) field);
if (len < 0) {
BT_ASSERT(elem_field);
ret = visit_field_update_clock_value(elem_field, val);
- bt_put(elem_field);
+ bt_ctf_object_put_ref(elem_field);
if (ret) {
goto end;
}
BT_ASSERT(member_field);
ret = visit_field_update_clock_value(member_field, val);
- bt_put(member_field);
+ bt_ctf_object_put_ref(member_field);
if (ret) {
goto end;
}
}
ret = visit_field_update_clock_value(cur_field, val);
- bt_put(cur_field);
+ bt_ctf_object_put_ref(cur_field);
break;
}
default:
field = bt_ctf_event_get_header(event);
ret = visit_field_update_clock_value(field, val);
- bt_put(field);
+ bt_ctf_object_put_ref(field);
if (ret) {
BT_LOGW_STR("Cannot automatically update clock value in "
"event's header.");
field = bt_ctf_event_get_stream_event_context(event);
ret = visit_field_update_clock_value(field, val);
- bt_put(field);
+ bt_ctf_object_put_ref(field);
if (ret) {
BT_LOGW_STR("Cannot automatically update clock value in "
"event's stream event context.");
field = bt_ctf_event_get_context(event);
ret = visit_field_update_clock_value(field, val);
- bt_put(field);
+ bt_ctf_object_put_ref(field);
if (ret) {
BT_LOGW_STR("Cannot automatically update clock value in "
"event's context.");
field = bt_ctf_event_get_payload_field(event);
ret = visit_field_update_clock_value(field, val);
- bt_put(field);
+ bt_ctf_object_put_ref(field);
if (ret) {
BT_LOGW_STR("Cannot automatically update clock value in "
"event's payload.");
stream->packet_context, "timestamp_begin");
struct bt_ctf_field *ts_end_field = bt_ctf_field_structure_get_field_by_name(
stream->packet_context, "timestamp_end");
- struct bt_field_common *packet_context =
+ struct bt_ctf_field_common *packet_context =
(void *) stream->packet_context;
uint64_t i;
int64_t len;
if (strcmp(member_name, "packet_size") == 0 &&
!bt_ctf_field_is_set_recursive(member_field)) {
- bt_put(member_field);
+ bt_ctf_object_put_ref(member_field);
continue;
}
if (strcmp(member_name, "content_size") == 0 &&
!bt_ctf_field_is_set_recursive(member_field)) {
- bt_put(member_field);
+ bt_ctf_object_put_ref(member_field);
continue;
}
if (strcmp(member_name, "events_discarded") == 0 &&
!bt_ctf_field_is_set_recursive(member_field)) {
- bt_put(member_field);
+ bt_ctf_object_put_ref(member_field);
continue;
}
if (strcmp(member_name, "packet_seq_num") == 0 &&
!bt_ctf_field_is_set_recursive(member_field)) {
- bt_put(member_field);
+ bt_ctf_object_put_ref(member_field);
continue;
}
ret = visit_field_update_clock_value(member_field,
&cur_clock_value);
- bt_put(member_field);
+ bt_ctf_object_put_ref(member_field);
if (ret) {
BT_LOGW("Cannot automatically update clock value "
"in stream's packet context: "
"event-class-name=\"%s\"",
stream, bt_ctf_stream_get_name(stream),
i, event,
- bt_event_class_common_get_id(event->common.class),
- bt_event_class_common_get_name(event->common.class));
+ bt_ctf_event_class_common_get_id(event->common.class),
+ bt_ctf_event_class_common_get_name(event->common.class));
goto end;
}
}
}
end:
- bt_put(ts_begin_field);
- bt_put(ts_end_field);
+ bt_ctf_object_put_ref(ts_begin_field);
+ bt_ctf_object_put_ref(ts_end_field);
return ret;
}
static
void release_event(struct bt_ctf_event *event)
{
- if (bt_object_get_ref_count(event)) {
+ if (bt_ctf_object_get_ref_count(&event->common.base)) {
/*
* The event is being orphaned, but it must guarantee the
* existence of its event class for the duration of its
* lifetime.
*/
- bt_get(event->common.class);
- BT_PUT(event->common.base.parent);
+ bt_ctf_object_get_ref(event->common.class);
+ BT_CTF_OBJECT_PUT_REF_AND_RESET(event->common.base.parent);
} else {
- bt_object_release(event);
+ bt_ctf_object_try_spec_release(&event->common.base);
}
}
g_string_assign(filename, "stream");
append_ids:
- stream_class_id = bt_stream_class_common_get_id(stream->common.stream_class);
+ stream_class_id = bt_ctf_stream_class_common_get_id(stream->common.stream_class);
BT_ASSERT(stream_class_id >= 0);
BT_ASSERT(stream->common.id >= 0);
g_string_append_printf(filename, "-%" PRId64 "-%" PRId64,
id = stream_class->next_stream_id;
}
- ret = bt_stream_common_initialize(BT_TO_COMMON(stream),
- BT_TO_COMMON(stream_class), name, id, bt_ctf_stream_destroy);
+ ret = bt_ctf_stream_common_initialize(BT_CTF_TO_COMMON(stream),
+ BT_CTF_TO_COMMON(stream_class), name, id, bt_ctf_stream_destroy);
if (ret) {
- /* bt_stream_common_initialize() logs errors */
+ /* bt_ctf_stream_common_initialize() logs errors */
goto error;
}
- trace = BT_FROM_COMMON(bt_stream_class_common_borrow_trace(
- BT_TO_COMMON(stream_class)));
+ trace = BT_CTF_FROM_COMMON(bt_ctf_stream_class_common_borrow_trace(
+ BT_CTF_TO_COMMON(stream_class)));
if (!trace) {
BT_LOGW("Invalid parameter: cannot create stream from a stream class which is not part of trace: "
"stream-class-addr=%p, stream-class-name=\"%s\", "
}
stream->pos.fd = -1;
- writer = (struct bt_ctf_writer *) bt_object_get_parent(trace);
+ writer = (struct bt_ctf_writer *)
+ bt_ctf_object_get_parent(&trace->common.base);
stream->last_ts_end = -1ULL;
BT_LOGD("CTF writer stream object belongs writer's trace: "
"writer-addr=%p", writer);
goto end;
error:
- BT_PUT(stream);
+ BT_CTF_OBJECT_PUT_REF_AND_RESET(stream);
end:
- bt_put(writer);
+ bt_ctf_object_put_ref(writer);
return stream;
}
}
end:
- bt_put(events_discarded_field);
+ bt_ctf_object_put_ref(events_discarded_field);
return ret;
}
stream, bt_ctf_stream_get_name(stream), event_count);
end:
- bt_put(events_discarded_field);
+ bt_ctf_object_put_ref(events_discarded_field);
}
static int auto_populate_event_header(struct bt_ctf_stream *stream,
struct bt_ctf_field *id_field = NULL, *timestamp_field = NULL;
struct bt_ctf_clock_class *mapped_clock_class = NULL;
struct bt_ctf_stream_class *stream_class =
- BT_FROM_COMMON(bt_stream_common_borrow_class(
- BT_TO_COMMON(stream)));
+ BT_CTF_FROM_COMMON(bt_ctf_stream_common_borrow_class(
+ BT_CTF_TO_COMMON(stream)));
int64_t event_class_id;
BT_ASSERT(event);
stream, bt_ctf_stream_get_name(stream), event);
id_field = bt_ctf_field_structure_get_field_by_name(
- (void *) event->common.header_field, "id");
- event_class_id = bt_event_class_common_get_id(event->common.class);
+ (void *) event->common.header_field->field, "id");
+ event_class_id = bt_ctf_event_class_common_get_id(event->common.class);
BT_ASSERT(event_class_id >= 0);
if (id_field && bt_ctf_field_get_type_id(id_field) == BT_CTF_FIELD_TYPE_ID_INTEGER) {
* 3. The "timestamp" field is not set.
*/
timestamp_field = bt_ctf_field_structure_get_field_by_name(
- (void *) event->common.header_field, "timestamp");
+ (void *) event->common.header_field->field, "timestamp");
if (timestamp_field && stream_class->clock &&
bt_ctf_field_get_type_id(id_field) == BT_CTF_FIELD_TYPE_ID_INTEGER &&
!bt_ctf_field_is_set_recursive(timestamp_field)) {
mapped_clock_class =
bt_ctf_field_type_integer_get_mapped_clock_class(
- (void *) ((struct bt_field_common *) timestamp_field)->type);
+ (void *) ((struct bt_ctf_field_common *) timestamp_field)->type);
if (mapped_clock_class) {
uint64_t timestamp;
stream, bt_ctf_stream_get_name(stream), event);
end:
- bt_put(id_field);
- bt_put(timestamp_field);
- bt_put(mapped_clock_class);
+ bt_ctf_object_put_ref(id_field);
+ bt_ctf_object_put_ref(timestamp_field);
+ bt_ctf_object_put_ref(mapped_clock_class);
return ret;
}
"stream-addr=%p, stream-name=\"%s\", event-addr=%p, "
"event-class-name=\"%s\", event-class-id=%" PRId64,
stream, bt_ctf_stream_get_name(stream), event,
- bt_event_class_common_get_name(
- bt_event_common_borrow_class(BT_TO_COMMON(event))),
- bt_event_class_common_get_id(
- bt_event_common_borrow_class(BT_TO_COMMON(event))));
+ bt_ctf_event_class_common_get_name(
+ bt_ctf_event_common_borrow_class(BT_CTF_TO_COMMON(event))),
+ bt_ctf_event_class_common_get_id(
+ bt_ctf_event_common_borrow_class(BT_CTF_TO_COMMON(event))));
/*
* The event is not supposed to have a parent stream at this
goto end;
}
- bt_object_set_parent(event, stream);
+ bt_ctf_object_set_parent(&event->common.base, &stream->common.base);
BT_LOGV_STR("Automatically populating the header of the event to append.");
ret = auto_populate_event_header(stream, event);
if (ret) {
/* Make sure the various scopes of the event are set */
BT_LOGV_STR("Validating event to append.");
- ret = bt_event_common_validate(BT_TO_COMMON(event));
- if (ret) {
- goto error;
- }
+ BT_ASSERT_PRE(bt_ctf_event_common_validate(BT_CTF_TO_COMMON(event)) == 0,
+ "Invalid event: event-addr=%p", event);
/* Save the new event and freeze it */
BT_LOGV_STR("Freezing the event to append.");
- bt_event_common_freeze(BT_TO_COMMON(event));
+ bt_ctf_event_common_set_is_frozen(BT_CTF_TO_COMMON(event), true);
g_ptr_array_add(stream->events, event);
/*
* longer needed.
*/
BT_LOGV_STR("Putting the event's class.");
- bt_put(event->common.class);
+ bt_ctf_object_put_ref(event->common.class);
BT_LOGV("Appended event to stream: "
"stream-addr=%p, stream-name=\"%s\", event-addr=%p, "
"event-class-name=\"%s\", event-class-id=%" PRId64,
stream, bt_ctf_stream_get_name(stream), event,
- bt_event_class_common_get_name(
- bt_event_common_borrow_class(BT_TO_COMMON(event))),
- bt_event_class_common_get_id(
- bt_event_common_borrow_class(BT_TO_COMMON(event))));
+ bt_ctf_event_class_common_get_name(
+ bt_ctf_event_common_borrow_class(BT_CTF_TO_COMMON(event))),
+ bt_ctf_event_class_common_get_id(
+ bt_ctf_event_common_borrow_class(BT_CTF_TO_COMMON(event))));
end:
return ret;
* Orphan the event; we were not successful in associating it to
* a stream.
*/
- bt_object_set_parent(event, NULL);
-
+ bt_ctf_object_set_parent(&event->common.base, NULL);
return ret;
}
packet_context = stream->packet_context;
if (packet_context) {
- bt_get(packet_context);
+ bt_ctf_object_get_ref(packet_context);
}
end:
return packet_context;
}
field_type = bt_ctf_field_get_type(field);
- if (bt_field_type_common_compare((void *) field_type,
+ if (bt_ctf_field_type_common_compare((void *) field_type,
stream->common.stream_class->packet_context_field_type)) {
BT_LOGW("Invalid parameter: packet context's field type is different from the stream's packet context field type: "
"stream-addr=%p, stream-name=\"%s\", "
goto end;
}
- bt_put(field_type);
- bt_put(stream->packet_context);
- stream->packet_context = bt_get(field);
+ bt_ctf_object_put_ref(field_type);
+ bt_ctf_object_put_ref(stream->packet_context);
+ stream->packet_context = bt_ctf_object_get_ref(field);
BT_LOGV("Set stream's packet context field: "
"stream-addr=%p, stream-name=\"%s\", "
"packet-context-field-addr=%p",
packet_header = stream->packet_header;
if (packet_header) {
- bt_get(packet_header);
+ bt_ctf_object_get_ref(packet_header);
}
end:
return packet_header;
goto end;
}
- trace = (struct bt_ctf_trace *) bt_object_get_parent(stream);
+ trace = (struct bt_ctf_trace *)
+ bt_ctf_object_get_parent(&stream->common.base);
if (!field) {
if (trace->common.packet_header_field_type) {
field_type = bt_ctf_field_get_type(field);
BT_ASSERT(field_type);
- if (bt_field_type_common_compare((void *) field_type,
+ if (bt_ctf_field_type_common_compare((void *) field_type,
trace->common.packet_header_field_type)) {
BT_LOGW("Invalid parameter: packet header's field type is different from the stream's packet header field type: "
"stream-addr=%p, stream-name=\"%s\", "
}
skip_validation:
- bt_put(stream->packet_header);
- stream->packet_header = bt_get(field);
+ bt_ctf_object_put_ref(stream->packet_header);
+ stream->packet_header = bt_ctf_object_get_ref(field);
BT_LOGV("Set stream's packet header field: "
"stream-addr=%p, stream-name=\"%s\", "
"packet-header-field-addr=%p",
stream, bt_ctf_stream_get_name(stream), field);
end:
- BT_PUT(trace);
- bt_put(field_type);
+ BT_CTF_OBJECT_PUT_REF_AND_RESET(trace);
+ bt_ctf_object_put_ref(field_type);
return ret;
}
member = bt_ctf_field_structure_get_field_by_name(structure, name);
if (member) {
- (void) bt_field_common_reset_recursive((void *) member);
- bt_put(member);
+ bt_ctf_field_common_reset_recursive((void *) member);
+ bt_ctf_object_put_ref(member);
}
}
packet_size_field = bt_ctf_field_structure_get_field_by_name(
stream->packet_context, "packet_size");
has_packet_size = (packet_size_field != NULL);
- bt_put(packet_size_field);
+ bt_ctf_object_put_ref(packet_size_field);
}
if (stream->flushed_packet_count == 1) {
BT_LOGV("Flushing stream's current packet: stream-addr=%p, "
"stream-name=\"%s\", packet-index=%u", stream,
bt_ctf_stream_get_name(stream), stream->flushed_packet_count);
- trace = BT_FROM_COMMON(bt_stream_class_common_borrow_trace(
+ trace = BT_CTF_FROM_COMMON(bt_ctf_stream_class_common_borrow_trace(
stream->common.stream_class));
BT_ASSERT(trace);
native_byte_order = bt_ctf_trace_get_native_byte_order(trace);
struct bt_ctf_event *event = g_ptr_array_index(
stream->events, i);
struct bt_ctf_event_class *event_class =
- BT_FROM_COMMON(bt_event_common_borrow_class(
- BT_TO_COMMON(event)));
+ BT_CTF_FROM_COMMON(bt_ctf_event_common_borrow_class(
+ BT_CTF_TO_COMMON(event)));
BT_LOGV("Serializing event: index=%zu, event-addr=%p, "
"event-class-name=\"%s\", event-class-id=%" PRId64 ", "
if (event->common.header_field) {
BT_LOGV_STR("Serializing event's header field.");
ret = bt_ctf_field_serialize_recursive(
- (void *) event->common.header_field,
+ (void *) event->common.header_field->field,
&stream->pos, native_byte_order);
if (ret) {
BT_LOGW("Cannot serialize event's header field: "
"field-addr=%p",
- event->common.header_field);
+ event->common.header_field->field);
goto end;
}
}
struct bt_ctf_field *field = bt_ctf_field_structure_get_field_by_name(
stream->packet_context, "content_size");
- bt_put(field);
+ bt_ctf_object_put_ref(field);
if (!field) {
if (stream->pos.offset != stream->pos.packet_size) {
BT_LOGW("Stream's packet context's `content_size` field is missing, "
}
static
-void bt_ctf_stream_destroy(struct bt_object *obj)
+void bt_ctf_stream_destroy(struct bt_ctf_object *obj)
{
struct bt_ctf_stream *stream = (void *) obj;
BT_LOGD("Destroying CTF writer stream object: addr=%p, name=\"%s\"",
stream, bt_ctf_stream_get_name(stream));
- bt_stream_common_finalize(BT_TO_COMMON(stream));
+ bt_ctf_stream_common_finalize(BT_CTF_TO_COMMON(stream));
(void) bt_ctf_stream_pos_fini(&stream->pos);
if (stream->pos.fd >= 0) {
}
BT_LOGD_STR("Putting packet header field.");
- bt_put(stream->packet_header);
+ bt_ctf_object_put_ref(stream->packet_header);
BT_LOGD_STR("Putting packet context field.");
- bt_put(stream->packet_context);
+ bt_ctf_object_put_ref(stream->packet_context);
g_free(stream);
}
BT_LOGW("Invalid parameter: field's type is not an integer field type: "
"field-addr=%p, ft-addr=%p, ft-id=%s",
integer, field_type,
- bt_common_field_type_id_string((int)
+ bt_ctf_field_type_id_string((int)
bt_ctf_field_type_get_type_id(field_type)));
ret = -1;
goto end;
}
ret = !ret ? 1 : ret;
end:
- bt_put(integer);
- bt_put(field_type);
+ bt_ctf_object_put_ref(integer);
+ bt_ctf_object_put_ref(field_type);
return ret;
}
struct bt_ctf_stream_class *bt_ctf_stream_get_class(
struct bt_ctf_stream *stream)
{
- return BT_FROM_COMMON(bt_stream_common_get_class(BT_TO_COMMON(stream)));
+ return bt_ctf_object_get_ref(bt_ctf_stream_common_borrow_class(BT_CTF_TO_COMMON(stream)));
}
const char *bt_ctf_stream_get_name(struct bt_ctf_stream *stream)
{
- return bt_stream_common_get_name(BT_TO_COMMON(stream));
+ return bt_ctf_stream_common_get_name(BT_CTF_TO_COMMON(stream));
}
int64_t bt_ctf_stream_get_id(struct bt_ctf_stream *stream)
{
- return bt_stream_common_get_id(BT_TO_COMMON(stream));
+ return bt_ctf_stream_common_get_id(BT_CTF_TO_COMMON(stream));
}