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>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12333
Tested-by: jenkins <jenkins@lttng.org>
auto ds_file = bt2s::make_unique<ctf_fs_ds_file>(parentLogger);
size_t offset_align;
auto ds_file = bt2s::make_unique<ctf_fs_ds_file>(parentLogger);
size_t offset_align;
- ds_file->file = ctf_fs_file_create(parentLogger);
- if (!ds_file->file) {
- goto error;
- }
-
+ ds_file->file = bt2s::make_unique<ctf_fs_file>(parentLogger);
ds_file->stream = std::move(stream);
ds_file->metadata = ctf_fs_trace->metadata.get();
ds_file->file->path = path;
ds_file->stream = std::move(stream);
ds_file->metadata = ctf_fs_trace->metadata.get();
ds_file->file->path = path;
#include <stdio.h>
#include <sys/stat.h>
#include <stdio.h>
#include <sys/stat.h>
-#include "cpp-common/bt2s/make-unique.hpp"
#include "cpp-common/vendor/fmt/format.h"
#include "file.hpp"
#include "cpp-common/vendor/fmt/format.h"
#include "file.hpp"
-ctf_fs_file::UP ctf_fs_file_create(const bt2c::Logger& parentLogger)
-{
- return bt2s::make_unique<ctf_fs_file>(parentLogger);
-}
-
int ctf_fs_file_open(struct ctf_fs_file *file, const char *mode)
{
int ret = 0;
int ctf_fs_file_open(struct ctf_fs_file *file, const char *mode)
{
int ret = 0;
-ctf_fs_file::UP ctf_fs_file_create(const bt2c::Logger& parentLogger);
-
int ctf_fs_file_open(struct ctf_fs_file *file, const char *mode);
#endif /* CTF_FS_FILE_H */
int ctf_fs_file_open(struct ctf_fs_file *file, const char *mode);
#endif /* CTF_FS_FILE_H */
- const auto file = ctf_fs_file_create(ctf_fs_trace->logger);
- if (!file) {
- BT_CPPLOGE_APPEND_CAUSE_SPEC(
- ctf_fs_trace->logger,
- "Cannot create stream file object for file `{}" G_DIR_SEPARATOR_S "{}`",
- ctf_fs_trace->path, basename);
- goto error;
- }
+ ctf_fs_file file {ctf_fs_trace->logger};
/* Create full path string. */
/* Create full path string. */
- file->path = fmt::format("{}" G_DIR_SEPARATOR_S "{}", ctf_fs_trace->path, basename);
+ file.path = fmt::format("{}" G_DIR_SEPARATOR_S "{}", ctf_fs_trace->path, basename);
- if (!g_file_test(file->path.c_str(), G_FILE_TEST_IS_REGULAR)) {
- BT_CPPLOGI_SPEC(ctf_fs_trace->logger, "Ignoring non-regular file `{}`", file->path);
+ if (!g_file_test(file.path.c_str(), G_FILE_TEST_IS_REGULAR)) {
+ BT_CPPLOGI_SPEC(ctf_fs_trace->logger, "Ignoring non-regular file `{}`", file.path);
- ret = ctf_fs_file_open(file.get(), "rb");
+ ret = ctf_fs_file_open(&file, "rb");
if (ret) {
BT_CPPLOGE_APPEND_CAUSE_SPEC(ctf_fs_trace->logger, "Cannot open stream file `{}`",
if (ret) {
BT_CPPLOGE_APPEND_CAUSE_SPEC(ctf_fs_trace->logger, "Cannot open stream file `{}`",
- BT_CPPLOGI_SPEC(ctf_fs_trace->logger, "Ignoring empty file `{}`", file->path);
+ BT_CPPLOGI_SPEC(ctf_fs_trace->logger, "Ignoring empty file `{}`", file.path);
- ret = add_ds_file_to_ds_file_group(ctf_fs_trace, file->path.c_str());
+ ret = add_ds_file_to_ds_file_group(ctf_fs_trace, file.path.c_str());
if (ret) {
BT_CPPLOGE_APPEND_CAUSE_SPEC(ctf_fs_trace->logger,
"Cannot add stream file `{}` to stream file group",
if (ret) {
BT_CPPLOGE_APPEND_CAUSE_SPEC(ctf_fs_trace->logger,
"Cannot add stream file `{}` to stream file group",
*/
#include "common/assert.h"
*/
#include "common/assert.h"
+#include "cpp-common/bt2s/make-unique.hpp"
#include "../common/src/metadata/tsdl/decoder.hpp"
#include "file.hpp"
#include "../common/src/metadata/tsdl/decoder.hpp"
#include "file.hpp"
static ctf_fs_file::UP get_file(const bt2c::CStringView trace_path, const bt2c::Logger& logger)
{
static ctf_fs_file::UP get_file(const bt2c::CStringView trace_path, const bt2c::Logger& logger)
{
- auto file = ctf_fs_file_create(logger);
+ auto file = bt2s::make_unique<ctf_fs_file>(logger);