-/*
- * Populate index values of a UST stream. Values are set in big endian order.
- *
- * Return 0 on success or else a negative value.
- */
-static int get_index_values(struct ctf_packet_index *index,
- struct ustctl_consumer_stream *ustream)
-{
- int ret;
- uint64_t packet_size, content_size, timestamp_begin, timestamp_end,
- events_discarded, stream_id, stream_instance_id,
- packet_seq_num;
-
- ret = ustctl_get_timestamp_begin(ustream, ×tamp_begin);
- if (ret < 0) {
- PERROR("ustctl_get_timestamp_begin");
- goto error;
- }
-
- ret = ustctl_get_timestamp_end(ustream, ×tamp_end);
- if (ret < 0) {
- PERROR("ustctl_get_timestamp_end");
- goto error;
- }
-
- ret = ustctl_get_events_discarded(ustream, &events_discarded);
- if (ret < 0) {
- PERROR("ustctl_get_events_discarded");
- goto error;
- }
-
- ret = ustctl_get_content_size(ustream, &content_size);
- if (ret < 0) {
- PERROR("ustctl_get_content_size");
- goto error;
- }
-
- ret = ustctl_get_packet_size(ustream, &packet_size);
- if (ret < 0) {
- PERROR("ustctl_get_packet_size");
- goto error;
- }
-
- ret = ustctl_get_stream_id(ustream, &stream_id);
- if (ret < 0) {
- PERROR("ustctl_get_stream_id");
- goto error;
- }
-
- ret = ustctl_get_instance_id(ustream, &stream_instance_id);
- if (ret < 0) {
- PERROR("ustctl_get_instance_id");
- goto error;
- }
-
- ret = ustctl_get_sequence_number(ustream, &packet_seq_num);
- if (ret < 0) {
- PERROR("ustctl_get_sequence_number");
- goto error;
- }
-
- *index = (typeof(*index)) {
- .offset = index->offset,
- .packet_size = htobe64(packet_size),
- .content_size = htobe64(content_size),
- .timestamp_begin = htobe64(timestamp_begin),
- .timestamp_end = htobe64(timestamp_end),
- .events_discarded = htobe64(events_discarded),
- .stream_id = htobe64(stream_id),
- .stream_instance_id = htobe64(stream_instance_id),
- .packet_seq_num = htobe64(packet_seq_num),
- };
-
-error:
- return ret;
-}
-