+void ctf_fs_ds_group_medops_data_destroy(
+ struct ctf_fs_ds_group_medops_data *data)
+{
+ if (!data) {
+ goto end;
+ }
+
+ ctf_fs_ds_file_destroy(data->file);
+
+ g_free(data);
+
+end:
+ return;
+}
+
+enum ctf_msg_iter_medium_status ctf_fs_ds_group_medops_data_create(
+ struct ctf_fs_ds_file_group *ds_file_group,
+ bt_self_message_iterator *self_msg_iter,
+ bt_logging_level log_level,
+ struct ctf_fs_ds_group_medops_data **out)
+{
+ struct ctf_fs_ds_group_medops_data *data;
+ enum ctf_msg_iter_medium_status status;
+
+ BT_ASSERT(self_msg_iter);
+ BT_ASSERT(ds_file_group);
+ BT_ASSERT(ds_file_group->index);
+ BT_ASSERT(ds_file_group->index->entries->len > 0);
+
+ data = g_new0(struct ctf_fs_ds_group_medops_data, 1);
+ if (!data) {
+ BT_MSG_ITER_LOGE_APPEND_CAUSE(self_msg_iter,
+ "Failed to allocate a struct ctf_fs_ds_group_medops_data");
+ status = CTF_MSG_ITER_MEDIUM_STATUS_MEMORY_ERROR;
+ goto error;
+ }
+
+ data->ds_file_group = ds_file_group;
+ data->self_msg_iter = self_msg_iter;
+ data->log_level = log_level;
+
+ /*
+ * No need to prepare the first file. ctf_msg_iter will call
+ * switch_packet before reading the first packet, it will be
+ * done then.
+ */
+
+ *out = data;
+ status = CTF_MSG_ITER_MEDIUM_STATUS_OK;
+ goto end;
+
+error:
+ ctf_fs_ds_group_medops_data_destroy(data);
+
+end:
+ return status;
+}
+
+void ctf_fs_ds_group_medops_data_reset(struct ctf_fs_ds_group_medops_data *data)
+{
+ data->next_index_entry_index = 0;
+}
+
+struct ctf_msg_iter_medium_ops ctf_fs_ds_group_medops = {
+ .request_bytes = medop_group_request_bytes,
+ .borrow_stream = medop_group_borrow_stream,
+ .switch_packet = medop_group_switch_packet,
+
+ /*
+ * We don't support seeking using this medops. It would probably be
+ * possible, but it's not needed at the moment.
+ */
+ .seek = NULL,