diff options
Diffstat (limited to 'include/apos')
| -rw-r--r-- | include/apos/assert.h | 34 | ||||
| -rw-r--r-- | include/apos/atomic.h | 40 | ||||
| -rw-r--r-- | include/apos/debug.h | 2 | ||||
| -rw-r--r-- | include/apos/elf.h | 6 | ||||
| -rw-r--r-- | include/apos/mem.h | 6 | ||||
| -rw-r--r-- | include/apos/uapi.h | 82 | ||||
| -rw-r--r-- | include/apos/unaligned.h | 64 | ||||
| -rw-r--r-- | include/apos/utils.h | 144 | ||||
| -rw-r--r-- | include/apos/vmem.h | 6 |
9 files changed, 192 insertions, 192 deletions
diff --git a/include/apos/assert.h b/include/apos/assert.h index 97523c7..81b267b 100644 --- a/include/apos/assert.h +++ b/include/apos/assert.h @@ -26,13 +26,13 @@ * * @param x Condition to check for. */ -#define catastrophic_assert(x) \ - do { \ - if (unlikely(!(x))) { \ +#define catastrophic_assert(x) \ + do { \ + if (unlikely(!(x))) { \ error("catastrophic assertion failed: " QUOTE(x) "\n"); \ - while (1) { \ - } \ - } \ + while (1) { \ + } \ + } \ } while (0); /** @@ -44,12 +44,12 @@ * @param x Condition to check for. * @param r Return value on failed check. */ -#define hard_assert(x, r) \ - { \ - if (unlikely(!(x))) { \ - warn("hard assertion failed: " QUOTE(x) "\n"); \ - return r; \ - } \ +#define hard_assert(x, r) \ + { \ + if (unlikely(!(x))) { \ + warn("hard assertion failed: " QUOTE(x) "\n"); \ + return r; \ + } \ } /** @@ -57,11 +57,11 @@ * * @param x Condition to check for. */ -#define soft_assert(x) \ - do { \ - if (unlikely(!(x))) { \ - info("soft assertion failed: " QUOTE(x) "\n"); \ - } \ +#define soft_assert(x) \ + do { \ + if (unlikely(!(x))) { \ + info("soft assertion failed: " QUOTE(x) "\n"); \ + } \ } while (0); #else #define catastrophic_assert(x) diff --git a/include/apos/atomic.h b/include/apos/atomic.h index d8d5368..006b4a6 100644 --- a/include/apos/atomic.h +++ b/include/apos/atomic.h @@ -315,7 +315,7 @@ typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t; * @param mode Memory ordering. \see memory_order. * @return Value at \c obj. */ -#define atomic_exchange_explicit(obj, val, mode) \ +#define atomic_exchange_explicit(obj, val, mode) \ N_ATOMIC(exchange)(obj, val, mode) /** @@ -326,7 +326,7 @@ typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t; * @param val Value to be inserted at \c obj. * @return Value at \c obj. */ -#define atomic_exchange(obj, val) \ +#define atomic_exchange(obj, val) \ atomic_exchange_explicit(obj, val, __ATOMIC_SEQ_CST) /** @@ -344,10 +344,10 @@ typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t; * @return \ref true if \c obj and \c val equal, \ref false otherwise. */ #if defined(__GNUC__) -#define atomic_compare_exchange_strong_explicit(obj, val, des, suc, fail) \ +#define atomic_compare_exchange_strong_explicit(obj, val, des, suc, fail) \ N_ATOMIC(compare_exchange)(obj, val, des, 0, suc, fail) #elif defined(__clang__) -#define atomic_compare_exchange_strong_explicit(obj, val, des, suc, fail) \ +#define atomic_compare_exchange_strong_explicit(obj, val, des, suc, fail) \ N_ATOMIC(compare_exchange_strong)(obj, val, des, suc, fail) #endif @@ -361,8 +361,8 @@ typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t; * @param des Value to be copied if \c obj and \c val equal. * @return \ref true if \c obj and \c val equal, \ref false otherwise. */ -#define atomic_compare_exchange_strong(obj, val, des) \ - atomic_compare_exchange_strong_explicit( \ +#define atomic_compare_exchange_strong(obj, val, des) \ + atomic_compare_exchange_strong_explicit( \ obj, val, des, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) /** @@ -381,10 +381,10 @@ typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t; * false otherwise. */ #if defined(__GNUC__) -#define atomic_compare_exchange_weak_explicit(obj, val, des, suc, fail) \ +#define atomic_compare_exchange_weak_explicit(obj, val, des, suc, fail) \ N_ATOMIC(compare_exchange)(obj, val, des, 1, suc, fail) #elif defined(__clang__) -#define atomic_compare_exchange_weak_explicit(obj, val, des, suc, fail) \ +#define atomic_compare_exchange_weak_explicit(obj, val, des, suc, fail) \ N_ATOMIC(compare_exchange_weak)(obj, val, des, suc, fail) #endif @@ -412,7 +412,7 @@ typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t; * @param mode Memory ordering. \see memory_order. * @return Contents of \c obj before addition. */ -#define atomic_fetch_add_explicit(obj, val, mode) \ +#define atomic_fetch_add_explicit(obj, val, mode) \ C11_ATOMIC(fetch_add)(obj, val, mode) /** @@ -423,7 +423,7 @@ typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t; * @param val Value to be added to object. * @return Contents of \c obj before addition. */ -#define atomic_fetch_add(obj, val) \ +#define atomic_fetch_add(obj, val) \ atomic_fetch_add_explicit(obj, val, __ATOMIC_SEQ_CST) /** @@ -435,7 +435,7 @@ typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t; * @param mode Memory ordering. \see memory_order. * @return Contents of \c obj before subtraction. */ -#define atomic_fetch_sub_explicit(obj, val, mode) \ +#define atomic_fetch_sub_explicit(obj, val, mode) \ C11_ATOMIC(fetch_sub)(obj, val, mode) /** @@ -446,7 +446,7 @@ typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t; * @param val Value to be subtracted from object. * @return Contents of \c obj before subtraction. */ -#define atomic_fetch_sub(obj, val) \ +#define atomic_fetch_sub(obj, val) \ atomic_fetch_sub_explicit(obj, val, __ATOMIC_SEQ_CST) /** @@ -458,7 +458,7 @@ typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t; * @param mode Memory ordering. \see memory_order. * @return Contents of \c obj before bitwise \c AND. */ -#define atomic_fetch_and_explicit(obj, val, mode) \ +#define atomic_fetch_and_explicit(obj, val, mode) \ C11_ATOMIC(fetch_and)(obj, val, mode) /** @@ -469,7 +469,7 @@ typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t; * @param val Value to bitwise \c AND with contents of object. * @return Contents of \c obj before bitwise \c AND. */ -#define atomic_fetch_and(obj, val) \ +#define atomic_fetch_and(obj, val) \ atomic_fetch_and_explicit(obj, val, __ATOMIC_SEQ_CST) /** @@ -481,7 +481,7 @@ typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t; * @param mode Memory ordering. \see memory_order. * @return Contents of \c obj before bitwise \c XOR. */ -#define atomic_fetch_xor_explicit(obj, val, mode) \ +#define atomic_fetch_xor_explicit(obj, val, mode) \ C11_ATOMIC(fetch_xor)(obj, val, mode) /** @@ -492,7 +492,7 @@ typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t; * @param val Value to bitwise \c XOR with contents of object. * @return Contents of \c obj before bitwise \c XOR. */ -#define atomic_fetch_xor(obj, val) \ +#define atomic_fetch_xor(obj, val) \ atomic_fetch_xor_explicit(obj, val, __ATOMIC_SEQ_CST) /** @@ -504,7 +504,7 @@ typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t; * @param mode Memory ordering. \see memory_order. * @return Contents of \c obj before bitwise \c OR. */ -#define atomic_fetch_or_explicit(obj, val, mode) \ +#define atomic_fetch_or_explicit(obj, val, mode) \ C11_ATOMIC(fetch_or)(obj, val, mode) /** @@ -515,7 +515,7 @@ typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t; * @param val Value to bitwise \c OR with contents of object. * @return Contents of \c obj before bitwise \c OR. */ -#define atomic_fetch_or(obj, val) \ +#define atomic_fetch_or(obj, val) \ atomic_fetch_or_explicit(obj, val, __ATOMIC_SEQ_CST) /** @@ -527,7 +527,7 @@ typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t; * @param mode Memory ordering. \see memory_order. * @return Contents of \c obj before bitwise \c NAND. */ -#define atomic_fetch_nand_explicit(obj, val, mode) \ +#define atomic_fetch_nand_explicit(obj, val, mode) \ C11_ATOMIC(fetch_nand)(obj, val, mode) /** @@ -538,7 +538,7 @@ typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t; * @param val Value to bitwise \c NAND with contents of object. * @return Contents of \c obj before bitwise \c NAND. */ -#define atomic_fetch_nand(obj, val) \ +#define atomic_fetch_nand(obj, val) \ atomic_fetch_nand_explicit(obj, val, __ATOMIC_SEQ_CST) /* skip atomic flags, probably not needed */ diff --git a/include/apos/debug.h b/include/apos/debug.h index cb46ba7..5935f60 100644 --- a/include/apos/debug.h +++ b/include/apos/debug.h @@ -390,7 +390,7 @@ void setup_io_dbg(struct vmem *vmem); * * @param fmt Message, integer subset of regular printf. */ -#define error(fmt, ...) \ +#define error(fmt, ...) \ dbg(COMMON_FORMAT fmt, COMMON_ARGS("ERROR"),##__VA_ARGS__) #else diff --git a/include/apos/elf.h b/include/apos/elf.h index 1e9a4aa..e6936a3 100644 --- a/include/apos/elf.h +++ b/include/apos/elf.h @@ -187,11 +187,11 @@ struct __packed section64_header { #define section64_header(s) ((struct section64_header *)s) #define section32_header(s) ((struct section32_header *)s) -#define elf_header_prop(c, e, p) \ +#define elf_header_prop(c, e, p) \ (c == ELFCLASS64 ? elf64_header(e)->p : elf32_header(e)->p) -#define program_header_prop(c, e, p) \ +#define program_header_prop(c, e, p) \ (c == ELFCLASS64 ? program64_header(e)->p : program32_header(e)->p) -#define section_header_prop(c, e, p) \ +#define section_header_prop(c, e, p) \ (c == ELFCLASS64 ? section64_header(e)->p : section32_header(e)->p) vm_t load_elf(struct tcb *t, vm_t binary, vm_t interp); diff --git a/include/apos/mem.h b/include/apos/mem.h index 1486400..af0ac89 100644 --- a/include/apos/mem.h +++ b/include/apos/mem.h @@ -11,7 +11,7 @@ #define MM_OINFO_WIDTH (sizeof(mm_info_t) * 8) -#define pnum_to_index(pnum, order) \ +#define pnum_to_index(pnum, order) \ (((pnum) >> __o_offset(order)) & (__o_width(order) - 1)) #define pm_to_index(paddr, \ order) (pnum_to_index(pm_to_pnum(paddr), (order))) @@ -43,8 +43,8 @@ RAM_BASE) #define __page(x) ((x) / BASE_PAGE_SIZE) #define __addr(x) ((x)*BASE_PAGE_SIZE) -#define __pages(x) \ - (is_aligned((x), BASE_PAGE_SIZE) ? __page((x)) : \ +#define __pages(x) \ + (is_aligned((x), BASE_PAGE_SIZE) ? __page((x)) : \ __page((x) + BASE_PAGE_SIZE)) #define __bytes(x) (__addr(x)) diff --git a/include/apos/uapi.h b/include/apos/uapi.h index 9304da7..f0cb9b7 100644 --- a/include/apos/uapi.h +++ b/include/apos/uapi.h @@ -20,55 +20,55 @@ struct sys_ret { sys_arg_t val; }; -#define SYSCALL_DECLARE(name) \ - struct sys_ret sys_##name(sys_arg_t a, sys_arg_t b, sys_arg_t c, \ +#define SYSCALL_DECLARE(name) \ + struct sys_ret sys_##name(sys_arg_t a, sys_arg_t b, sys_arg_t c, \ sys_arg_t d); -#define SYSCALL_DEFINE0(name) \ - static inline struct sys_ret __##name(); \ - struct sys_ret sys_##name(sys_arg_t a, sys_arg_t b, sys_arg_t c, \ - sys_arg_t d) \ - { \ - UNUSED(a); \ - UNUSED(b); \ - UNUSED(c); \ - UNUSED(d); \ - return __##name(); \ - } \ +#define SYSCALL_DEFINE0(name) \ + static inline struct sys_ret __##name(); \ + struct sys_ret sys_##name(sys_arg_t a, sys_arg_t b, sys_arg_t c, \ + sys_arg_t d) \ + { \ + UNUSED(a); \ + UNUSED(b); \ + UNUSED(c); \ + UNUSED(d); \ + return __##name(); \ + } \ static struct sys_ret __##name -#define SYSCALL_DEFINE1(name) \ - static inline struct sys_ret __##name(sys_arg_t); \ - struct sys_ret sys_##name(sys_arg_t a, sys_arg_t b, sys_arg_t c, \ - sys_arg_t d) \ - { \ - UNUSED(b); \ - UNUSED(c); \ - UNUSED(d); \ - return __##name(a); \ - } \ +#define SYSCALL_DEFINE1(name) \ + static inline struct sys_ret __##name(sys_arg_t); \ + struct sys_ret sys_##name(sys_arg_t a, sys_arg_t b, sys_arg_t c, \ + sys_arg_t d) \ + { \ + UNUSED(b); \ + UNUSED(c); \ + UNUSED(d); \ + return __##name(a); \ + } \ static inline struct sys_ret __##name -#define SYSCALL_DEFINE2(name) \ - static inline struct sys_ret __##name(sys_arg_t, sys_arg_t); \ - struct sys_ret sys_##name(sys_arg_t a, sys_arg_t b, sys_arg_t c, \ - sys_arg_t d) \ - { \ - UNUSED(c); \ - UNUSED(d); \ - return __##name(a, b); \ - } \ +#define SYSCALL_DEFINE2(name) \ + static inline struct sys_ret __##name(sys_arg_t, sys_arg_t); \ + struct sys_ret sys_##name(sys_arg_t a, sys_arg_t b, sys_arg_t c, \ + sys_arg_t d) \ + { \ + UNUSED(c); \ + UNUSED(d); \ + return __##name(a, b); \ + } \ static inline struct sys_ret __##name -#define SYSCALL_DEFINE3(name) \ - static inline struct sys_ret __##name(sys_arg_t, sys_arg_t, \ - sys_arg_t); \ - struct sys_ret sys_##name(sys_arg_t a, sys_arg_t b, sys_arg_t c, \ - sys_arg_t d) \ - { \ - UNUSED(d); \ - return __##name(a, b, c); \ - } \ +#define SYSCALL_DEFINE3(name) \ + static inline struct sys_ret __##name(sys_arg_t, sys_arg_t, \ + sys_arg_t); \ + struct sys_ret sys_##name(sys_arg_t a, sys_arg_t b, sys_arg_t c, \ + sys_arg_t d) \ + { \ + UNUSED(d); \ + return __##name(a, b, c); \ + } \ static inline struct sys_ret __##name #define SYSCALL_DEFINE4(name) \ diff --git a/include/apos/unaligned.h b/include/apos/unaligned.h index 94439ca..85d67b0 100644 --- a/include/apos/unaligned.h +++ b/include/apos/unaligned.h @@ -9,35 +9,35 @@ #include <apos/types.h> #include <apos/attrs.h> -#define get_unaligned(ptr) \ - _Generic(*(ptr), uint8_t \ - : __get_unaligned_uint8_t, uint16_t \ - : __get_unaligned_uint16_t, uint32_t \ - : __get_unaligned_uint32_t, uint64_t \ - : __get_unaligned_uint64_t, int8_t \ - : __get_unaligned_int8_t, int16_t \ - : __get_unaligned_int16_t, int32_t \ - : __get_unaligned_int32_t, int64_t \ +#define get_unaligned(ptr) \ + _Generic(*(ptr), uint8_t \ + : __get_unaligned_uint8_t, uint16_t \ + : __get_unaligned_uint16_t, uint32_t \ + : __get_unaligned_uint32_t, uint64_t \ + : __get_unaligned_uint64_t, int8_t \ + : __get_unaligned_int8_t, int16_t \ + : __get_unaligned_int16_t, int32_t \ + : __get_unaligned_int32_t, int64_t \ : __get_unaligned_int64_t)((void *)ptr) -#define put_unaligned(val, ptr) \ - _Generic(*(ptr), uint8_t \ - : __put_unaligned_uint8_t, uint16_t \ - : __put_unaligned_uint16_t, uint32_t \ - : __put_unaligned_uint32_t, uint64_t \ - : __put_unaligned_uint64_t, int8_t \ - : __put_unaligned_int8_t, int16_t \ - : __put_unaligned_int16_t, int32_t \ - : __put_unaligned_int32_t, int64_t \ +#define put_unaligned(val, ptr) \ + _Generic(*(ptr), uint8_t \ + : __put_unaligned_uint8_t, uint16_t \ + : __put_unaligned_uint16_t, uint32_t \ + : __put_unaligned_uint32_t, uint64_t \ + : __put_unaligned_uint64_t, int8_t \ + : __put_unaligned_int8_t, int16_t \ + : __put_unaligned_int16_t, int32_t \ + : __put_unaligned_int32_t, int64_t \ : __put_unaligned_int64_t)(val, (void *)ptr) -#define DEFINE_GET(type) \ - static inline type __get_unaligned_##type(void *ptr) \ - { \ - const struct __packed { \ - type x; \ - } *__pptr = ptr; \ - return __pptr->x; \ +#define DEFINE_GET(type) \ + static inline type __get_unaligned_##type(void *ptr) \ + { \ + const struct __packed { \ + type x; \ + } *__pptr = ptr; \ + return __pptr->x; \ } DEFINE_GET(uint8_t); @@ -51,13 +51,13 @@ DEFINE_GET(int64_t); #undef DEFINE_GET -#define DEFINE_PUT(type) \ - static inline void __put_unaligned_##type(type val, void *ptr) \ - { \ - struct __packed { \ - type x; \ - } *__pptr = ptr; \ - __pptr->x = val; \ +#define DEFINE_PUT(type) \ + static inline void __put_unaligned_##type(type val, void *ptr) \ + { \ + struct __packed { \ + type x; \ + } *__pptr = ptr; \ + __pptr->x = val; \ } DEFINE_PUT(uint8_t); diff --git a/include/apos/utils.h b/include/apos/utils.h index c4a83be..d2b81c0 100644 --- a/include/apos/utils.h +++ b/include/apos/utils.h @@ -10,13 +10,13 @@ #define MAX(a, b) ((a) >= (b) ? (a) : (b)) #define MAX3(a, b, c) (MAX(a, b) >= MAX(b, c) ? MAX(a, b) : MAX(b, c)) -#define MAX4(a, b, c, d) \ +#define MAX4(a, b, c, d) \ (MAX3(a, b, c) >= MAX3(b, c, d) ? MAX3(a, b, c) : MAX3(b, c, d)) /* etc... */ #define MIN(a, b) ((a) <= (b) ? (a) : (b)) #define MIN3(a, b, c) (MIN(a, b) <= MIN(b, c) ? MIN(a, b) : MIN(b, c)) -#define MIN4(a, b, c, d) \ +#define MIN4(a, b, c, d) \ (MIN3(a, b, c) <= MIN3(b, c, d) ? MIN3(a, b, c) : MIN3(b, c, d)) /* etc... */ @@ -45,7 +45,7 @@ #define unlikely(x) (x) #endif -#define container_of(ptr, type, member) \ +#define container_of(ptr, type, member) \ ((type *)((char *)(ptr)-offsetof(type, member))) #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) @@ -56,35 +56,35 @@ #include <apos/types.h> /* clang-format doesn't like _Generic, but I guess that's fine. */ -#define align_up(x, y) \ - _Generic((x), signed char \ - : align_up_c, signed short \ - : align_up_s, signed int \ - : align_up_i, signed long \ - : align_up_l, signed long long \ - : align_up_ll, \ - \ - unsigned char \ - : align_up_uc, unsigned short \ - : align_up_us, unsigned int \ - : align_up_ui, unsigned long \ - : align_up_ul, unsigned long long \ +#define align_up(x, y) \ + _Generic((x), signed char \ + : align_up_c, signed short \ + : align_up_s, signed int \ + : align_up_i, signed long \ + : align_up_l, signed long long \ + : align_up_ll, \ + \ + unsigned char \ + : align_up_uc, unsigned short \ + : align_up_us, unsigned int \ + : align_up_ui, unsigned long \ + : align_up_ul, unsigned long long \ : align_up_ull)((x), (y)) -#define DEFINE_ALIGN_UP(name, type) \ - static inline type align_up_##name(type val, type a) \ - { \ - if (!a) { \ - return val; \ - } \ - \ - type rem = val % a; \ - \ - if (rem == 0) { \ - return val; \ - } \ - \ - return val + a - rem; \ +#define DEFINE_ALIGN_UP(name, type) \ + static inline type align_up_##name(type val, type a) \ + { \ + if (!a) { \ + return val; \ + } \ + \ + type rem = val % a; \ + \ + if (rem == 0) { \ + return val; \ + } \ + \ + return val + a - rem; \ } DEFINE_ALIGN_UP(c, signed char); @@ -99,29 +99,29 @@ DEFINE_ALIGN_UP(ui, unsigned int); DEFINE_ALIGN_UP(ul, unsigned long); DEFINE_ALIGN_UP(ull, unsigned long long); -#define align_down(x, y) \ - _Generic((x), signed char \ - : align_down_c, signed short \ - : align_down_s, signed int \ - : align_down_i, signed long \ - : align_down_l, signed long long \ - : align_down_ll, \ - \ - unsigned char \ - : align_down_uc, unsigned short \ - : align_down_us, unsigned int \ - : align_down_ui, unsigned long \ - : align_down_ul, unsigned long long \ +#define align_down(x, y) \ + _Generic((x), signed char \ + : align_down_c, signed short \ + : align_down_s, signed int \ + : align_down_i, signed long \ + : align_down_l, signed long long \ + : align_down_ll, \ + \ + unsigned char \ + : align_down_uc, unsigned short \ + : align_down_us, unsigned int \ + : align_down_ui, unsigned long \ + : align_down_ul, unsigned long long \ : align_down_ull)((x), (y)) -#define DEFINE_ALIGN_DOWN(name, type) \ - static inline type align_down_##name(type val, type a) \ - { \ - if (!a) { \ - return val; \ - } \ - \ - return val - (val % a); \ +#define DEFINE_ALIGN_DOWN(name, type) \ + static inline type align_down_##name(type val, type a) \ + { \ + if (!a) { \ + return val; \ + } \ + \ + return val - (val % a); \ } DEFINE_ALIGN_DOWN(c, signed char); @@ -136,29 +136,29 @@ DEFINE_ALIGN_DOWN(ui, unsigned int); DEFINE_ALIGN_DOWN(ul, unsigned long); DEFINE_ALIGN_DOWN(ull, unsigned long long); -#define is_aligned(x, y) \ - _Generic((x), signed char \ - : is_aligned_c, signed short \ - : is_aligned_s, signed int \ - : is_aligned_i, signed long \ - : is_aligned_l, signed long long \ - : is_aligned_ll, \ - \ - unsigned char \ - : is_aligned_uc, unsigned short \ - : is_aligned_us, unsigned int \ - : is_aligned_ui, unsigned long \ - : is_aligned_ul, unsigned long long \ +#define is_aligned(x, y) \ + _Generic((x), signed char \ + : is_aligned_c, signed short \ + : is_aligned_s, signed int \ + : is_aligned_i, signed long \ + : is_aligned_l, signed long long \ + : is_aligned_ll, \ + \ + unsigned char \ + : is_aligned_uc, unsigned short \ + : is_aligned_us, unsigned int \ + : is_aligned_ui, unsigned long \ + : is_aligned_ul, unsigned long long \ : is_aligned_ll)((x), (y)) -#define DEFINE_ALIGNED(name, type) \ - static inline bool is_aligned_##name(type val, type a) \ - { \ - if (!a) { \ - return true; \ - } \ - \ - return val % a == 0; \ +#define DEFINE_ALIGNED(name, type) \ + static inline bool is_aligned_##name(type val, type a) \ + { \ + if (!a) { \ + return true; \ + } \ + \ + return val % a == 0; \ } DEFINE_ALIGNED(c, signed char); diff --git a/include/apos/vmem.h b/include/apos/vmem.h index 1451c82..96158be 100644 --- a/include/apos/vmem.h +++ b/include/apos/vmem.h @@ -31,16 +31,16 @@ stat_t clone_allocd_wrapper(struct vmem *b, pm_t *offset, vm_t vaddr, stat_t free_uvmem_wrapper(struct vmem *b, pm_t *offset, vm_t vaddr, vmflags_t flags, enum mm_order order, void *data); -#define map_allocd_region(b, start, bytes, flags, data) \ +#define map_allocd_region(b, start, bytes, flags, data) \ map_fill_region(b, &alloc_uvmem_wrapper, 0, start, bytes, flags, data) -#define map_shared_region(b, start, bytes, flags, data) \ +#define map_shared_region(b, start, bytes, flags, data) \ map_fill_region(b, &alloc_shared_wrapper, 0, start, bytes, flags, data) #define clone_allocd_region(b, start, bytes, flags, data) \ map_fill_region(b, &clone_allocd_wrapper, 0, start, bytes, flags, data) -#define unmap_freed_region(b, start, bytes, flags, data) \ +#define unmap_freed_region(b, start, bytes, flags, data) \ map_fill_region(b, &free_uvmem_wrapper, 0, start, bytes, flags, data) #define vm_flags(x) ((x) & ~0xff) |
