diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-01-01 18:22:31 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-01-01 18:22:31 +0000 |
commit | d8da9adb53b296ea6f5ca863a4871696ca41faf1 (patch) | |
tree | 5333afbf737bbef3ddf2dc211f87d9d29383e43c /netfs/fuse | |
parent | General test config for alternative setups (diff) | |
download | netfs-d8da9adb53b296ea6f5ca863a4871696ca41faf1.tar.bz2 netfs-d8da9adb53b296ea6f5ca863a4871696ca41faf1.tar.xz netfs-d8da9adb53b296ea6f5ca863a4871696ca41faf1.zip |
Allow listdir to be disabled
Adds covering unit tests over readdir now.
Removes async caching of contents when using readdir, you want caching,
that's what listdir is for.
Diffstat (limited to 'netfs/fuse')
-rw-r--r-- | netfs/fuse/fuseConfig.ice | 3 | ||||
-rw-r--r-- | netfs/fuse/fuseDirs.cpp | 8 |
2 files changed, 4 insertions, 7 deletions
diff --git a/netfs/fuse/fuseConfig.ice b/netfs/fuse/fuseConfig.ice index 52116ea..e425c21 100644 --- a/netfs/fuse/fuseConfig.ice +++ b/netfs/fuse/fuseConfig.ice @@ -20,6 +20,9 @@ module NetFS { ["slicer:name:async"] bool Async = false; + + ["slicer:name:listdir"] + bool ListDir = true; }; ["slicer:key:name","slicer:value:resource","slicer:item:resource"] diff --git a/netfs/fuse/fuseDirs.cpp b/netfs/fuse/fuseDirs.cpp index c277798..2b51a66 100644 --- a/netfs/fuse/fuseDirs.cpp +++ b/netfs/fuse/fuseDirs.cpp @@ -53,7 +53,7 @@ FuseApp::readdir(const char * p, void * buf, fuse_fill_dir_t filler, off_t, stru std::string path(p); path += "/"; auto expiry = time(NULL) + 2; - if (od->remoteV2) { + if (fcr->ListDir && od->remoteV2) { for (const auto & e : od->remoteV2->listdir()) { filler(buf, e.first.c_str(), NULL, 0); statCache.add(path + e.first, converter.convert(e.second), expiry); @@ -62,12 +62,6 @@ FuseApp::readdir(const char * p, void * buf, fuse_fill_dir_t filler, off_t, stru else { for (const auto & e : od->remote->readdir()) { filler(buf, e.c_str(), NULL, 0); - std::string epath = path + e; - auto asga = volume->begin_getattr(reqEnv(), epath); - statCache.addFactory(epath, - [asga,this]() { - return converter.convert(volume->end_getattr(asga)); - }, expiry); } } return 0; |