X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Findex%2Fctf-index.h;h=5d6bd80f4cf11b32ed81574141e4ed7c5854c33a;hp=1f38d9ab031fc9e08579179d94c573731489d614;hb=f8f3885cc52af9d3c951da78989d6f4a25270411;hpb=7591bab11eceedc6a0d1e02fd6f85592267a63b5 diff --git a/src/common/index/ctf-index.h b/src/common/index/ctf-index.h index 1f38d9ab0..5d6bd80f4 100644 --- a/src/common/index/ctf-index.h +++ b/src/common/index/ctf-index.h @@ -29,7 +29,7 @@ #define CTF_INDEX_MAGIC 0xC1F1DCC1 #define CTF_INDEX_MAJOR 1 -#define CTF_INDEX_MINOR 0 +#define CTF_INDEX_MINOR 1 /* * Header at the beginning of each index file. @@ -54,7 +54,51 @@ struct ctf_packet_index { uint64_t timestamp_begin; uint64_t timestamp_end; uint64_t events_discarded; - uint64_t stream_id; + uint64_t stream_id; /* ID of the channel */ + /* CTF_INDEX 1.0 limit */ + uint64_t stream_instance_id; /* ID of the channel instance */ + uint64_t packet_seq_num; /* packet sequence number */ } __attribute__((__packed__)); +static inline size_t ctf_packet_index_len(uint32_t major, uint32_t minor) +{ + if (major == 1) { + switch (minor) { + case 0: + return offsetof(struct ctf_packet_index, stream_id) + + member_sizeof(struct ctf_packet_index, + stream_id); + case 1: + return offsetof(struct ctf_packet_index, packet_seq_num) + + member_sizeof(struct ctf_packet_index, + packet_seq_num); + default: + abort(); + } + } + abort(); +} + +static inline uint32_t lttng_to_index_major(uint32_t lttng_major, + uint32_t lttng_minor) +{ + if (lttng_major == 2) { + return 1; + } + abort(); +} + +static inline uint32_t lttng_to_index_minor(uint32_t lttng_major, + uint32_t lttng_minor) +{ + if (lttng_major == 2) { + if (lttng_minor < 8) { + return 0; + } else { + return 1; + } + } + abort(); +} + #endif /* LTTNG_INDEX_H */