0005-block-export-fuse.c-fix-musl-build.patch 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. From 4d5280c066eb46a31556044fb52c2618928b0019 Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Mon, 9 Aug 2021 10:04:07 +0200
  4. Subject: [PATCH] block/export/fuse.c: fix musl build
  5. Fix the following build failure on musl raised since version 6.0.0 and
  6. https://gitlab.com/qemu-project/qemu/-/commit/4ca37a96a75aafe7a37ba51ab1912b09b7190a6b
  7. because musl does not define FALLOC_FL_ZERO_RANGE:
  8. ../block/export/fuse.c: In function 'fuse_fallocate':
  9. ../block/export/fuse.c:563:23: error: 'FALLOC_FL_ZERO_RANGE' undeclared (first use in this function)
  10. 563 | } else if (mode & FALLOC_FL_ZERO_RANGE) {
  11. | ^~~~~~~~~~~~~~~~~~~~
  12. Fixes:
  13. - http://autobuild.buildroot.org/results/b96e3d364fd1f8bbfb18904a742e73327d308f64
  14. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  15. [Upstream status: sent to qemu-devel@nongnu.org]
  16. ---
  17. block/export/fuse.c | 2 ++
  18. 1 file changed, 2 insertions(+)
  19. diff --git a/block/export/fuse.c b/block/export/fuse.c
  20. index ada9e263eb..07e31129a6 100644
  21. --- a/block/export/fuse.c
  22. +++ b/block/export/fuse.c
  23. @@ -635,6 +635,7 @@ static void fuse_fallocate(fuse_req_t req, fuse_ino_t inode, int mode,
  24. offset += size;
  25. length -= size;
  26. } while (ret == 0 && length > 0);
  27. +#ifdef FALLOC_FL_ZERO_RANGE
  28. } else if (mode & FALLOC_FL_ZERO_RANGE) {
  29. if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + length > blk_len) {
  30. /* No need for zeroes, we are going to write them ourselves */
  31. @@ -654,6 +655,7 @@ static void fuse_fallocate(fuse_req_t req, fuse_ino_t inode, int mode,
  32. offset += size;
  33. length -= size;
  34. } while (ret == 0 && length > 0);
  35. +#endif
  36. } else if (!mode) {
  37. /* We can only fallocate at the EOF with a truncate */
  38. if (offset < blk_len) {
  39. --
  40. 2.30.2