From e0066bcb851b730f0517b5d5712a9e49b4296c7d Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Mon, 6 May 2024 23:03:48 +0200 Subject: [PATCH] package/mdadm: fix uclibc and musl build Fix following uclibc build failure raised since bump to version 4.3 in commit 99e9ff08d0705279532ca0cf3de22ea54660cbdc and https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/commit/?id=577fd10486d8d1472a6b559066f344ac30a3a391: Create.c: In function 'write_zeroes_fork': Create.c:155:35: error: 'FALLOC_FL_ZERO_RANGE' undeclared (first use in this function) 155 | if (fallocate(fd, FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE, | ^~~~~~~~~~~~~~~~~~~~ as well as the following musl build failure: util.c: In function 'get_md_name': util.c:1031:29: error: 'NAME_MAX' undeclared (first use in this function); did you mean 'MD_NAME_MAX'? 1031 | static char devname[NAME_MAX]; | ^~~~~~~~ | MD_NAME_MAX util.c:1031:29: note: each undeclared identifier is reported only once for each function it appears in /home/buildroot/instance-0/output-1/host/bin/x86_64-linux-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -DNO_LIBUDEV -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -DMAP_DIR=\"/run/mdadm\" -DMAP_FILE=\"map\" -DMDMON_DIR=\"/run/mdadm\" -DFAILED_SLOTS_DIR=\"/run/mdadm/failed-slots\" -DNO_COROSYNC -DNO_DLM -DUSE_PTHREADS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DBINDIR=\"/sbin\" -o Monitor.o -c Monitor.c /home/buildroot/instance-0/output-1/host/bin/x86_64-linux-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -DNO_LIBUDEV -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -DMAP_DIR=\"/run/mdadm\" -DMAP_FILE=\"map\" -DMDMON_DIR=\"/run/mdadm\" -DFAILED_SLOTS_DIR=\"/run/mdadm/failed-slots\" -DNO_COROSYNC -DNO_DLM -DUSE_PTHREADS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DBINDIR=\"/sbin\" -o dlink.o -c dlink.c Create.c: In function 'write_zeroes_fork': Create.c:155:35: error: 'FALLOC_FL_ZERO_RANGE' undeclared (first use in this function) 155 | if (fallocate(fd, FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE, | ^~~~~~~~~~~~~~~~~~~~ Fixes: 99e9ff08d0705279532ca0cf3de22ea54660cbdc - http://autobuild.buildroot.org/results/0e04bcdb591ca5642053e1f7e31384f06581e989 - http://autobuild.buildroot.org/results/c77ee2615e9d473e93d95c778648c7e897b7f234 Signed-off-by: Fabrice Fontaine Signed-off-by: Thomas Petazzoni --- ...ts-h-include-for-NAME_MAX-definition.patch | 32 ++++++++++++++ .../0003-Create.c-fix-uclibc-build.patch | 42 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 package/mdadm/0002-util-c-add-limits-h-include-for-NAME_MAX-definition.patch create mode 100644 package/mdadm/0003-Create.c-fix-uclibc-build.patch diff --git a/package/mdadm/0002-util-c-add-limits-h-include-for-NAME_MAX-definition.patch b/package/mdadm/0002-util-c-add-limits-h-include-for-NAME_MAX-definition.patch new file mode 100644 index 0000000000..ceaf7f923c --- /dev/null +++ b/package/mdadm/0002-util-c-add-limits-h-include-for-NAME_MAX-definition.patch @@ -0,0 +1,32 @@ +From 8bda86099089b44129ef6206764f9de47a45f0db Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Tue, 12 Mar 2024 11:01:50 +0100 +Subject: util.c: add limits.h include for NAME_MAX definition + +Add limits.h include for NAME_MAX definition. + +Signed-off-by: Alexander Kanavin +Signed-off-by: Mariusz Tkaczyk + +Upstream: https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/commit/?id=8bda86099089b44129ef6206764f9de47a45f0db +Signed-off-by: Fabrice Fontaine +--- + util.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/util.c b/util.c +index 05ad3343..49a9c6e2 100644 +--- a/util.c ++++ b/util.c +@@ -36,7 +36,7 @@ + #include + #include + #include +- ++#include + + /* + * following taken from linux/blkpg.h because they aren't +-- +cgit 1.2.3-korg + diff --git a/package/mdadm/0003-Create.c-fix-uclibc-build.patch b/package/mdadm/0003-Create.c-fix-uclibc-build.patch new file mode 100644 index 0000000000..c8399be076 --- /dev/null +++ b/package/mdadm/0003-Create.c-fix-uclibc-build.patch @@ -0,0 +1,42 @@ +From 52bead95d2957437c691891fcdc49bd6afccdd49 Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine +Date: Fri, 12 Apr 2024 18:45:13 +0200 +Subject: Create.c: fix uclibc build + +Define FALLOC_FL_ZERO_RANGE if needed as FALLOC_FL_ZERO_RANGE is only +defined for aarch64 on uclibc-ng resulting in the following or1k build +failure since commit 577fd10486d8d1472a6b559066f344ac30a3a391: + +Create.c: In function 'write_zeroes_fork': +Create.c:155:35: error: 'FALLOC_FL_ZERO_RANGE' undeclared (first use in this function) + 155 | if (fallocate(fd, FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE, + | ^~~~~~~~~~~~~~~~~~~~ + +Fixes: + - http://autobuild.buildroot.org/results/0e04bcdb591ca5642053e1f7e31384f06581e989 + +Signed-off-by: Fabrice Fontaine +Signed-off-by: Mariusz Tkaczyk +Upstream: https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/commit/?id=52bead95d2957437c691891fcdc49bd6afccdd49 +--- + Create.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/Create.c b/Create.c +index 4397ff49..d94253b1 100644 +--- a/Create.c ++++ b/Create.c +@@ -32,6 +32,10 @@ + #include + #include + ++#ifndef FALLOC_FL_ZERO_RANGE ++#define FALLOC_FL_ZERO_RANGE 16 ++#endif ++ + static int round_size_and_verify(unsigned long long *size, int chunk) + { + if (*size == 0) +-- +cgit 1.2.3-korg +