diff mbox series

Create.c: fix uclibc build

Message ID 20240412164513.6829-1-fontaine.fabrice@gmail.com (mailing list archive)
State Accepted
Headers show
Series Create.c: fix uclibc build | expand

Commit Message

Fabrice Fontaine April 12, 2024, 4:45 p.m. UTC
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 <fontaine.fabrice@gmail.com>
---
 Create.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Mariusz Tkaczyk April 15, 2024, 3:24 p.m. UTC | #1
On Fri, 12 Apr 2024 18:45:13 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> 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 <fontaine.fabrice@gmail.com>

Applied! 

Thanks,
Mariusz
diff mbox series

Patch

diff --git a/Create.c b/Create.c
index 4397ff49..d94253b1 100644
--- a/Create.c
+++ b/Create.c
@@ -32,6 +32,10 @@ 
 #include	<sys/signalfd.h>
 #include	<sys/wait.h>
 
+#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)