mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-17 20:05:24 +00:00
btrfs-progs: kerncompat: add local definition for alignment macros
There's still problem left with compilation on musl and kernel < 5.11, because __ALIGN_KERNEL is not defined anymore: ../bin/ld: kernel-shared/volumes.o: in function `create_chunk': volumes.c:(.text+0x17f8): undefined reference to `__ALIGN_KERNEL' Due to the entangled includes and unconditional definition of __ALIGN_KERNEL, we can't use #ifdef in kerncompat.h to define it eventually (as kerncompat.h is the first include). Instead add local definitions of the macros and rename them to avoid name clashes. Pull-request: #433 Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
8ad326b2f2
commit
9ed0aadb63
@ -359,7 +359,14 @@ do { \
|
||||
|
||||
/* Alignment check */
|
||||
#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
|
||||
#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
|
||||
|
||||
/*
|
||||
* Alignment, copied and renamed from /usr/include/linux/const.h to work around
|
||||
* issues caused by moving the definition in 5.12
|
||||
*/
|
||||
#define __ALIGN_KERNEL__(x, a) __ALIGN_KERNEL_MASK__(x, (typeof(x))(a) - 1)
|
||||
#define __ALIGN_KERNEL_MASK__(x, mask) (((x) + (mask)) & ~(mask))
|
||||
#define ALIGN(x, a) __ALIGN_KERNEL__((x), (a))
|
||||
|
||||
static inline int is_power_of_2(unsigned long n)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user