From c8451301c07bf976a121d0af3fb36c0f18084bde Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 23 Nov 2019 13:41:29 +0000 Subject: Simplify directory interface Removes DirectoryV2, merged into Directory Removes listdir option as Fuse now passes the option into readdir --- netfs/daemon/daemonDirectory.h | 2 +- netfs/daemon/daemonVolume.cpp | 4 ++-- netfs/fuse/fuseApp.h | 1 - netfs/fuse/fuseConfig.ice | 3 --- netfs/fuse/fuseDirs.cpp | 5 ++--- netfs/ice/directory.ice | 2 -- netfs/unittests/Jamfile.jam | 1 - netfs/unittests/altFuse.xml | 16 ---------------- netfs/unittests/testCore.cpp | 8 ++++---- 9 files changed, 9 insertions(+), 33 deletions(-) delete mode 100644 netfs/unittests/altFuse.xml diff --git a/netfs/daemon/daemonDirectory.h b/netfs/daemon/daemonDirectory.h index b4da8f2..d0f4e9d 100644 --- a/netfs/daemon/daemonDirectory.h +++ b/netfs/daemon/daemonDirectory.h @@ -5,7 +5,7 @@ #include #include -class DirectoryServer : public NetFS::DirectoryV2, EntryTypeConverter { +class DirectoryServer : public NetFS::Directory, EntryTypeConverter { public: DirectoryServer(DIR * od, EntryTypeConverter &); diff --git a/netfs/daemon/daemonVolume.cpp b/netfs/daemon/daemonVolume.cpp index 6a3c7fe..096d748 100644 --- a/netfs/daemon/daemonVolume.cpp +++ b/netfs/daemon/daemonVolume.cpp @@ -270,8 +270,8 @@ VolumeServer::opendir(const NetFS::ReqEnv re, std::string path, const Ice::Curre if (!od) { throw NetFS::SystemError(errno); } - return Ice::uncheckedCast(ice.adapter->addFacetWithUUID( - std::make_shared(od, converter), "v02")); + return Ice::uncheckedCast(ice.adapter->addWithUUID( + std::make_shared(od, converter))); } void diff --git a/netfs/fuse/fuseApp.h b/netfs/fuse/fuseApp.h index d2b645e..ca3e631 100644 --- a/netfs/fuse/fuseApp.h +++ b/netfs/fuse/fuseApp.h @@ -23,7 +23,6 @@ namespace NetFS { OpenDir(DirectoryPrxPtr remote, std::string path); DirectoryPrxPtr remote; - DirectoryV2PrxPtr remoteV2; const std::string path; }; typedef std::shared_ptr OpenDirPtr; diff --git a/netfs/fuse/fuseConfig.ice b/netfs/fuse/fuseConfig.ice index e425c21..52116ea 100644 --- a/netfs/fuse/fuseConfig.ice +++ b/netfs/fuse/fuseConfig.ice @@ -20,9 +20,6 @@ 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 490a4bb..d2597f8 100644 --- a/netfs/fuse/fuseDirs.cpp +++ b/netfs/fuse/fuseDirs.cpp @@ -5,7 +5,6 @@ namespace NetFS { FuseApp::OpenDir::OpenDir(DirectoryPrxPtr r, std::string p) : remote(std::move(r)), - remoteV2(remote->ice_getFacet() >= "v02" ? Ice::uncheckedCast(remote) : nullptr), path(std::move(p)) { } @@ -52,8 +51,8 @@ FuseApp::readdir(const char * p, void * buf, fuse_fill_dir_t filler, off_t, stru auto od = getProxy(fi->fh); std::string path(p); auto expiry = time(nullptr) + 2; - if (flags == FUSE_READDIR_PLUS && fcr->ListDir && od->remoteV2) { - for (const auto & e : od->remoteV2->listdir()) { + if (flags == FUSE_READDIR_PLUS) { + for (const auto & e : od->remote->listdir()) { filler(buf, e.first.c_str(), nullptr, 0, FUSE_FILL_DIR_PLUS); std::string k(path + e.first); statCache.remove(k); diff --git a/netfs/ice/directory.ice b/netfs/ice/directory.ice index 3718f69..4424d3f 100644 --- a/netfs/ice/directory.ice +++ b/netfs/ice/directory.ice @@ -9,8 +9,6 @@ module NetFS { void close() throws AuthError, SystemError; idempotent NameList readdir() throws AuthError, SystemError; - }; - interface DirectoryV2 extends Directory { idempotent DirectoryContents listdir() throws AuthError, SystemError; }; }; diff --git a/netfs/unittests/Jamfile.jam b/netfs/unittests/Jamfile.jam index 20c15c7..f27a3e5 100644 --- a/netfs/unittests/Jamfile.jam +++ b/netfs/unittests/Jamfile.jam @@ -36,7 +36,6 @@ lib testMocks : run testCore.cpp : -- : altDaemon.xml - altFuse.xml defaultDaemon.xml defaultFuse.xml secureDaemon.xml diff --git a/netfs/unittests/altFuse.xml b/netfs/unittests/altFuse.xml deleted file mode 100644 index 22b791a..0000000 --- a/netfs/unittests/altFuse.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - testvol - - testvol - false - - overridden - - - - - - diff --git a/netfs/unittests/testCore.cpp b/netfs/unittests/testCore.cpp index f0f7980..0f87b02 100644 --- a/netfs/unittests/testCore.cpp +++ b/netfs/unittests/testCore.cpp @@ -87,7 +87,7 @@ class Core { class AltCore : public Core { public: - AltCore() : Core("altDaemon.xml", "altFuse.xml") { } + AltCore() : Core("altDaemon.xml", "defaultFuse.xml") { } }; BOOST_FIXTURE_TEST_SUITE( NetfsCore, Core ); @@ -518,7 +518,7 @@ BOOST_AUTO_TEST_CASE( noListDir ) BOOST_REQUIRE_EQUAL(fuse->opendir("/test", &fi), 0); NetFS::NameList nl; - BOOST_REQUIRE_EQUAL(fuse->readdir("/test", &nl, &nameListAdd, 0, &fi, FUSE_READDIR_PLUS), 0); + BOOST_REQUIRE_EQUAL(fuse->readdir("/test", &nl, &nameListAdd, 0, &fi, (fuse_readdir_flags)0), 0); BOOST_REQUIRE_EQUAL(nl.size(), 2); std::sort(nl.begin(), nl.end()); BOOST_REQUIRE_EQUAL(nl[0], "."); @@ -528,7 +528,7 @@ BOOST_AUTO_TEST_CASE( noListDir ) BOOST_REQUIRE_EQUAL(fuse->mkdir("/test/sub", 0700), 0); BOOST_REQUIRE_EQUAL(fuse->opendir("/test", &fi), 0); - BOOST_REQUIRE_EQUAL(fuse->readdir("/test", &nl, &nameListAdd, 0, &fi, FUSE_READDIR_PLUS), 0); + BOOST_REQUIRE_EQUAL(fuse->readdir("/test", &nl, &nameListAdd, 0, &fi, (fuse_readdir_flags)0), 0); BOOST_REQUIRE_EQUAL(nl.size(), 3); std::sort(nl.begin(), nl.end()); BOOST_REQUIRE_EQUAL(nl[0], "."); @@ -537,7 +537,7 @@ BOOST_AUTO_TEST_CASE( noListDir ) BOOST_REQUIRE_EQUAL(fuse->releasedir("/test", &fi), 0); nl.clear(); - BOOST_REQUIRE_EQUAL(fuse->readdir("/test", &nl, &nameListAdd, 0, &fi, FUSE_READDIR_PLUS), -EBADF); + BOOST_REQUIRE_EQUAL(fuse->readdir("/test", &nl, &nameListAdd, 0, &fi, (fuse_readdir_flags)0), -EBADF); BOOST_REQUIRE_EQUAL(fuse->releasedir("/test", &fi), -EBADF); BOOST_REQUIRE_EQUAL(fuse->rmdir("/test"), -ENOTEMPTY); -- cgit v1.2.3