return stream;
}
-static struct bt_ctf_notif_iter_medium_ops medops = {
+BT_HIDDEN
+struct bt_ctf_notif_iter_medium_ops ctf_fs_ds_file_medops = {
.request_bytes = medop_request_bytes,
.get_stream = medop_get_stream,
};
+
static
struct ctf_fs_ds_index *ctf_fs_ds_index_create(size_t length)
{
BT_HIDDEN
struct ctf_fs_ds_file *ctf_fs_ds_file_create(
struct ctf_fs_trace *ctf_fs_trace,
+ struct bt_ctf_notif_iter *notif_iter,
struct bt_ctf_stream *stream, const char *path)
{
int ret;
goto error;
}
- ds_file->notif_iter = bt_ctf_notif_iter_create(
- ctf_fs_trace->metadata->trace, page_size, medops, ds_file);
+ ds_file->notif_iter = notif_iter;
+ bt_ctf_notif_iter_set_medops_data(ds_file->notif_iter, ds_file);
if (!ds_file->notif_iter) {
goto error;
}
ctf_fs_file_destroy(ds_file->file);
}
- if (ds_file->notif_iter) {
- bt_ctf_notif_iter_destroy(ds_file->notif_iter);
- }
-
g_free(ds_file);
}
/* Owned by this */
struct bt_clock_class_priority_map *cc_prio_map;
- /* Owned by this */
+ /* Weak */
struct bt_ctf_notif_iter *notif_iter;
void *mmap_addr;
BT_HIDDEN
struct ctf_fs_ds_file *ctf_fs_ds_file_create(
struct ctf_fs_trace *ctf_fs_trace,
+ struct bt_ctf_notif_iter *notif_iter,
struct bt_ctf_stream *stream, const char *path);
BT_HIDDEN
BT_HIDDEN
void ctf_fs_ds_index_destroy(struct ctf_fs_ds_index *index);
+extern struct bt_ctf_notif_iter_medium_ops ctf_fs_ds_file_medops;
+
#endif /* CTF_FS_DS_FILE_H */
#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);