src.ctf.fs: make ctf_fs_ds_file::file a ctf_fs_file::UP
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 5 Dec 2023 03:08:45 +0000 (03:08 +0000)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 17 Apr 2024 17:57:53 +0000 (13:57 -0400)
Change-Id: Id6a62715e3e2a29216debe1c72986215d7f47459
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8261
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12299

src/plugins/ctf/fs-src/data-stream-file.cpp
src/plugins/ctf/fs-src/data-stream-file.hpp

index cea4a620cab624856e347998d716f5ae39ba782d..d05a04a34fc4b5812e3f680d53fdcf0058b63b5f 100644 (file)
@@ -823,7 +823,7 @@ struct ctf_fs_ds_file *ctf_fs_ds_file_create(struct ctf_fs_trace *ctf_fs_trace,
         goto error;
     }
 
-    ds_file->file = ctf_fs_file_create(parentLogger).release();
+    ds_file->file = ctf_fs_file_create(parentLogger);
     if (!ds_file->file) {
         goto error;
     }
@@ -831,7 +831,7 @@ struct ctf_fs_ds_file *ctf_fs_ds_file_create(struct ctf_fs_trace *ctf_fs_trace,
     ds_file->stream = std::move(stream);
     ds_file->metadata = ctf_fs_trace->metadata;
     g_string_assign(ds_file->file->path, path);
-    ret = ctf_fs_file_open(ds_file->file, "rb");
+    ret = ctf_fs_file_open(ds_file->file.get(), "rb");
     if (ret) {
         goto error;
     }
@@ -879,10 +879,6 @@ void ctf_fs_ds_file_destroy(struct ctf_fs_ds_file *ds_file)
 
     (void) ds_file_munmap(ds_file);
 
-    if (ds_file->file) {
-        ctf_fs_file_destroy(ds_file->file);
-    }
-
     delete ds_file;
 }
 
index bdbf477d88c278d3ac25e5fc354cc8607d798612..a1226474fc71a8ab798695f4b548cf512d6d2c6d 100644 (file)
@@ -21,6 +21,7 @@
 #include "cpp-common/bt2c/logging.hpp"
 
 #include "../common/src/msg-iter/msg-iter.hpp"
+#include "file.hpp"
 
 struct ctf_fs_ds_file_info
 {
@@ -44,8 +45,7 @@ struct ctf_fs_ds_file
     /* Weak */
     struct ctf_fs_metadata *metadata = nullptr;
 
-    /* Owned by this */
-    struct ctf_fs_file *file = nullptr;
+    ctf_fs_file::UP file;
 
     bt2::Stream::Shared stream;
 
This page took 0.027877 seconds and 4 git commands to generate.