diff options
author | Amir Goldstein <amir73il@gmail.com> | 2025-01-02 20:25:13 +0100 |
---|---|---|
committer | Bernd Schubert <bernd@bsbernd.com> | 2025-02-10 16:56:45 +0100 |
commit | c105b8fbfad6398b064f547e3ad193af24e53048 (patch) | |
tree | 3ae9d8b2179f160b365a566457a615fdc0c9ec04 /example | |
parent | 92cfa4088a58815ecb99b40c396c253aa7257990 (diff) | |
download | libfuse-c105b8fbfad6398b064f547e3ad193af24e53048.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')
-rw-r--r-- | example/passthrough.c | 19 |
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; } |