aboutsummaryrefslogtreecommitdiffstats
path: root/example/passthrough_ll.c
diff options
context:
space:
mode:
authorCismonX <admin@cismon.net>2025-07-09 23:01:05 +0800
committerBernd Schubert <bernd@bsbernd.com>2025-07-13 15:22:29 +0200
commitdb5a1b6ae9d39614154590e5b8c62702a5230ca4 (patch)
treec0685f8f67bfd301ec0eb417f0cf647bc692d64a /example/passthrough_ll.c
parent4166f2eb97da4e25a516abee3d6fe13b9ed77bc6 (diff)
downloadlibfuse-db5a1b6ae9d39614154590e5b8c62702a5230ca4.tar.gz
example/passthrough: refactor fallocate
Move fallocate implementation to passthrough_helpers.h, so that it could be reused by multiple passthrough examples. Signed-off-by: CismonX <admin@cismon.net>
Diffstat (limited to 'example/passthrough_ll.c')
-rw-r--r--example/passthrough_ll.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/example/passthrough_ll.c b/example/passthrough_ll.c
index 59f43c5..9e027b4 100644
--- a/example/passthrough_ll.c
+++ b/example/passthrough_ll.c
@@ -1006,22 +1006,10 @@ static void lo_statfs(fuse_req_t req, fuse_ino_t ino)
static void lo_fallocate(fuse_req_t req, fuse_ino_t ino, int mode,
off_t offset, off_t length, struct fuse_file_info *fi)
{
- int err = EOPNOTSUPP;
+ int err;
(void) ino;
-#ifdef HAVE_FALLOCATE
- err = fallocate(fi->fh, mode, offset, length);
- if (err < 0)
- err = errno;
-
-#elif defined(HAVE_POSIX_FALLOCATE)
- if (mode) {
- fuse_reply_err(req, EOPNOTSUPP);
- return;
- }
-
- err = posix_fallocate(fi->fh, offset, length);
-#endif
+ err = -do_fallocate(fi->fh, mode, offset, length);
fuse_reply_err(req, err);
}