diff options
author | CismonX <admin@cismon.net> | 2025-07-09 23:01:05 +0800 |
---|---|---|
committer | Bernd Schubert <bernd@bsbernd.com> | 2025-07-13 15:22:29 +0200 |
commit | db5a1b6ae9d39614154590e5b8c62702a5230ca4 (patch) | |
tree | c0685f8f67bfd301ec0eb417f0cf647bc692d64a /example/passthrough.c | |
parent | 4166f2eb97da4e25a516abee3d6fe13b9ed77bc6 (diff) | |
download | libfuse-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.c')
-rw-r--r-- | example/passthrough.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/example/passthrough.c b/example/passthrough.c index a5ac4b3..7e5c9aa 100644 --- a/example/passthrough.c +++ b/example/passthrough.c @@ -399,7 +399,6 @@ static int xmp_fsync(const char *path, int isdatasync, return 0; } -#ifdef HAVE_POSIX_FALLOCATE static int xmp_fallocate(const char *path, int mode, off_t offset, off_t length, struct fuse_file_info *fi) { @@ -408,9 +407,6 @@ static int xmp_fallocate(const char *path, int mode, (void) fi; - if (mode) - return -EOPNOTSUPP; - if(fi == NULL) fd = open(path, O_WRONLY); else @@ -419,13 +415,12 @@ static int xmp_fallocate(const char *path, int mode, if (fd == -1) return -errno; - res = -posix_fallocate(fd, offset, length); + res = do_fallocate(fd, mode, offset, length); if(fi == NULL) close(fd); return res; } -#endif #ifdef HAVE_SETXATTR /* xattr operations are optional and can safely be left unimplemented */ @@ -554,9 +549,7 @@ static const struct fuse_operations xmp_oper = { .statfs = xmp_statfs, .release = xmp_release, .fsync = xmp_fsync, -#ifdef HAVE_POSIX_FALLOCATE .fallocate = xmp_fallocate, -#endif #ifdef HAVE_SETXATTR .setxattr = xmp_setxattr, .getxattr = xmp_getxattr, |