[Libguestfs] [libnbd PATCH v2 03/23] fuse: Only support defined fallocate modes

Martin Kletzander mkletzan at redhat.com
Thu Jun 10 23:12:07 UTC 2021


None of them is defined on FreeBSD, for example, so by setting them to 0 they
will be skipped as they are used as bit flags.

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 fuse/operations.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fuse/operations.c b/fuse/operations.c
index de04ba7b6d72..7a2b8985ab30 100644
--- a/fuse/operations.c
+++ b/fuse/operations.c
@@ -428,6 +428,14 @@ nbdfuse_fsync (const char *path, int datasync, struct fuse_file_info *fi)
   return 0;
 }
 
+#ifndef FALLOC_FL_PUNCH_HOLE
+# define FALLOC_FL_PUNCH_HOLE 0
+#endif
+
+#ifndef FALLOC_FL_ZERO_RANGE
+# define FALLOC_FL_ZERO_RANGE 0
+#endif
+
 /* Punch a hole or write zeros. */
 static int
 nbdfuse_fallocate (const char *path, int mode, off_t offset, off_t len,
-- 
2.32.0




More information about the Libguestfs mailing list