diff options
Diffstat (limited to 'example/fusexmp_fh.c')
-rw-r--r-- | example/fusexmp_fh.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/example/fusexmp_fh.c b/example/fusexmp_fh.c index d79ff37..1ba9dbc 100644 --- a/example/fusexmp_fh.c +++ b/example/fusexmp_fh.c @@ -439,6 +439,19 @@ 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) +{ + (void) path; + + if (mode) + return -EOPNOTSUPP; + + return -posix_fallocate(fi->fh, offset, length); +} +#endif + #ifdef HAVE_SETXATTR /* xattr operations are optional and can safely be left unimplemented */ static int xmp_setxattr(const char *path, const char *name, const char *value, @@ -529,6 +542,9 @@ static struct fuse_operations xmp_oper = { .flush = xmp_flush, .release = xmp_release, .fsync = xmp_fsync, +#ifdef HAVE_POSIX_FALLOCATE + .fallocate = xmp_fallocate, +#endif #ifdef HAVE_SETXATTR .setxattr = xmp_setxattr, .getxattr = xmp_getxattr, |