From: Simon Marchi Date: Tue, 5 Dec 2023 04:40:07 +0000 (+0000) Subject: src.ctf.fs: make ctf_fs_trace::trace a bt2::Trace::Shared X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=e44859b1605db894a61e126468af7b677343ed7c src.ctf.fs: make ctf_fs_trace::trace a bt2::Trace::Shared Change-Id: I4fabe113da7b5adb794377706ab07fac9b59df02 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/8280 Reviewed-by: Philippe Proulx Reviewed-on: https://review.lttng.org/c/babeltrace/+/12318 Tested-by: jenkins --- diff --git a/src/plugins/ctf/fs-src/fs.cpp b/src/plugins/ctf/fs-src/fs.cpp index 22baaf3b..bd0e24b8 100644 --- a/src/plugins/ctf/fs-src/fs.cpp +++ b/src/plugins/ctf/fs-src/fs.cpp @@ -261,8 +261,6 @@ static void ctf_fs_trace_destroy(struct ctf_fs_trace *ctf_fs_trace) return; } - BT_TRACE_PUT_REF_AND_RESET(ctf_fs_trace->trace); - if (ctf_fs_trace->path) { g_string_free(ctf_fs_trace->path, TRUE); } @@ -765,19 +763,22 @@ static ctf_fs_trace::UP ctf_fs_trace_create(const char *path, const char *name, } if (ctf_fs_trace->metadata->trace_class) { - ctf_fs_trace->trace = bt_trace_create(ctf_fs_trace->metadata->trace_class); - if (!ctf_fs_trace->trace) { + bt_trace *trace = bt_trace_create(ctf_fs_trace->metadata->trace_class); + if (!trace) { goto error; } + + ctf_fs_trace->trace = bt2::Trace::Shared::createWithoutRef(trace); } if (ctf_fs_trace->trace) { - ret = ctf_trace_class_configure_ir_trace(ctf_fs_trace->metadata->tc, ctf_fs_trace->trace); + ret = ctf_trace_class_configure_ir_trace(ctf_fs_trace->metadata->tc, + ctf_fs_trace->trace->libObjPtr()); if (ret) { goto error; } - ret = set_trace_name(ctf_fs_trace->trace, name, ctf_fs_trace->logger); + ret = set_trace_name(ctf_fs_trace->trace->libObjPtr(), name, ctf_fs_trace->logger); if (ret) { goto error; } @@ -1783,13 +1784,15 @@ static int create_streams_for_trace(struct ctf_fs_trace *ctf_fs_trace) if (ds_file_group->stream_id == UINT64_C(-1)) { /* No stream ID: use 0 */ - stream = bt_stream_create_with_id(ds_file_group->sc->ir_sc, ctf_fs_trace->trace, - ctf_fs_trace->next_stream_id); + stream = + bt_stream_create_with_id(ds_file_group->sc->ir_sc, ctf_fs_trace->trace->libObjPtr(), + ctf_fs_trace->next_stream_id); ctf_fs_trace->next_stream_id++; } else { /* Specific stream ID */ - stream = bt_stream_create_with_id(ds_file_group->sc->ir_sc, ctf_fs_trace->trace, - (uint64_t) ds_file_group->stream_id); + stream = + bt_stream_create_with_id(ds_file_group->sc->ir_sc, ctf_fs_trace->trace->libObjPtr(), + (uint64_t) ds_file_group->stream_id); } if (!stream) { diff --git a/src/plugins/ctf/fs-src/fs.hpp b/src/plugins/ctf/fs-src/fs.hpp index 97a83573..0607d3f2 100644 --- a/src/plugins/ctf/fs-src/fs.hpp +++ b/src/plugins/ctf/fs-src/fs.hpp @@ -58,8 +58,7 @@ struct ctf_fs_trace /* Owned by this */ struct ctf_fs_metadata *metadata = nullptr; - /* Owned by this */ - bt_trace *trace = nullptr; + bt2::Trace::Shared trace; std::vector ds_file_groups;