diff options
Diffstat (limited to 'example')
-rw-r--r-- | example/memfs_ll.cc | 3 | ||||
-rw-r--r-- | example/passthrough.c | 21 | ||||
-rw-r--r-- | example/passthrough_fh.c | 21 | ||||
-rw-r--r-- | example/passthrough_ll.c | 25 |
4 files changed, 70 insertions, 0 deletions
diff --git a/example/memfs_ll.cc b/example/memfs_ll.cc index b4f0b63..0da7c25 100644 --- a/example/memfs_ll.cc +++ b/example/memfs_ll.cc @@ -1094,6 +1094,9 @@ static const struct fuse_lowlevel_ops memfs_oper = { .copy_file_range = nullptr, .lseek = nullptr, .tmpfile = nullptr, +#ifdef HAVE_STATX + .statx = nullptr, +#endif }; int main(int argc, char *argv[]) diff --git a/example/passthrough.c b/example/passthrough.c index f0e686d..fdaa19e 100644 --- a/example/passthrough.c +++ b/example/passthrough.c @@ -519,6 +519,24 @@ static off_t xmp_lseek(const char *path, off_t off, int whence, struct fuse_file return res; } +#ifdef HAVE_STATX +static int xmp_statx(const char *path, int flags, int mask, struct statx *stxbuf, + struct fuse_file_info *fi) +{ + int fd = -1; + int res; + + if (fi) + fd = fi->fh; + + res = statx(fd, path, flags | AT_SYMLINK_NOFOLLOW, mask, stxbuf); + if (res == -1) + return -errno; + + return 0; +} +#endif + static const struct fuse_operations xmp_oper = { .init = xmp_init, .getattr = xmp_getattr, @@ -556,6 +574,9 @@ static const struct fuse_operations xmp_oper = { .copy_file_range = xmp_copy_file_range, #endif .lseek = xmp_lseek, +#ifdef HAVE_STATX + .statx = xmp_statx, +#endif }; int main(int argc, char *argv[]) diff --git a/example/passthrough_fh.c b/example/passthrough_fh.c index 6764554..0d4fb5b 100644 --- a/example/passthrough_fh.c +++ b/example/passthrough_fh.c @@ -616,6 +616,24 @@ static off_t xmp_lseek(const char *path, off_t off, int whence, struct fuse_file return res; } +#ifdef HAVE_STATX +static int xmp_statx(const char *path, int flags, int mask, struct statx *stxbuf, + struct fuse_file_info *fi) +{ + int fd = -1; + int res; + + if (fi) + fd = fi->fh; + + res = statx(fd, path, flags | AT_SYMLINK_NOFOLLOW, mask, stxbuf); + if (res == -1) + return -errno; + + return 0; +} +#endif + static const struct fuse_operations xmp_oper = { .init = xmp_init, .getattr = xmp_getattr, @@ -662,6 +680,9 @@ static const struct fuse_operations xmp_oper = { .copy_file_range = xmp_copy_file_range, #endif .lseek = xmp_lseek, +#ifdef HAVE_STATX + .statx = xmp_statx, +#endif }; int main(int argc, char *argv[]) diff --git a/example/passthrough_ll.c b/example/passthrough_ll.c index 9e027b4..5ca6efa 100644 --- a/example/passthrough_ll.c +++ b/example/passthrough_ll.c @@ -1215,6 +1215,28 @@ static void lo_lseek(fuse_req_t req, fuse_ino_t ino, off_t off, int whence, fuse_reply_err(req, errno); } +#ifdef HAVE_STATX +static void lo_statx(fuse_req_t req, fuse_ino_t ino, int flags, int mask, + struct fuse_file_info *fi) +{ + struct lo_data *lo = lo_data(req); + struct statx buf; + int res; + int fd; + + if (fi) + fd = fi->fh; + else + fd = lo_fd(req, ino); + + res = statx(fd, "", flags | AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW, mask, &buf); + if (res == -1) + fuse_reply_err(req, errno); + else + fuse_reply_statx(req, 0, &buf, lo->timeout); +} +#endif + static const struct fuse_lowlevel_ops lo_oper = { .init = lo_init, .destroy = lo_destroy, @@ -1255,6 +1277,9 @@ static const struct fuse_lowlevel_ops lo_oper = { .copy_file_range = lo_copy_file_range, #endif .lseek = lo_lseek, +#ifdef HAVE_STATX + .statx = lo_statx, +#endif }; int main(int argc, char *argv[]) |