Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-fs/btrfs-progs/files/, sys-fs/btrfs-progs/
Date: Mon, 24 Jan 2022 23:18:39
Message-Id: 1643066305.067256ef4a116f738c502fd21a560445acbfd2a6.sam@gentoo
1 commit: 067256ef4a116f738c502fd21a560445acbfd2a6
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jan 24 23:18:08 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Mon Jan 24 23:18:25 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=067256ef
7
8 sys-fs/btrfs-progs: allow older linux-headers too w/ upstream patch
9
10 Bug: https://bugs.gentoo.org/831817
11 Signed-off-by: Sam James <sam <AT> gentoo.org>
12
13 sys-fs/btrfs-progs/btrfs-progs-5.16.ebuild | 6 +++-
14 .../files/5.16-linux-headers-before-5.11.patch | 40 ++++++++++++++++++++++
15 2 files changed, 45 insertions(+), 1 deletion(-)
16
17 diff --git a/sys-fs/btrfs-progs/btrfs-progs-5.16.ebuild b/sys-fs/btrfs-progs/btrfs-progs-5.16.ebuild
18 index bfedcff31bd3..015b81367170 100644
19 --- a/sys-fs/btrfs-progs/btrfs-progs-5.16.ebuild
20 +++ b/sys-fs/btrfs-progs/btrfs-progs-5.16.ebuild
21 @@ -45,7 +45,7 @@ RDEPEND="
22 zstd? ( app-arch/zstd:0= )
23 "
24 DEPEND="${RDEPEND}
25 - >=sys-kernel/linux-headers-5.11
26 + >=sys-kernel/linux-headers-5.10
27 convert? ( sys-apps/acl )
28 python? (
29 $(python_gen_cond_dep '
30 @@ -79,6 +79,10 @@ fi
31
32 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
33
34 +PATCHES=(
35 + "${FILESDIR}"/5.16-linux-headers-before-5.11.patch
36 +)
37 +
38 pkg_setup() {
39 use python && python-single-r1_pkg_setup
40 }
41
42 diff --git a/sys-fs/btrfs-progs/files/5.16-linux-headers-before-5.11.patch b/sys-fs/btrfs-progs/files/5.16-linux-headers-before-5.11.patch
43 new file mode 100644
44 index 000000000000..184656d96d22
45 --- /dev/null
46 +++ b/sys-fs/btrfs-progs/files/5.16-linux-headers-before-5.11.patch
47 @@ -0,0 +1,40 @@
48 +https://github.com/kdave/btrfs-progs/commit/b0cfe12c4d4b8b4ef335cdf4ddefcbdcd1b70d58.patch
49 +https://bugs.gentoo.org/831817
50 +
51 +From b0cfe12c4d4b8b4ef335cdf4ddefcbdcd1b70d58 Mon Sep 17 00:00:00 2001
52 +From: David Sterba <dsterba@××××.com>
53 +Date: Thu, 13 Jan 2022 14:47:08 +0100
54 +Subject: [PATCH] btrfs-progs: kerncompat: add local definition for alignment
55 + macros
56 +
57 +There's still problem left with compilation on musl and kernel < 5.11,
58 +because __ALIGN_KERNEL is not defined anymore:
59 +
60 +../bin/ld: kernel-shared/volumes.o: in function `create_chunk':
61 +volumes.c:(.text+0x17f8): undefined reference to `__ALIGN_KERNEL'
62 +
63 +Due to the entangled includes and unconditional definition of
64 +__ALIGN_KERNEL, we can't use #ifdef in kerncompat.h to define it
65 +eventually (as kerncompat.h is the first include). Instead add local
66 +definitions of the macros and rename them to avoid name clashes.
67 +
68 +Pull-request: #433
69 +Signed-off-by: David Sterba <dsterba@××××.com>
70 +--- a/kerncompat.h
71 ++++ b/kerncompat.h
72 +@@ -359,7 +359,14 @@ do { \
73 +
74 + /* Alignment check */
75 + #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
76 +-#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
77 ++
78 ++/*
79 ++ * Alignment, copied and renamed from /usr/include/linux/const.h to work around
80 ++ * issues caused by moving the definition in 5.12
81 ++ */
82 ++#define __ALIGN_KERNEL__(x, a) __ALIGN_KERNEL_MASK__(x, (typeof(x))(a) - 1)
83 ++#define __ALIGN_KERNEL_MASK__(x, mask) (((x) + (mask)) & ~(mask))
84 ++#define ALIGN(x, a) __ALIGN_KERNEL__((x), (a))
85 +
86 + static inline int is_power_of_2(unsigned long n)
87 + {