diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-04-11 08:51:07 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-04-11 08:51:07 +0100 |
commit | fd2105de19c61d3b9da64352b65b1b55d5d91f35 (patch) | |
tree | 38e671f26cce7d8616b753ae1413f4964379a05e /netfs/fuse | |
parent | Tidy up passing of type converter to file server (diff) | |
download | netfs-fd2105de19c61d3b9da64352b65b1b55d5d91f35.tar.bz2 netfs-fd2105de19c61d3b9da64352b65b1b55d5d91f35.tar.xz netfs-fd2105de19c61d3b9da64352b65b1b55d5d91f35.zip |
Prototype listdir
Diffstat (limited to 'netfs/fuse')
-rw-r--r-- | netfs/fuse/fuseApp.h | 2 | ||||
-rw-r--r-- | netfs/fuse/fuseDirs.cpp | 29 |
2 files changed, 20 insertions, 11 deletions
diff --git a/netfs/fuse/fuseApp.h b/netfs/fuse/fuseApp.h index ec75d03..2c9824b 100644 --- a/netfs/fuse/fuseApp.h +++ b/netfs/fuse/fuseApp.h @@ -22,6 +22,7 @@ namespace NetFS { OpenDir(DirectoryPrx remote, const std::string & path); DirectoryPrx remote; + DirectoryV2Prx remoteV2; const std::string path; }; typedef IceUtil::Handle<OpenDir> OpenDirPtr; @@ -95,7 +96,6 @@ namespace NetFS { virtual NetFS::Client::ResourcePtr configureFromUri(const std::string &) const; private: - void setProxy(OpenFilePtr, uint64_t & fh); OpenFilePtr getFileProxy(uint64_t localID) const; void clearFileProxy(uint64_t localID); diff --git a/netfs/fuse/fuseDirs.cpp b/netfs/fuse/fuseDirs.cpp index 00c0ca4..03cc712 100644 --- a/netfs/fuse/fuseDirs.cpp +++ b/netfs/fuse/fuseDirs.cpp @@ -4,6 +4,7 @@ NetFS::FuseApp::OpenDir::OpenDir(DirectoryPrx r, const std::string & p) : remote(r), + remoteV2(r->ice_getFacet() == "v2" ? DirectoryV2Prx::uncheckedCast(r) : nullptr), path(p) { } @@ -65,18 +66,26 @@ int NetFS::FuseApp::readdir(const char * p, void * buf, fuse_fill_dir_t filler, off_t, struct fuse_file_info * fi) { try { - auto remote = getDirProxy(fi->fh)->remote; - NetFS::NameList ds = remote->readdir(); + auto od = getDirProxy(fi->fh); std::string path(p); - NetFS::VolumePrx vc = volume; - for (const auto & e : ds) { - filler(buf, e.c_str(), NULL, 0); - std::string epath = path + "/" + e; - auto asga = volume->begin_getattr(reqEnv(), epath); - statCache.addFactory(epath, + path += "/"; + auto expiry = time(NULL) + 2; + if (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); + } + } + 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)); - }, time(NULL) + 2); + return converter.convert(volume->end_getattr(asga)); + }, expiry); + } } return 0; } |