ctf: add weak ref to stream file in index entry
[babeltrace.git] / src / plugins / ctf / fs-src / data-stream-file.c
index 4351ae72c1a0566c417c817711ddc8fbca6e8e65..352efa89711facfff163105bb4f601c0d631a217 100644 (file)
@@ -284,7 +284,8 @@ int convert_cycles_to_ns(struct ctf_clock_class *clock_class,
 
 static
 struct ctf_fs_ds_index *build_index_from_idx_file(
-               struct ctf_fs_ds_file *ds_file)
+               struct ctf_fs_ds_file *ds_file,
+               struct ctf_fs_ds_file_info *file_info)
 {
        int ret;
        gchar *directory = NULL;
@@ -403,6 +404,9 @@ struct ctf_fs_ds_index *build_index_from_idx_file(
                        goto error;
                }
 
+               /* Set path to stream file. */
+               index_entry->path = file_info->path->str;
+
                /* Convert size in bits to bytes. */
                packet_size /= CHAR_BIT;
                index_entry->packet_size = packet_size;
@@ -521,7 +525,8 @@ end:
 
 static
 struct ctf_fs_ds_index *build_index_from_stream_file(
-               struct ctf_fs_ds_file *ds_file)
+               struct ctf_fs_ds_file *ds_file,
+               struct ctf_fs_ds_file_info *file_info)
 {
        int ret;
        struct ctf_fs_ds_index *index = NULL;
@@ -588,6 +593,9 @@ struct ctf_fs_ds_index *build_index_from_stream_file(
                        goto error;
                }
 
+               /* Set path to stream file. */
+               index_entry->path = file_info->path->str;
+
                ret = init_index_entry(index_entry, ds_file, &props,
                        current_packet_size_bytes, current_packet_offset_bytes);
                if (ret) {
@@ -672,18 +680,19 @@ end:
 
 BT_HIDDEN
 struct ctf_fs_ds_index *ctf_fs_ds_file_build_index(
-               struct ctf_fs_ds_file *ds_file)
+               struct ctf_fs_ds_file *ds_file,
+               struct ctf_fs_ds_file_info *file_info)
 {
        struct ctf_fs_ds_index *index;
 
-       index = build_index_from_idx_file(ds_file);
+       index = build_index_from_idx_file(ds_file, file_info);
        if (index) {
                goto end;
        }
 
        BT_COMP_LOGI("Failed to build index from .index file; "
                "falling back to stream indexing.");
-       index = build_index_from_stream_file(ds_file);
+       index = build_index_from_stream_file(ds_file, file_info);
 end:
        return index;
 }
This page took 0.031842 seconds and 4 git commands to generate.