This makes the ctf_fs_ds_file type deletable.
Change-Id: Ibaedb136777a39db11a1bd30355c7123e186e489
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8267
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12305
Tested-by: jenkins <jenkins@lttng.org>
/* Check if that file is already the one mapped. */
if (!data->file || data->file->file->path != index_entry->path) {
/* Destroy the previously used file. */
/* Check if that file is already the one mapped. */
if (!data->file || data->file->file->path != index_entry->path) {
/* Destroy the previously used file. */
- ctf_fs_ds_file_destroy(data->file);
/* Create the new file. */
data->file =
/* Create the new file. */
data->file =
- ctf_fs_ds_file_destroy(data->file);
error:
/* Do not touch "borrowed" file. */
error:
/* Do not touch "borrowed" file. */
- ctf_fs_ds_file_destroy(ds_file);
return bt2s::make_unique<ctf_fs_ds_index>();
}
return bt2s::make_unique<ctf_fs_ds_index>();
}
-void ctf_fs_ds_file_destroy(struct ctf_fs_ds_file *ds_file)
+ctf_fs_ds_file::~ctf_fs_ds_file()
- if (!ds_file) {
- return;
- }
-
- (void) ds_file_munmap(ds_file);
-
- delete ds_file;
+ (void) ds_file_munmap(this);
}
ctf_fs_ds_file_info::UP ctf_fs_ds_file_info_create(const char *path, int64_t begin_ns)
}
ctf_fs_ds_file_info::UP ctf_fs_ds_file_info_create(const char *path, int64_t begin_ns)
+ ctf_fs_ds_file(const ctf_fs_ds_file&) = delete;
+ ctf_fs_ds_file& operator=(const ctf_fs_ds_file&) = delete;
+ ~ctf_fs_ds_file();
+
bt2c::Logger logger;
/* Weak */
bt2c::Logger logger;
/* Weak */
struct ctf_fs_ds_file *ctf_fs_ds_file_create(ctf_fs_trace *ctf_fs_trace, bt2::Stream::Shared stream,
const char *path, const bt2c::Logger& logger);
struct ctf_fs_ds_file *ctf_fs_ds_file_create(ctf_fs_trace *ctf_fs_trace, bt2::Stream::Shared stream,
const char *path, const bt2c::Logger& logger);
-void ctf_fs_ds_file_destroy(struct ctf_fs_ds_file *stream);
-
ctf_fs_ds_index::UP ctf_fs_ds_file_build_index(struct ctf_fs_ds_file *ds_file,
struct ctf_fs_ds_file_info *ds_file_info,
struct ctf_msg_iter *msg_iter);
ctf_fs_ds_index::UP ctf_fs_ds_file_build_index(struct ctf_fs_ds_file *ds_file,
struct ctf_fs_ds_file_info *ds_file_info,
struct ctf_msg_iter *msg_iter);
- ctf_fs_ds_file_destroy(ds_file);
if (msg_iter) {
ctf_msg_iter_destroy(msg_iter);
if (msg_iter) {
ctf_msg_iter_destroy(msg_iter);
- if (ds_file) {
- ctf_fs_ds_file_destroy(ds_file);
- }
if (msg_iter) {
ctf_msg_iter_destroy(msg_iter);
}
if (msg_iter) {
ctf_msg_iter_destroy(msg_iter);
}