- int read_fd;
-
- read_fd = index_open(vstream->path_name, vstream->channel_name,
- stream->tracefile_count,
- vstream->current_tracefile_id);
- if (read_fd < 0) {
- goto error_unlock;
- }
- vstream->index_fd = stream_fd_create(read_fd);
- if (!vstream->index_fd) {
- if (close(read_fd)) {
- PERROR("close");
- }
+ const uint32_t connection_major = stream->trace->session->major;
+ const uint32_t connection_minor = stream->trace->session->minor;
+
+ vstream->index_file = lttng_index_file_create_from_trace_chunk_read_only(
+ vstream->stream_file.trace_chunk,
+ stream->path_name,
+ stream->channel_name, stream->tracefile_size,
+ vstream->current_tracefile_id,
+ lttng_to_index_major(connection_major,
+ connection_minor),
+ lttng_to_index_minor(connection_major,
+ connection_minor));
+ if (!vstream->index_file) {