X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-relayd%2Findex.c;h=3cae94e8e57525d37cdddcd3526c010c6105d5cd;hp=92d4581d124a95921694129cba29213c08a7bd90;hb=c35f9726a22f1d93e14589688d830efccda196f3;hpb=7fd975c523ee6e0bb45dcb13b7308b8d9d6406ba diff --git a/src/bin/lttng-relayd/index.c b/src/bin/lttng-relayd/index.c index 92d4581d1..3cae94e8e 100644 --- a/src/bin/lttng-relayd/index.c +++ b/src/bin/lttng-relayd/index.c @@ -27,6 +27,7 @@ #include "lttng-relayd.h" #include "stream.h" #include "index.h" +#include "connection.h" /* * Allocate a new relay index object. Pass the stream in which it is @@ -411,3 +412,28 @@ end: rcu_read_unlock(); return ret; } + +/* + * Set index data from the control port to a given index object. + */ +int relay_index_set_control_data(struct relay_index *index, + const struct lttcomm_relayd_index *data, + unsigned int minor_version) +{ + /* The index on disk is encoded in big endian. */ + const struct ctf_packet_index index_data = { + .packet_size = htobe64(data->packet_size), + .content_size = htobe64(data->content_size), + .timestamp_begin = htobe64(data->timestamp_begin), + .timestamp_end = htobe64(data->timestamp_end), + .events_discarded = htobe64(data->events_discarded), + .stream_id = htobe64(data->stream_id), + }; + + if (minor_version >= 8) { + index->index_data.stream_instance_id = htobe64(data->stream_instance_id); + index->index_data.packet_seq_num = htobe64(data->packet_seq_num); + } + + return relay_index_set_data(index, &index_data); +}