Cleanup: ctf: logically dead code
[babeltrace.git] / src / plugins / ctf / fs-src / data-stream-file.c
index 352efa89711facfff163105bb4f601c0d631a217..4f2c8375f5b32efe1e15eb0474ccd302f80cfced 100644 (file)
@@ -251,7 +251,7 @@ enum bt_msg_iter_medium_status medop_seek(enum bt_msg_iter_seek_whence whence,
 
 map_requested_offset:
        offset_in_mapping = offset %
-               bt_common_get_page_size(ds_file->log_level);
+               bt_mmap_get_offset_align_size(ds_file->log_level);
 
        ds_file->mmap_offset = offset - offset_in_mapping;
        ds_file->request_offset = offset_in_mapping;
@@ -495,6 +495,8 @@ int init_index_entry(struct ctf_fs_ds_index_entry *entry,
        entry->packet_size = packet_size;
 
        if (props->snapshots.beginning_clock != UINT64_C(-1)) {
+               entry->timestamp_begin = props->snapshots.beginning_clock;
+
                /* Convert the packet's bound to nanoseconds since Epoch. */
                ret = convert_cycles_to_ns(sc->default_clock_class,
                                           props->snapshots.beginning_clock,
@@ -504,10 +506,14 @@ int init_index_entry(struct ctf_fs_ds_index_entry *entry,
                        goto end;
                }
        } else {
+               entry->timestamp_begin = UINT64_C(-1);
                entry->timestamp_begin_ns = UINT64_C(-1);
        }
 
        if (props->snapshots.end_clock != UINT64_C(-1)) {
+               entry->timestamp_end = props->snapshots.end_clock;
+
+               /* Convert the packet's bound to nanoseconds since Epoch. */
                ret = convert_cycles_to_ns(sc->default_clock_class,
                                           props->snapshots.end_clock,
                                           &entry->timestamp_end_ns);
@@ -516,6 +522,7 @@ int init_index_entry(struct ctf_fs_ds_index_entry *entry,
                        goto end;
                }
        } else {
+               entry->timestamp_end = UINT64_C(-1);
                entry->timestamp_end_ns = UINT64_C(-1);
        }
 
@@ -540,7 +547,7 @@ struct ctf_fs_ds_index *build_index_from_stream_file(
                goto error;
        }
 
-       do {
+       while (true) {
                off_t current_packet_size_bytes;
                struct ctf_fs_ds_index_entry *index_entry;
                struct bt_msg_iter_packet_properties props;
@@ -610,11 +617,6 @@ struct ctf_fs_ds_index *build_index_from_stream_file(
                        "next-packet-offset=%jd",
                        (intmax_t) (current_packet_offset_bytes - current_packet_size_bytes),
                        (intmax_t) current_packet_offset_bytes);
-
-       } while (iter_status == BT_MSG_ITER_STATUS_OK);
-
-       if (iter_status != BT_MSG_ITER_STATUS_OK) {
-               goto error;
        }
 
 end:
@@ -635,7 +637,7 @@ struct ctf_fs_ds_file *ctf_fs_ds_file_create(
                bt_logging_level log_level)
 {
        int ret;
-       const size_t page_size = bt_common_get_page_size(log_level);
+       const size_t offset_align = bt_mmap_get_offset_align_size(log_level);
        struct ctf_fs_ds_file *ds_file = g_new0(struct ctf_fs_ds_file, 1);
 
        if (!ds_file) {
@@ -665,7 +667,7 @@ struct ctf_fs_ds_file *ctf_fs_ds_file_create(
                goto error;
        }
 
-       ds_file->mmap_max_len = page_size * 2048;
+       ds_file->mmap_max_len = offset_align * 2048;
 
        goto end;
 
This page took 0.025431 seconds and 4 git commands to generate.