port: namespace align.h with BT_ prefix
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 19 Oct 2020 16:37:53 +0000 (12:37 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 28 Oct 2020 18:56:24 +0000 (14:56 -0400)
ALIGN is defined in FreeBSD system includes with an incompatible
signature, namespace our internal version.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ib5b24a7194a0ddbe6eab9aa4f789c612886594f5

src/common/align.h
src/common/mmap-align.h
src/ctfser/ctfser.h
src/plugins/ctf/common/bfcr/bfcr.c
src/plugins/ctf/common/metadata/objstack.c

index 21664986eded8e7458bc8cf7d8a3f9a7b4df672d..a9c88de8ed9e5d9cf47bdbb9b5e4cdb7ed588690 100644 (file)
 #include "compat/compiler.h"
 #include "compat/limits.h"
 
-#define ALIGN(x, a)            __ALIGN_MASK(x, (typeof(x))(a) - 1)
-#define __ALIGN_MASK(x, mask)  (((x) + (mask)) & ~(mask))
-#define PTR_ALIGN(p, a)                ((typeof(p)) ALIGN((unsigned long) (p), a))
-#define ALIGN_FLOOR(x, a)      __ALIGN_FLOOR_MASK(x, (typeof(x)) (a) - 1)
-#define __ALIGN_FLOOR_MASK(x, mask)    ((x) & ~(mask))
-#define PTR_ALIGN_FLOOR(p, a) \
-                       ((typeof(p)) ALIGN_FLOOR((unsigned long) (p), a))
-#define IS_ALIGNED(x, a)       (((x) & ((typeof(x)) (a) - 1)) == 0)
+#define BT_ALIGN(x, a)         __BT_ALIGN_MASK(x, (typeof(x))(a) - 1)
+#define __BT_ALIGN_MASK(x, mask)       (((x) + (mask)) & ~(mask))
+#define BT_PTR_ALIGN(p, a)             ((typeof(p)) BT_ALIGN((unsigned long) (p), a))
+#define BT_ALIGN_FLOOR(x, a)   __BT_ALIGN_FLOOR_MASK(x, (typeof(x)) (a) - 1)
+#define __BT_ALIGN_FLOOR_MASK(x, mask) ((x) & ~(mask))
+#define BT_PTR_ALIGN_FLOOR(p, a) \
+                       ((typeof(p)) BT_ALIGN_FLOOR((unsigned long) (p), a))
+#define BT_IS_ALIGNED(x, a)    (((x) & ((typeof(x)) (a) - 1)) == 0)
 
 /*
  * Align pointer on natural object alignment.
  */
-#define object_align(obj)      PTR_ALIGN(obj, __alignof__(*(obj)))
-#define object_align_floor(obj)        PTR_ALIGN_FLOOR(obj, __alignof__(*(obj)))
+#define bt_object_align(obj)           BT_PTR_ALIGN(obj, __alignof__(*(obj)))
+#define bt_object_align_floor(obj)     BT_PTR_ALIGN_FLOOR(obj, __alignof__(*(obj)))
 
 /**
- * offset_align - Calculate the offset needed to align an object on its natural
- *                alignment towards higher addresses.
+ * bt_offset_align - Calculate the offset needed to align an object on its
+ *                   natural alignment towards higher addresses.
  * @align_drift:  object offset from an "alignment"-aligned address.
  * @alignment:    natural object alignment. Must be non-zero, power of 2.
  *
        })
 
 /**
- * offset_align_floor - Calculate the offset needed to align an object
- *                      on its natural alignment towards lower addresses.
+ * bt_offset_align_floor - Calculate the offset needed to align an object
+ *                         on its natural alignment towards lower addresses.
  * @align_drift:  object offset from an "alignment"-aligned address.
  * @alignment:    natural object alignment. Must be non-zero, power of 2.
  *
  * Returns the offset that must be substracted to align towards lower addresses.
  */
-#define offset_align_floor(align_drift, alignment)                            \
+#define bt_offset_align_floor(align_drift, alignment)                         \
        ({                                                                     \
                MAYBE_BUILD_BUG_ON((alignment) == 0                            \
                                   || ((alignment) & ((alignment) - 1)));      \
index 05ade732ba6291ff1f3ce6a169b962797e487757..7a5ed990493b98b192b39820789a450ac1473004 100644 (file)
@@ -33,7 +33,7 @@ struct mmap_align {
 static inline
 off_t get_page_aligned_offset(off_t offset, int log_level)
 {
-       return ALIGN_FLOOR(offset, bt_mmap_get_offset_align_size(log_level));
+       return BT_ALIGN_FLOOR(offset, bt_mmap_get_offset_align_size(log_level));
 }
 
 static inline
@@ -57,7 +57,7 @@ struct mmap_align *mmap_align(size_t length, int prot,
         * require a 2 pages page_aligned_length if the range crosses a page
         * boundary.
         */
-       mma->page_aligned_length = ALIGN(length + offset - page_aligned_offset, page_size);
+       mma->page_aligned_length = BT_ALIGN(length + offset - page_aligned_offset, page_size);
        mma->page_aligned_addr = bt_mmap(NULL, mma->page_aligned_length,
                prot, flags, fd, page_aligned_offset, log_level);
        if (mma->page_aligned_addr == MAP_FAILED) {
index caffaec8256cc89fdfc9d29a4a0c4e3e4b40dd11..b9e710d909c1093ae05bf5512d5409224e0f08a2 100644 (file)
@@ -164,7 +164,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))) {
index 9eb76dcb1b67e62020047f6e9b3f7e64fdf29a88..e3c851793c74595d8f38f8454deedded463784a0 100644 (file)
@@ -968,7 +968,7 @@ size_t bits_to_skip_to_align_to(struct bt_bfcr *bfcr, size_t align)
 {
        size_t aligned_packet_at;
 
-       aligned_packet_at = ALIGN(packet_at(bfcr), align);
+       aligned_packet_at = BT_ALIGN(packet_at(bfcr), align);
        return aligned_packet_at - packet_at(bfcr);
 }
 
index 2f05b4dec7ba4a685a6fb731b51a135dc217d1f2..a730589d55aaa0e1eb007d603587f4d510a4efc7 100644 (file)
@@ -112,7 +112,7 @@ void *objstack_alloc(struct objstack *objstack, size_t len)
        struct objstack_node *last_node;
        void *p;
 
-       len = ALIGN(len, OBJSTACK_ALIGN);
+       len = BT_ALIGN(len, OBJSTACK_ALIGN);
 
        /* Get last node */
        last_node = bt_list_entry(objstack->head.prev,
This page took 0.027711 seconds and 4 git commands to generate.