aboutsummaryrefslogtreecommitdiffstats
path: root/example/passthrough_ll.c
diff options
context:
space:
mode:
authorJoanne Koong <joannelkoong@gmail.com>2024-08-23 13:11:09 -0700
committerBernd Schubert <bernd@bsbernd.com>2025-07-16 01:46:09 +0200
commitb507cbc2b1aaec1931642497edcb6723a0d24dc4 (patch)
tree9b7556bbd548d3bee38d2f624876dba977014d45 /example/passthrough_ll.c
parent3be844147764b96496bcae6d92fa4b0e43ebff42 (diff)
downloadlibfuse-b507cbc2b1aaec1931642497edcb6723a0d24dc4.tar.gz
Add statx support
This commit adds libfuse support for FUSE_STATX requests on linux distributions. Currently, statx is only supported on linux. To make the interface a ergonomic as possible (eg using native 'struct statx' vs 'struct fuse_statx'), this implementation gates the 'struct statx' changes by #ifdef linux. Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Diffstat (limited to 'example/passthrough_ll.c')
-rw-r--r--example/passthrough_ll.c25
1 files changed, 25 insertions, 0 deletions
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[])