aboutsummaryrefslogtreecommitdiffstats
path: root/example/passthrough_hp.cc
diff options
context:
space:
mode:
authorBernd Schubert <bschubert@ddn.com>2024-08-26 19:33:47 +0200
committerBernd Schubert <bernd.schubert@fastmail.fm>2024-09-12 18:21:25 +0200
commit0a76670183f484461cf7d69c2761cfd65547500f (patch)
treeaa97a12fc2e834e4810ea5409e760042eb9a2ca0 /example/passthrough_hp.cc
parent373ddc7eae7b0c684fc4ab29d8addfa3b9e99e1e (diff)
downloadlibfuse-0a76670183f484461cf7d69c2761cfd65547500f.tar.gz
getattr: Make use of FUSE_GETATTR_FH in lowlevel examples
High level examples were already using it, but not lowlevel. Also update the documentation.
Diffstat (limited to 'example/passthrough_hp.cc')
-rw-r--r--example/passthrough_hp.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/example/passthrough_hp.cc b/example/passthrough_hp.cc
index 4dab544..e75c749 100644
--- a/example/passthrough_hp.cc
+++ b/example/passthrough_hp.cc
@@ -226,12 +226,12 @@ static void sfs_init(void *userdata, fuse_conn_info *conn) {
}
-static void sfs_getattr(fuse_req_t req, fuse_ino_t ino, fuse_file_info *fi) {
- (void)fi;
- Inode& inode = get_inode(ino);
+static void sfs_getattr(fuse_req_t req, fuse_ino_t ino, fuse_file_info *fi)
+{
struct stat attr;
- auto res = fstatat(inode.fd, "", &attr,
- AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW);
+ int fd = fi ? fi->fh : get_inode(ino).fd;
+
+ auto res = fstatat(fd, "", &attr, AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW);
if (res == -1) {
fuse_reply_err(req, errno);
return;