Fix: relayd vs consumerd compatibility
[lttng-tools.git] / src / common / index / ctf-index.h
index 8755f1218ad3d114ac8f464051de42d7f92d23af..5d6bd80f4cf11b32ed81574141e4ed7c5854c33a 100644 (file)
@@ -60,4 +60,45 @@ struct ctf_packet_index {
        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 */
This page took 0.02341 seconds and 4 git commands to generate.