dynamic-array: fix documentation of lttng_dynamic_pointer_array_get_pointer
[lttng-tools.git] / src / common / index / ctf-index.h
index 5d6bd80f4cf11b32ed81574141e4ed7c5854c33a..b96888bb7e5a41067c29b31531316c898034ee5e 100644 (file)
 #ifndef LTTNG_INDEX_H
 #define LTTNG_INDEX_H
 
+#include <common/compat/endian.h>
+#include <common/macros.h>
+
+#include <stdint.h>
 #include <limits.h>
+#include <stddef.h>
 
 #define CTF_INDEX_MAGIC 0xC1F1DCC1
 #define CTF_INDEX_MAJOR 1
@@ -80,7 +85,7 @@ static inline size_t ctf_packet_index_len(uint32_t major, uint32_t minor)
 }
 
 static inline uint32_t lttng_to_index_major(uint32_t lttng_major,
-               uint32_t lttng_minor)
+               uint32_t lttng_minor __attribute__((unused)))
 {
        if (lttng_major == 2) {
                return 1;
@@ -101,4 +106,16 @@ static inline uint32_t lttng_to_index_minor(uint32_t lttng_major,
        abort();
 }
 
+static inline void ctf_packet_index_file_hdr_init(
+               struct ctf_packet_index_file_hdr *hdr,
+               uint32_t idx_major, uint32_t idx_minor)
+{
+       memset(hdr, 0, sizeof(*hdr));
+       hdr->magic = htobe32(CTF_INDEX_MAGIC);
+       hdr->index_major = htobe32(idx_major);
+       hdr->index_minor = htobe32(idx_minor);
+       hdr->packet_index_len = htobe32(
+                       ctf_packet_index_len(idx_major, idx_minor));
+}
+
 #endif /* LTTNG_INDEX_H */
This page took 0.025521 seconds and 5 git commands to generate.