#define CTF_FS_DS_FILE_H
#include <glib.h>
-#include <stdbool.h>
#include <stdio.h>
#include <babeltrace2/babeltrace.h>
-#include "common/macros.h"
+#include "cpp-common/bt2c/logging.hpp"
-#include "../common/msg-iter/msg-iter.hpp"
-#include "lttng-index.hpp"
-
-struct ctf_fs_component;
-struct ctf_fs_file;
-struct ctf_fs_trace;
-struct ctf_fs_ds_file;
-struct ctf_fs_ds_file_group;
-struct ctf_fs_ds_group_medops_data;
+#include "../common/src/msg-iter/msg-iter.hpp"
struct ctf_fs_ds_file_info
{
/* Owned by this. */
- GString *path;
+ GString *path = nullptr;
/* Guaranteed to be set, as opposed to the index. */
- int64_t begin_ns;
+ int64_t begin_ns = 0;
};
-struct ctf_fs_metadata;
-
struct ctf_fs_ds_file
{
- bt_logging_level log_level;
+ explicit ctf_fs_ds_file(const bt2c::Logger& parentLogger) :
+ logger {parentLogger, "PLUGIN/SRC.CTF.FS/DS"}
+ {
+ }
- /* Weak */
- bt_self_component *self_comp;
+ bt2c::Logger logger;
/* Weak */
- struct ctf_fs_metadata *metadata;
+ struct ctf_fs_metadata *metadata = nullptr;
/* Owned by this */
- struct ctf_fs_file *file;
+ struct ctf_fs_file *file = nullptr;
/* Owned by this */
- bt_stream *stream;
+ bt_stream *stream = nullptr;
- void *mmap_addr;
+ void *mmap_addr = nullptr;
/*
* Max length of chunk to mmap() when updating the current mapping.
* This value must be page-aligned.
*/
- size_t mmap_max_len;
+ size_t mmap_max_len = 0;
/* Length of the current mapping. Never exceeds the file's length. */
- size_t mmap_len;
+ size_t mmap_len = 0;
/* Offset in the file where the current mapping starts. */
- off_t mmap_offset_in_file;
+ off_t mmap_offset_in_file = 0;
/*
* Offset, in the current mapping, of the address to return on the next
* request.
*/
- off_t request_offset_in_mapping;
+ off_t request_offset_in_mapping = 0;
};
struct ctf_fs_ds_file *ctf_fs_ds_file_create(struct ctf_fs_trace *ctf_fs_trace, bt_stream *stream,
- const char *path, bt_logging_level log_level);
+ const char *path, const bt2c::Logger& logger);
void ctf_fs_ds_file_destroy(struct ctf_fs_ds_file *stream);
struct ctf_fs_ds_file_info *ds_file_info,
struct ctf_msg_iter *msg_iter);
-struct ctf_fs_ds_index *ctf_fs_ds_index_create(bt_logging_level log_level,
- bt_self_component *self_comp);
+struct ctf_fs_ds_index *ctf_fs_ds_index_create(const bt2c::Logger& logger);
void ctf_fs_ds_index_destroy(struct ctf_fs_ds_index *index);
enum ctf_msg_iter_medium_status ctf_fs_ds_group_medops_data_create(
struct ctf_fs_ds_file_group *ds_file_group, bt_self_message_iterator *self_msg_iter,
- bt_logging_level log_level, struct ctf_fs_ds_group_medops_data **out);
+ const bt2c::Logger& logger, struct ctf_fs_ds_group_medops_data **out);
void ctf_fs_ds_group_medops_data_reset(struct ctf_fs_ds_group_medops_data *data);