doc/api/libbabeltrace2/DoxygenLayout.xml: use `topics` tab
[babeltrace.git] / src / ctfser / ctfser.h
index ac71eac87a67e95040febff7f61cf71e08e5450c..33d48d2042d6cc915faf0dc76e6f148b5832709b 100644 (file)
@@ -1,33 +1,17 @@
-#ifndef BABELTRACE_CTFSER_INTERNAL_H
-#define BABELTRACE_CTFSER_INTERNAL_H
-
 /*
+ * SPDX-License-Identifier: MIT
+ *
  * Copyright 2010-2011 EfficiOS Inc. and Linux Foundation
  * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
  * Copyright 2017-2019 Philippe Proulx <pproulx@efficios.com>
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
  * The Common Trace Format (CTF) Specification is available at
  * http://www.efficios.com/ctf
  */
 
+#ifndef BABELTRACE_CTFSER_INTERNAL_H
+#define BABELTRACE_CTFSER_INTERNAL_H
+
 #include <stdbool.h>
 #include <stdlib.h>
 #include <stdint.h>
@@ -40,7 +24,6 @@
 #include "compat/endian.h"
 #include "common/common.h"
 #include "common/mmap-align.h"
-#include <babeltrace2/types.h>
 #include "common/assert.h"
 #include "common/macros.h"
 #include "compat/bitfield.h"
@@ -69,7 +52,7 @@ struct bt_ctfser {
        uint64_t stream_size_bytes;
 
        /* Memory map base address */
-       struct mmap_align *base_mma;
+       struct mmap_align_data *base_mma;
 
        /* Stream file's path (for debugging) */
        GString *path;
@@ -83,7 +66,7 @@ struct bt_ctfser {
  *
  * This function opens the file `path` for writing.
  */
-BT_HIDDEN
+BT_EXTERN_C
 int bt_ctfser_init(struct bt_ctfser *ctfser, const char *path,
                int log_level);
 
@@ -93,7 +76,7 @@ int bt_ctfser_init(struct bt_ctfser *ctfser, const char *path,
  * This function truncates the stream file so that there's no extra
  * padding after the last packet, and then closes the file.
  */
-BT_HIDDEN
+BT_EXTERN_C
 int bt_ctfser_fini(struct bt_ctfser *ctfser);
 
 /*
@@ -101,17 +84,17 @@ int bt_ctfser_fini(struct bt_ctfser *ctfser);
  *
  * All the next writing functions are performed within this new packet.
  */
-BT_HIDDEN
+BT_EXTERN_C
 int bt_ctfser_open_packet(struct bt_ctfser *ctfser);
 
 /*
  * Closes the current packet, making its size `packet_size_bytes`.
  */
-BT_HIDDEN
+BT_EXTERN_C
 void bt_ctfser_close_current_packet(struct bt_ctfser *ctfser,
                uint64_t packet_size_bytes);
 
-BT_HIDDEN
+BT_EXTERN_C
 int _bt_ctfser_increase_cur_packet_size(struct bt_ctfser *ctfser);
 
 static inline
@@ -180,7 +163,7 @@ int bt_ctfser_align_offset_in_current_packet(struct bt_ctfser *ctfser,
        uint64_t align_size_bits;
 
        BT_ASSERT_DBG(alignment_bits > 0);
-       align_size_bits = ALIGN(ctfser->offset_in_cur_packet_bits,
+       align_size_bits = BT_ALIGN(ctfser->offset_in_cur_packet_bits,
                        alignment_bits) - ctfser->offset_in_cur_packet_bits;
 
        if (G_UNLIKELY(!_bt_ctfser_has_space_left(ctfser, align_size_bits))) {
@@ -420,11 +403,11 @@ int bt_ctfser_write_unsigned_int(struct bt_ctfser *ctfser, uint64_t value,
        }
 
        if (byte_order == LITTLE_ENDIAN) {
-               bt_bitfield_write_le(mmap_align_addr(ctfser->base_mma) +
+               bt_bitfield_write_le((uint8_t *) mmap_align_addr(ctfser->base_mma) +
                        ctfser->mmap_base_offset, uint8_t,
                        ctfser->offset_in_cur_packet_bits, size_bits, value);
        } else {
-               bt_bitfield_write_be(mmap_align_addr(ctfser->base_mma) +
+               bt_bitfield_write_be((uint8_t *) mmap_align_addr(ctfser->base_mma) +
                        ctfser->mmap_base_offset, uint8_t,
                        ctfser->offset_in_cur_packet_bits, size_bits, value);
        }
@@ -465,11 +448,11 @@ int bt_ctfser_write_signed_int(struct bt_ctfser *ctfser, int64_t value,
        }
 
        if (byte_order == LITTLE_ENDIAN) {
-               bt_bitfield_write_le(mmap_align_addr(ctfser->base_mma) +
+               bt_bitfield_write_le((uint8_t *) mmap_align_addr(ctfser->base_mma) +
                        ctfser->mmap_base_offset, uint8_t,
                        ctfser->offset_in_cur_packet_bits, size_bits, value);
        } else {
-               bt_bitfield_write_be(mmap_align_addr(ctfser->base_mma) +
+               bt_bitfield_write_be((uint8_t *) mmap_align_addr(ctfser->base_mma) +
                        ctfser->mmap_base_offset, uint8_t,
                        ctfser->offset_in_cur_packet_bits, size_bits, value);
        }
This page took 0.025141 seconds and 4 git commands to generate.