Re: [PATCH] block/export/fuse.c: fix musl build
Am 22.10.2021 um 11:52 hat Fabrice Fontaine geschrieben: > Include linux/falloc.h if CONFIG_FALLOCATE_ZERO_RANGE is defined to fix > https://gitlab.com/qemu-project/qemu/-/commit/50482fda98bd62e072c30b7ea73c985c4e9d9bbb > and avoid the following build failure on musl: > > ../block/export/fuse.c: In function 'fuse_fallocate': > ../block/export/fuse.c:643:21: error: 'FALLOC_FL_ZERO_RANGE' undeclared > (first use in this function) > 643 | else if (mode & FALLOC_FL_ZERO_RANGE) { > | ^~~~ > > Fixes: > - > http://autobuild.buildroot.org/results/be24433a429fda681fb66698160132c1c99bc53b > > Signed-off-by: Fabrice Fontaine Thanks, applied to the block branch. Kevin
Re: [PATCH] block/export/fuse.c: fix musl build
On 10/25/21 13:01, Philippe Mathieu-Daudé wrote: > On 10/22/21 11:52, Fabrice Fontaine wrote: >> Include linux/falloc.h if CONFIG_FALLOCATE_ZERO_RANGE is defined to fix >> https://gitlab.com/qemu-project/qemu/-/commit/50482fda98bd62e072c30b7ea73c985c4e9d9bbb >> and avoid the following build failure on musl: >> >> ../block/export/fuse.c: In function 'fuse_fallocate': >> ../block/export/fuse.c:643:21: error: 'FALLOC_FL_ZERO_RANGE' undeclared >> (first use in this function) >> 643 | else if (mode & FALLOC_FL_ZERO_RANGE) { >> | ^~~~ >> >> Fixes: >> - >> http://autobuild.buildroot.org/results/be24433a429fda681fb66698160132c1c99bc53b > > The 2 previous lines aren't really helpful, however this is: > > Fixes: 50482fda98b ("block/export/fuse.c: fix musl build") Also better to change this patch subject to distinct: "block/export/fuse.c: fix musl build (again)" >> Signed-off-by: Fabrice Fontaine >> --- >> block/export/fuse.c | 4 >> 1 file changed, 4 insertions(+) >> >> diff --git a/block/export/fuse.c b/block/export/fuse.c >> index 2e3bf8270b..823c126d23 100644 >> --- a/block/export/fuse.c >> +++ b/block/export/fuse.c >> @@ -31,6 +31,10 @@ >> #include >> #include >> >> +#if defined(CONFIG_FALLOCATE_ZERO_RANGE) >> +#include >> +#endif >> + >> #ifdef __linux__ >> #include >> #endif >> > > With 'Fixes:' tag: > Reviewed-by: Philippe Mathieu-Daudé
Re: [PATCH] block/export/fuse.c: fix musl build
On 10/22/21 11:52, Fabrice Fontaine wrote: > Include linux/falloc.h if CONFIG_FALLOCATE_ZERO_RANGE is defined to fix > https://gitlab.com/qemu-project/qemu/-/commit/50482fda98bd62e072c30b7ea73c985c4e9d9bbb > and avoid the following build failure on musl: > > ../block/export/fuse.c: In function 'fuse_fallocate': > ../block/export/fuse.c:643:21: error: 'FALLOC_FL_ZERO_RANGE' undeclared > (first use in this function) > 643 | else if (mode & FALLOC_FL_ZERO_RANGE) { > | ^~~~ > > Fixes: > - > http://autobuild.buildroot.org/results/be24433a429fda681fb66698160132c1c99bc53b The 2 previous lines aren't really helpful, however this is: Fixes: 50482fda98b ("block/export/fuse.c: fix musl build") > Signed-off-by: Fabrice Fontaine > --- > block/export/fuse.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/block/export/fuse.c b/block/export/fuse.c > index 2e3bf8270b..823c126d23 100644 > --- a/block/export/fuse.c > +++ b/block/export/fuse.c > @@ -31,6 +31,10 @@ > #include > #include > > +#if defined(CONFIG_FALLOCATE_ZERO_RANGE) > +#include > +#endif > + > #ifdef __linux__ > #include > #endif > With 'Fixes:' tag: Reviewed-by: Philippe Mathieu-Daudé
Re: [PATCH] block/export/fuse.c: fix musl build
Le lun. 25 oct. 2021 à 11:33, Kevin Wolf a écrit : > > Am 22.10.2021 um 11:52 hat Fabrice Fontaine geschrieben: > > Include linux/falloc.h if CONFIG_FALLOCATE_ZERO_RANGE is defined to fix > > https://gitlab.com/qemu-project/qemu/-/commit/50482fda98bd62e072c30b7ea73c985c4e9d9bbb > > and avoid the following build failure on musl: > > > > ../block/export/fuse.c: In function 'fuse_fallocate': > > ../block/export/fuse.c:643:21: error: 'FALLOC_FL_ZERO_RANGE' undeclared > > (first use in this function) > > 643 | else if (mode & FALLOC_FL_ZERO_RANGE) { > > | ^~~~ > > > > Fixes: > > - > > http://autobuild.buildroot.org/results/be24433a429fda681fb66698160132c1c99bc53b > > > > Signed-off-by: Fabrice Fontaine > > This patches makes sense to me, but does this mean that commit 50482fda > was completely untested and the build still failed after the patch? First iteration of this patch was tested (and applied on buildroot side): https://lists.gnu.org/archive/html/qemu-devel/2021-08/msg01394.html. Unfortunately, second iteration (which was merged) was not tested: https://lists.gnu.org/archive/html/qemu-devel/2021-08/msg01440.html. > > If so, is at least this one tested and builds successfully now? Yes, this patch builds fine. > > Kevin > Fabrice
Re: [PATCH] block/export/fuse.c: fix musl build
Am 22.10.2021 um 11:52 hat Fabrice Fontaine geschrieben: > Include linux/falloc.h if CONFIG_FALLOCATE_ZERO_RANGE is defined to fix > https://gitlab.com/qemu-project/qemu/-/commit/50482fda98bd62e072c30b7ea73c985c4e9d9bbb > and avoid the following build failure on musl: > > ../block/export/fuse.c: In function 'fuse_fallocate': > ../block/export/fuse.c:643:21: error: 'FALLOC_FL_ZERO_RANGE' undeclared > (first use in this function) > 643 | else if (mode & FALLOC_FL_ZERO_RANGE) { > | ^~~~ > > Fixes: > - > http://autobuild.buildroot.org/results/be24433a429fda681fb66698160132c1c99bc53b > > Signed-off-by: Fabrice Fontaine This patches makes sense to me, but does this mean that commit 50482fda was completely untested and the build still failed after the patch? If so, is at least this one tested and builds successfully now? Kevin
Re: [PATCH] block/export/fuse.c: fix musl build
Le lun. 25 oct. 2021 à 08:31, Michael Tokarev a écrit : > > 22.10.2021 12:52, Fabrice Fontaine пишет: > > Include linux/falloc.h if CONFIG_FALLOCATE_ZERO_RANGE is defined to fix > > https://gitlab.com/qemu-project/qemu/-/commit/50482fda98bd62e072c30b7ea73c985c4e9d9bbb > > and avoid the following build failure on musl: > > > > ../block/export/fuse.c: In function 'fuse_fallocate': > > ../block/export/fuse.c:643:21: error: 'FALLOC_FL_ZERO_RANGE' undeclared > > (first use in this function) > >643 | else if (mode & FALLOC_FL_ZERO_RANGE) { > >| ^~~~ > > > > Fixes: > > - > > http://autobuild.buildroot.org/results/be24433a429fda681fb66698160132c1c99bc53b > > > > Signed-off-by: Fabrice Fontaine > > --- > > block/export/fuse.c | 4 > > 1 file changed, 4 insertions(+) > > > > diff --git a/block/export/fuse.c b/block/export/fuse.c > > index 2e3bf8270b..823c126d23 100644 > > --- a/block/export/fuse.c > > +++ b/block/export/fuse.c > > @@ -31,6 +31,10 @@ > > #include > > #include > > > > +#if defined(CONFIG_FALLOCATE_ZERO_RANGE) > > shouldn't it be "if !defined" ? Nope, here is an extract of meson.build: config_host_data.set('CONFIG_FALLOCATE_ZERO_RANGE', cc.has_header_symbol('linux/falloc.h', 'FALLOC_FL_ZERO_RANGE')) So, CONFIG_FALLOCATE_ZERO_RANGE is defined if FALLOC_FL_ZERO_RANGE is found in linux/falloc.h which is fine. However, because linux/falloc.h is not included in fuse.c, a build failure will be raised on musl (which does not define FALLOC_FL_ZERO_RANGE) > > /mjt > > > +#include > > +#endif > > + > > #ifdef __linux__ > > #include > > #endif > > > Best Regards, Fabrice
Re: [PATCH] block/export/fuse.c: fix musl build
22.10.2021 12:52, Fabrice Fontaine пишет: Include linux/falloc.h if CONFIG_FALLOCATE_ZERO_RANGE is defined to fix https://gitlab.com/qemu-project/qemu/-/commit/50482fda98bd62e072c30b7ea73c985c4e9d9bbb and avoid the following build failure on musl: ../block/export/fuse.c: In function 'fuse_fallocate': ../block/export/fuse.c:643:21: error: 'FALLOC_FL_ZERO_RANGE' undeclared (first use in this function) 643 | else if (mode & FALLOC_FL_ZERO_RANGE) { | ^~~~ Fixes: - http://autobuild.buildroot.org/results/be24433a429fda681fb66698160132c1c99bc53b Signed-off-by: Fabrice Fontaine --- block/export/fuse.c | 4 1 file changed, 4 insertions(+) diff --git a/block/export/fuse.c b/block/export/fuse.c index 2e3bf8270b..823c126d23 100644 --- a/block/export/fuse.c +++ b/block/export/fuse.c @@ -31,6 +31,10 @@ #include #include +#if defined(CONFIG_FALLOCATE_ZERO_RANGE) shouldn't it be "if !defined" ? /mjt +#include +#endif + #ifdef __linux__ #include #endif
Re: [PATCH] block/export/fuse.c: fix musl build
On 8/9/21 10:50 AM, Fabrice Fontaine wrote: > 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 > --- > block/export/fuse.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/block/export/fuse.c b/block/export/fuse.c > index ada9e263eb..07e31129a6 100644 > --- a/block/export/fuse.c > +++ b/block/export/fuse.c > @@ -635,6 +635,7 @@ static void fuse_fallocate(fuse_req_t req, fuse_ino_t > inode, int mode, > offset += size; > length -= size; > } while (ret == 0 && length > 0); > +#ifdef FALLOC_FL_ZERO_RANGE Please use 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 */ > @@ -654,6 +655,7 @@ static void fuse_fallocate(fuse_req_t req, fuse_ino_t > inode, int mode, > offset += size; > length -= size; > } while (ret == 0 && length > 0); > +#endif > } else if (!mode) { > /* We can only fallocate at the EOF with a truncate */ > if (offset < blk_len) { > Maybe safer #ifdef'ry as: -- >8 -- diff --git a/block/export/fuse.c b/block/export/fuse.c index ada9e263ebb..fc7b07d2b57 100644 --- a/block/export/fuse.c +++ b/block/export/fuse.c @@ -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); ---