From 8165ca39bc7e3bd592d0afe7b110ad97766fbe79 Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Tue, 21 Apr 2015 23:19:50 +0200 Subject: [PATCH] Simplified readdir --- fuse/Fuse.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fuse/Fuse.cpp b/fuse/Fuse.cpp index b58ad546..14250856 100644 --- a/fuse/Fuse.cpp +++ b/fuse/Fuse.cpp @@ -470,13 +470,14 @@ int Fuse::readdir(const bf::path &path, void *buf, fuse_fill_dir_t filler, off_t auto entries = _fs->readDir(path); struct stat stbuf; for (const auto &entry : *entries) { - //We could pass file metadata to filler() in its third parameter, - //but it doesn't help performance since fuse seems to ignore it. + //We could pass more file metadata to filler() in its third parameter, + //but it doesn't help performance since fuse ignores everything in stbuf + //except for file-type bits in st_mode and (if used) st_ino. //It does getattr() calls on all entries nevertheless. if (entry.type == Dir::EntryType::DIR) { - stbuf.st_mode = S_IFDIR | S_IRUSR | S_IXUSR | S_IWUSR; + stbuf.st_mode = S_IFDIR; } else { - stbuf.st_mode = S_IFREG | S_IRUSR | S_IXUSR | S_IWUSR; + stbuf.st_mode = S_IFREG; } if (filler(buf, entry.name.c_str(), &stbuf, 0) != 0) { return -ENOMEM;