#include "data-stream-file.h"
#include "file.h"
#include "../common/metadata/decoder.h"
+#include "../common/notif-iter/notif-iter.h"
#include "query.h"
#define BT_LOG_TAG "PLUGIN-CTF-FS-SRC"
ctf_fs_ds_file_destroy(notif_iter_data->ds_file);
notif_iter_data->ds_file = ctf_fs_ds_file_create(
notif_iter_data->ds_file_group->ctf_fs_trace,
+ notif_iter_data->notif_iter,
notif_iter_data->ds_file_group->stream,
ds_file_info->path->str);
if (!notif_iter_data->ds_file) {
}
ctf_fs_ds_file_destroy(notif_iter_data->ds_file);
+
+ if (notif_iter_data->notif_iter) {
+ bt_ctf_notif_iter_destroy(notif_iter_data->notif_iter);
+ }
+
g_free(notif_iter_data);
}
goto error;
}
+ notif_iter_data->notif_iter = bt_ctf_notif_iter_create(
+ port_data->ds_file_group->ctf_fs_trace->metadata->trace,
+ bt_common_get_page_size() * 8,
+ ctf_fs_ds_file_medops, NULL);
+ if (!notif_iter_data->notif_iter) {
+ BT_LOGE_STR("Cannot create a CTF notification iterator.");
+ ret = BT_NOTIFICATION_ITERATOR_STATUS_NOMEM;
+ goto error;
+ }
+
notif_iter_data->ds_file_group = port_data->ds_file_group;
iret = notif_iter_data_set_current_ds_file(notif_iter_data);
if (iret) {
bool add_group = false;
int ret;
size_t i;
- struct ctf_fs_ds_file *ds_file;
+ struct ctf_fs_ds_file *ds_file = NULL;
struct ctf_fs_ds_index *index = NULL;
+ struct bt_ctf_notif_iter *notif_iter = NULL;
- ds_file = ctf_fs_ds_file_create(ctf_fs_trace, NULL, path);
+ notif_iter = bt_ctf_notif_iter_create(ctf_fs_trace->metadata->trace,
+ bt_common_get_page_size() * 8, ctf_fs_ds_file_medops, NULL);
+ if (!notif_iter) {
+ BT_LOGE_STR("Cannot create a CTF notification iterator.");
+ goto error;
+ }
+
+ ds_file = ctf_fs_ds_file_create(ctf_fs_trace, notif_iter, NULL, path);
if (!ds_file) {
goto error;
}
g_ptr_array_add(ctf_fs_trace->ds_file_groups, ds_file_group);
}
ctf_fs_ds_file_destroy(ds_file);
+
+ if (notif_iter) {
+ bt_ctf_notif_iter_destroy(notif_iter);
+ }
+
ctf_fs_ds_index_destroy(index);
bt_put(packet_header_field);
bt_put(packet_context_field);
BT_HIDDEN
struct ctf_fs_trace *ctf_fs_trace_create(const char *path, const char *name,
- struct metadata_overrides *overrides)
+ struct ctf_fs_metadata_config *metadata_config)
{
struct ctf_fs_trace *ctf_fs_trace;
int ret;
goto error;
}
- ret = ctf_fs_metadata_set_trace(ctf_fs_trace, overrides);
+ ret = ctf_fs_metadata_set_trace(ctf_fs_trace, metadata_config);
if (ret) {
goto error;
}
GList *trace_names = NULL;
GList *tp_node;
GList *tn_node;
- struct metadata_overrides metadata_overrides = {
- .clock_offset_s = ctf_fs->options.clock_offset,
- .clock_offset_ns = ctf_fs->options.clock_offset_ns,
- };
norm_path = bt_common_normalize_path(path_param, NULL);
if (!norm_path) {
GString *trace_name = tn_node->data;
ctf_fs_trace = ctf_fs_trace_create(trace_path->str,
- trace_name->str, &metadata_overrides);
+ trace_name->str, &ctf_fs->metadata_config);
if (!ctf_fs_trace) {
BT_LOGE("Cannot create trace for `%s`.",
trace_path->str);
ret = bt_value_string_get(value, &path_param);
assert(ret == 0);
BT_PUT(value);
- value = bt_value_map_get(params, "offset-s");
+ value = bt_value_map_get(params, "clock-class-offset-s");
if (value) {
- int64_t offset;
-
if (!bt_value_is_integer(value)) {
- BT_LOGE("offset-s should be an integer");
+ BT_LOGE("clock-class-offset-s should be an integer");
goto error;
}
- ret = bt_value_integer_get(value, &offset);
+ ret = bt_value_integer_get(value,
+ &ctf_fs->metadata_config.clock_class_offset_s);
assert(ret == 0);
- ctf_fs->options.clock_offset = offset;
BT_PUT(value);
}
- value = bt_value_map_get(params, "offset-ns");
+ value = bt_value_map_get(params, "clock-class-offset-ns");
if (value) {
- int64_t offset;
-
if (!bt_value_is_integer(value)) {
- BT_LOGE("offset-ns should be an integer");
+ BT_LOGE("clock-class-offset-ns should be an integer");
goto error;
}
- ret = bt_value_integer_get(value, &offset);
+ ret = bt_value_integer_get(value,
+ &ctf_fs->metadata_config.clock_class_offset_ns);
assert(ret == 0);
- ctf_fs->options.clock_offset_ns = offset;
BT_PUT(value);
}