block/export/fuse.c: fix musl build
PATCH v2 1/1 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
---
Changes v1 -> v2 (after review of Philippe Mathieu-Daudé):
- Use CONFIG_FALLOCATE_ZERO_RANGE and make safer #ifdef'ry
block/export/fuse.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
block/export/fuse.c +6 -2
@@ -635,7 +635,9 @@ static void fuse_fallocate(fuse_req_t req, fuse_ino_t inode, int mode, offset += size; length -= size; }while (ret ==0 && length >0 ); - }else if (mode &FALLOC_FL_ZERO_RANGE ) { + } +#ifdef CONFIG_FALLOCATE_ZERO_RANGE + else if (mode & FALLOC_FL_ZERO_RANGE) {if (!(mode &FALLOC_FL_KEEP_SIZE ) && offset + length > blk_len) {/* No need for zeroes, we are going to write them ourselves */ 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, offset += size; length -= size; }while (ret ==0 && length >0 ); - }else if (!mode) { + } +#endif /* CONFIG_FALLOCATE_ZERO_RANGE */ + else if (!mode) {/* We can only fallocate at the EOF with a truncate */ if (offset < blk_len) {fuse_reply_err (req,EOPNOTSUPP );
Signature · 1 line
2.30.2
Quoted 37 lines · Fabrice Fontaine
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 defineFALLOC_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/b96e3d364fd1f8bbfb18904a742e73327d308f64Signed-off-by Fabrice Fontaine <[email protected]>---
Changes v1 -> v2 (after review of Philippe Mathieu-Daudé):
- UseCONFIG_FALLOCATE_ZERO_RANGEand make safer #ifdef'ryblock/export/fuse.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)block/export/fuse.c +3
-1@@ -635,7 +635,9 @@ static void fuse_fallocate(fuse_req_t req, fuse_ino_t inode, int mode, offset += size; length -= size; }while (ret ==0 && length >0 ); - }else if (mode &FALLOC_FL_ZERO_RANGE ) { + } +#ifdef CONFIG_FALLOCATE_ZERO_RANGE + else if (mode & FALLOC_FL_ZERO_RANGE) {if (!(mode &FALLOC_FL_KEEP_SIZE ) && offset + length > blk_len) {/* No need for zeroes, we are going to write them ourselves */ ret = fuse_do_truncate(exp, offset + length, false,
block/export/fuse.c static void fuse_fallocate(fuse_req_t req, fuse_ino_t inode, int mode, · line 664
Quoted 10 lines
block/export/fuse.c +3
-1@@ -654,7 +656,9 @@ static void fuse_fallocate(fuse_req_t req, fuse_ino_t inode, int mode, offset += size; length -= size; }while (ret ==0 && length >0 ); - }else if (!mode) { + } +#endif /* CONFIG_FALLOCATE_ZERO_RANGE */ + else if (!mode) {/* We can only fallocate at the EOF with a truncate */ if (offset < blk_len) {fuse_reply_err (req,EOPNOTSUPP );
Denis V. Lunev
Reviewed-byQuoted 41 lines · Philippe Mathieu-Daudé
Quoted 40 lines · Fabrice Fontaine
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 defineFALLOC_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/b96e3d364fd1f8bbfb18904a742e73327d308f64Signed-off-by Fabrice Fontaine <[email protected]>---
Changes v1 -> v2 (after review of Philippe Mathieu-Daudé):
- UseCONFIG_FALLOCATE_ZERO_RANGEand make safer #ifdef'ryblock/export/fuse.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)block/export/fuse.c +3
-2@@ -635,7 +635,9 @@ static void fuse_fallocate(fuse_req_t req, fuse_ino_t inode, int mode, offset += size; length -= size; }while (ret ==0 && length >0 ); - }else if (mode &FALLOC_FL_ZERO_RANGE ) { + } +#ifdef CONFIG_FALLOCATE_ZERO_RANGE + else if (mode & FALLOC_FL_ZERO_RANGE) {if (!(mode &FALLOC_FL_KEEP_SIZE ) && offset + length > blk_len) {/* No need for zeroes, we are going to write them ourselves */ 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, offset += size; length -= size; }while (ret ==0 && length >0 ); - }else if (!mode) {
Quoted 9 lines
block/export/fuse.c static void fuse_fallocate(fuse_req_t req, fuse_ino_t inode, int mode, · line 664
Quoted 7 lines
block/export/fuse.c +3
-0+ } +#endif /* CONFIG_FALLOCATE_ZERO_RANGE */ + else if (!mode) {/* We can only fallocate at the EOF with a truncate */ if (offset < blk_len) {fuse_reply_err (req,EOPNOTSUPP );Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Hanna Reitz
AppliedQuoted 12 lines · Fabrice Fontaine
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 defineFALLOC_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
Quoted 7 lines
Signed-off-by Fabrice Fontaine <[email protected]>---
Changes v1 -> v2 (after review of Philippe Mathieu-Daudé):
- UseCONFIG_FALLOCATE_ZERO_RANGEand make safer #ifdef'ryblock/export/fuse.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Thanks, applied to my block branch:
https://github.com/XanClic/qemu/commits/block
(Of note: I’ve had an email address change today, so sending the pull request may become a bit hairy. If it doesn’t work out, I’ll have to ask Kevin (or Peter directly, given this is a build fix) tomorrow.)