aboutsummaryrefslogtreecommitdiffstats
path: root/example/passthrough.c
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2025-01-02 20:25:13 +0100
committerBernd Schubert <bernd@bsbernd.com>2025-01-03 22:04:30 +0100
commit52d4791e83852b485a3b22ab99f22cc37073aa70 (patch)
tree3ae9d8b2179f160b365a566457a615fdc0c9ec04 /example/passthrough.c
parent9b92c988eed637c8186360481b949ffa4397e942 (diff)
downloadlibfuse-52d4791e83852b485a3b22ab99f22cc37073aa70.tar.gz
example/passthrough: Enable testing of readdirplus without fill offsets
passthrough example supports the --plus command line argument to reply to readdirplus with fill_dir_plus and unspecified (0) fill offsets. As explained in this comment: https://github.com/libfuse/libfuse/pull/896#issuecomment-1978917041 passthrough example needs a few more changes to be able to test commit dd95d13a ("fix readdirplus when filler is called with zero offset (#896)) With the changes in this commit, readdirplus without fill offsets can be tested to verify the readdirplus fix above with command line: passthrough --plus -o auto_cache,modules=subdir,subdir=/src /mnt Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Diffstat (limited to 'example/passthrough.c')
-rw-r--r--example/passthrough.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/example/passthrough.c b/example/passthrough.c
index 30a8ad5..cc93f53 100644
--- a/example/passthrough.c
+++ b/example/passthrough.c
@@ -73,9 +73,11 @@ static void *xmp_init(struct fuse_conn_info *conn,
the cache of the associated inode - resulting in an
incorrect st_nlink value being reported for any remaining
hardlinks to this inode. */
- cfg->entry_timeout = 0;
- cfg->attr_timeout = 0;
- cfg->negative_timeout = 0;
+ if (!cfg->auto_cache) {
+ cfg->entry_timeout = 0;
+ cfg->attr_timeout = 0;
+ cfg->negative_timeout = 0;
+ }
return NULL;
}
@@ -134,9 +136,14 @@ static int xmp_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
while ((de = readdir(dp)) != NULL) {
struct stat st;
- memset(&st, 0, sizeof(st));
- st.st_ino = de->d_ino;
- st.st_mode = de->d_type << 12;
+ if (fill_dir_plus) {
+ fstatat(dirfd(dp), de->d_name, &st,
+ AT_SYMLINK_NOFOLLOW);
+ } else {
+ memset(&st, 0, sizeof(st));
+ st.st_ino = de->d_ino;
+ st.st_mode = de->d_type << 12;
+ }
if (filler(buf, de->d_name, &st, 0, fill_dir_plus))
break;
}