[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <176246793809.2862242.16758268369729874701.stgit@frogsfrogsfrogs>
Date: Thu, 06 Nov 2025 14:33:44 -0800
From: "Darrick J. Wong" <djwong@...nel.org>
To: tytso@....edu
Cc: linux-ext4@...r.kernel.org
Subject: [PATCH 10/19] fuse2fs: implement readdirplus
From: Darrick J. Wong <djwong@...nel.org>
Implement "readdirplus", which I think means that we return full stat
information for directory entries as part of the readdir results.
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
misc/fuse2fs.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index 1f52d7e4e37713..16492d54f7ed1d 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -3443,6 +3443,9 @@ struct readdir_iter {
fuse_fill_dir_t func;
struct fuse2fs *ff;
+#if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 0)
+ enum fuse_readdir_flags flags;
+#endif
unsigned int nr;
off_t startpos;
off_t dirpos;
@@ -3493,8 +3496,23 @@ static int op_readdir_iter(ext2_ino_t dir EXT2FS_ATTR((unused)),
if (i->startpos >= i->dirpos)
return 0;
- dbg_printf(i->ff, "READDIR %u dirpos %llu\n", i->nr++,
+ dbg_printf(i->ff, "READDIR%s %u dirpos %llu\n",
+#if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 0)
+ i->flags == FUSE_READDIR_PLUS ? "PLUS" : "",
+#else
+ "",
+#endif
+ i->nr++,
(unsigned long long)i->dirpos);
+
+#if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 0)
+ if (i->flags == FUSE_READDIR_PLUS) {
+ ret = stat_inode(i->fs, dirent->inode, &stat);
+ if (ret)
+ return DIRENT_ABORT;
+ }
+#endif
+
memcpy(namebuf, dirent->name, dirent->name_len & 0xFF);
namebuf[dirent->name_len & 0xFF] = 0;
ret = i->func(i->buf, namebuf, &stat, i->dirpos
@@ -3513,7 +3531,7 @@ static int op_readdir(const char *path EXT2FS_ATTR((unused)),
off_t offset,
struct fuse_file_info *fp
#if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 0)
- , enum fuse_readdir_flags flags EXT2FS_ATTR((unused))
+ , enum fuse_readdir_flags flags
#endif
)
{
@@ -3526,6 +3544,9 @@ static int op_readdir(const char *path EXT2FS_ATTR((unused)),
.ff = ff,
.dirpos = 0,
.startpos = offset,
+#if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 0)
+ .flags = flags,
+#endif
};
int ret = 0;
Powered by blists - more mailing lists