Skip to content

Commit 50482fd

Browse files
ffontaineXanClic
authored andcommitted
block/export/fuse.c: fix musl build
Fix the following build failure on musl raised since version 6.0.0 and https://gitlab.com/qemu-project/qemu/-/commit/4ca37a96a75aafe7a37ba51ab1912b09b7190a6b because musl does not define FALLOC_FL_ZERO_RANGE: ../block/export/fuse.c: In function 'fuse_fallocate': ../block/export/fuse.c:563:23: error: 'FALLOC_FL_ZERO_RANGE' undeclared (first use in this function) 563 | } else if (mode & FALLOC_FL_ZERO_RANGE) { | ^~~~~~~~~~~~~~~~~~~~ Fixes: - http://autobuild.buildroot.org/results/b96e3d364fd1f8bbfb18904a742e73327d308f64 Signed-off-by: Fabrice Fontaine <[email protected]> Message-Id: <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Denis V. Lunev <[email protected]> Signed-off-by: Hanna Reitz <[email protected]>
1 parent 632eda5 commit 50482fd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

block/export/fuse.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,9 @@ static void fuse_fallocate(fuse_req_t req, fuse_ino_t inode, int mode,
635635
offset += size;
636636
length -= size;
637637
} while (ret == 0 && length > 0);
638-
} else if (mode & FALLOC_FL_ZERO_RANGE) {
638+
}
639+
#ifdef CONFIG_FALLOCATE_ZERO_RANGE
640+
else if (mode & FALLOC_FL_ZERO_RANGE) {
639641
if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + length > blk_len) {
640642
/* No need for zeroes, we are going to write them ourselves */
641643
ret = fuse_do_truncate(exp, offset + length, false,
@@ -654,7 +656,9 @@ static void fuse_fallocate(fuse_req_t req, fuse_ino_t inode, int mode,
654656
offset += size;
655657
length -= size;
656658
} while (ret == 0 && length > 0);
657-
} else if (!mode) {
659+
}
660+
#endif /* CONFIG_FALLOCATE_ZERO_RANGE */
661+
else if (!mode) {
658662
/* We can only fallocate at the EOF with a truncate */
659663
if (offset < blk_len) {
660664
fuse_reply_err(req, EOPNOTSUPP);

0 commit comments

Comments
 (0)