src.ctf.fs: remove ctf_fs_file_create
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 26 Jul 2022 21:19:35 +0000 (17:19 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 23 Aug 2022 16:06:16 +0000 (12:06 -0400)
Remove this function, it's now just a wrapper around constructing a
ctf_fs_file.

Change-Id: I95e4d6eb26b0d359e0f480cac51af11f3a1db539
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8297
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/plugins/ctf/fs-src/data-stream-file.cpp
src/plugins/ctf/fs-src/file.cpp
src/plugins/ctf/fs-src/file.hpp
src/plugins/ctf/fs-src/fs.cpp
src/plugins/ctf/fs-src/metadata.cpp

index d33d8c86c5806162a21d170ac8fea85508967120..88614d5731ab79b0ba6909a484e061a7ef533314 100644 (file)
@@ -803,11 +803,7 @@ ctf_fs_ds_file::UP ctf_fs_ds_file_create(struct ctf_fs_trace *ctf_fs_trace,
     const size_t offset_align = bt_mmap_get_offset_align_size(logCfg.logLevel());
     ctf_fs_ds_file::UP ds_file = bt2_common::makeUnique<ctf_fs_ds_file>(logCfg);
 
-    ds_file->file = ctf_fs_file_create(logCfg);
-    if (!ds_file->file) {
-        goto error;
-    }
-
+    ds_file->file = bt2_common::makeUnique<ctf_fs_file>(logCfg);
     ds_file->stream = std::move(stream);
     ds_file->metadata = ctf_fs_trace->metadata.get();
     ds_file->file->path = path;
index a56d99e0e81a3a94b346bde3bbc103492e1cc362..d3cc83bc3c0cb8fc8e65cf95beea8d2c26bd725f 100644 (file)
 #include "cpp-common/cfg-logging.hpp"
 #include "cpp-common/cfg-logging-error-reporting.hpp"
 
-BT_HIDDEN
-ctf_fs_file::UP ctf_fs_file_create(const bt2_common::LogCfg& logCfg)
-{
-    return ctf_fs_file::UP {new ctf_fs_file {logCfg}};
-}
-
 BT_HIDDEN
 int ctf_fs_file_open(struct ctf_fs_file *file, const char *mode)
 {
index 269ca6ffea6fe74a6dbcee6de6c61860a312e3e4..db5d6da124d75018210abf1bd645572e7ac96d2b 100644 (file)
@@ -32,9 +32,6 @@ struct ctf_fs_file
     off_t size = 0;
 };
 
-BT_HIDDEN
-ctf_fs_file::UP ctf_fs_file_create(const bt2_common::LogCfg& logCfg);
-
 BT_HIDDEN
 int ctf_fs_file_open(struct ctf_fs_file *file, const char *mode);
 
index 79e313be22b9fd6282cc657b77b75ab7beb6a6a1..9a1b08cabdae8e1457211eefa1a2895f1711fe37 100644 (file)
@@ -628,13 +628,7 @@ static int create_ds_file_groups(struct ctf_fs_trace *ctf_fs_trace)
         }
 
         /* Create the file. */
-        ctf_fs_file::UP file = ctf_fs_file_create(logCfg);
-        if (!file) {
-            BT_CLOGE_APPEND_CAUSE("Cannot create stream file object for file `%s" G_DIR_SEPARATOR_S
-                                  "%s`",
-                                  ctf_fs_trace->path.c_str(), basename);
-            goto error;
-        }
+        ctf_fs_file::UP file = bt2_common::makeUnique<ctf_fs_file>(logCfg);
 
         /* Create full path string. */
         file->path = ctf_fs_trace->path;
index da17c72c08d05d85436eab6c3940422e1a25ceed..52bb8f3702ba5f91ec136d85b5e1e012011593a3 100644 (file)
@@ -22,6 +22,7 @@
 #include "metadata.hpp"
 #include "../common/src/metadata/tsdl/decoder.hpp"
 #include "cpp-common/cfg-logging.hpp"
+#include "cpp-common/make-unique.hpp"
 
 BT_HIDDEN
 FILE *ctf_fs_metadata_open_file(const char *trace_path)
@@ -43,7 +44,7 @@ end:
 
 static ctf_fs_file::UP get_file(const char *trace_path, const bt2_common::LogCfg& logCfg)
 {
-    ctf_fs_file::UP file = ctf_fs_file_create(logCfg);
+    ctf_fs_file::UP file = bt2_common::makeUnique<ctf_fs_file>(logCfg);
 
     if (!file) {
         goto error;
This page took 0.026923 seconds and 5 git commands to generate.