From b6d99e9e74c2f74513855ffac4564b0878a83273 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 3 Feb 2019 01:47:15 +0000 Subject: Remove boost::filesystem in favour of std::filesystem --- netfs/Jamfile.jam | 3 +-- netfs/daemon/Jamfile.jam | 7 ++---- netfs/daemon/daemon.cpp | 4 +-- netfs/daemon/daemon.h | 6 ++--- netfs/daemon/daemonVolume.cpp | 53 +++++++++++++++++++-------------------- netfs/daemon/daemonVolume.h | 8 +++--- netfs/daemon/modeCheck.cpp | 14 +++++------ netfs/daemon/modeCheck.h | 18 ++++++------- netfs/fuse/Jamfile.jam | 4 +-- netfs/fuse/fuseApp.cpp | 2 +- netfs/fuse/fuseApp.h | 4 +-- netfs/lib/Jamfile.jam | 1 - netfs/unittests/Jamfile.jam | 8 ++---- netfs/unittests/mockDaemon.cpp | 11 ++++---- netfs/unittests/mockDaemon.h | 2 +- netfs/unittests/mockFuse.cpp | 2 +- netfs/unittests/mockFuse.h | 2 +- netfs/unittests/testCore.cpp | 34 ++++++++++++------------- netfs/unittests/testEdgeCases.cpp | 1 - netfs/unittests/testGlacier.cpp | 1 - 20 files changed, 85 insertions(+), 100 deletions(-) diff --git a/netfs/Jamfile.jam b/netfs/Jamfile.jam index 78391cf..eaac516 100644 --- a/netfs/Jamfile.jam +++ b/netfs/Jamfile.jam @@ -1,5 +1,4 @@ -lib boost_filesystem : : boost_filesystem ; -lib boost_system : : boost_system ; +lib stdc++fs ; lib boost_random : : boost_random ; lib Ice : : Ice++11 ; lib IceBox : : IceBox++11 ; diff --git a/netfs/daemon/Jamfile.jam b/netfs/daemon/Jamfile.jam index 043416c..866abae 100644 --- a/netfs/daemon/Jamfile.jam +++ b/netfs/daemon/Jamfile.jam @@ -7,15 +7,13 @@ lib netfsd-configuration : ../ice//netfs-api ../ice//netfs-api ..//Ice - ..//boost_filesystem - ..//boost_system + ..//stdc++fs ..//slicer ..//adhocutil yes : : . ..//Ice - ..//boost_system ..//slicer ; @@ -28,8 +26,7 @@ lib netfsd++11 : ../ice//netfs-api ../lib//netfs-common ..//boost_random - ..//boost_filesystem - ..//boost_system + ..//stdc++fs ..//Ice ..//IceBox ..//adhocutil diff --git a/netfs/daemon/daemon.cpp b/netfs/daemon/daemon.cpp index f022467..27dfbb9 100644 --- a/netfs/daemon/daemon.cpp +++ b/netfs/daemon/daemon.cpp @@ -45,14 +45,14 @@ NetFSDaemon::start(const std::string & name, const Ice::CommunicatorPtr & ic, co } NetFS::Daemon::ConfigurationPtr -NetFSDaemon::ReadConfiguration(const boost::filesystem::path & path) const +NetFSDaemon::ReadConfiguration(const std::filesystem::path & path) const { auto s = Slicer::FileDeserializerFactory::createNew(path.extension().string(), path); return Slicer::DeserializeAnyWith(s); } void -NetFSDaemon::LoadConfiguration(const boost::filesystem::path & path) +NetFSDaemon::LoadConfiguration(const std::filesystem::path & path) { dc = std::make_shared(); dc->CurrentConfiguration = ReadConfiguration(path); diff --git a/netfs/daemon/daemon.h b/netfs/daemon/daemon.h index 7599388..57e2023 100644 --- a/netfs/daemon/daemon.h +++ b/netfs/daemon/daemon.h @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include class DLL_PUBLIC NetFSDaemon : public IceBox::Service { @@ -16,10 +16,10 @@ class DLL_PUBLIC NetFSDaemon : public IceBox::Service { virtual void stop() override; protected: - virtual NetFS::Daemon::ConfigurationPtr ReadConfiguration(const boost::filesystem::path & path) const; + virtual NetFS::Daemon::ConfigurationPtr ReadConfiguration(const std::filesystem::path & path) const; private: - void LoadConfiguration(const boost::filesystem::path & path); + void LoadConfiguration(const std::filesystem::path & path); Ice::CommunicatorPtr ic; Ice::ObjectAdapterPtr adapter; diff --git a/netfs/daemon/daemonVolume.cpp b/netfs/daemon/daemonVolume.cpp index 8ddea5d..2a6cc09 100644 --- a/netfs/daemon/daemonVolume.cpp +++ b/netfs/daemon/daemonVolume.cpp @@ -9,15 +9,14 @@ #include "daemonFile.h" #include "daemonDirectory.h" #include "modeCheck.h" -#include #include #include #include "daemon.h" extern std::map files; -VolumeServer::VolumeServer(const boost::filesystem::path & r, const EntCache & u, const EntCache & g) : - root(boost::filesystem::canonical(r)), +VolumeServer::VolumeServer(const std::filesystem::path & r, const EntCache & u, const EntCache & g) : + root(std::filesystem::canonical(r)), userLookup(u), groupLookup(g), converter(u, g) @@ -39,7 +38,7 @@ VolumeServer::access(const NetFS::ReqEnv re, const std::string path, Ice::Int mo { ModeCheck mc(re, root, userLookup, groupLookup); struct stat s; - boost::filesystem::path p(resolvePath(path)); + std::filesystem::path p(resolvePath(path)); if (::stat(p.c_str(), &s) != 0) { return errno; } @@ -65,7 +64,7 @@ VolumeServer::getattr(const NetFS::ReqEnv re, const std::string path, const Ice: { ModeCheck mc(re, root, userLookup, groupLookup); struct stat s; - boost::filesystem::path p(resolvePath(path)); + std::filesystem::path p(resolvePath(path)); mc.AssertReadParent(p); if (::lstat(p.c_str(), &s) != 0) { throw NetFS::SystemError(errno); @@ -78,7 +77,7 @@ VolumeServer::mknod(const NetFS::ReqEnv re, const std::string path, Ice::Int mod { ModeCheck mc(re, root, userLookup, groupLookup); errno = 0; - boost::filesystem::path p(resolvePath(path)); + std::filesystem::path p(resolvePath(path)); mc.AssertWriteParent(p); if (::mknod(p.c_str(), mode, dev) != 0) { throw NetFS::SystemError(errno); @@ -90,7 +89,7 @@ VolumeServer::symlink(const NetFS::ReqEnv re, const std::string path1, const std { ModeCheck mc(re, root, userLookup, groupLookup); errno = 0; - boost::filesystem::path p(resolvePath(path2)); + std::filesystem::path p(resolvePath(path2)); mc.AssertWriteParent(p); if (::symlink(path1.c_str(), p.c_str()) != 0) { throw NetFS::SystemError(errno); @@ -106,8 +105,8 @@ VolumeServer::link(const NetFS::ReqEnv re, const std::string path1, const std::s { ModeCheck mc(re, root, userLookup, groupLookup); errno = 0; - boost::filesystem::path p1(resolvePath(path1)); - boost::filesystem::path p2(resolvePath(path2)); + std::filesystem::path p1(resolvePath(path1)); + std::filesystem::path p2(resolvePath(path2)); if (::link(p1.c_str(), p2.c_str()) != 0) { throw NetFS::SystemError(errno); } @@ -122,8 +121,8 @@ VolumeServer::rename(const NetFS::ReqEnv re, const std::string from, const std:: { ModeCheck mc(re, root, userLookup, groupLookup); errno = 0; - boost::filesystem::path f(resolvePath(from)); - boost::filesystem::path t(resolvePath(to)); + std::filesystem::path f(resolvePath(from)); + std::filesystem::path t(resolvePath(to)); mc.AssertWriteParent(f); mc.AssertWriteParent(t); if (::rename(f.c_str(), t.c_str()) != 0) { @@ -137,7 +136,7 @@ VolumeServer::readlink(const NetFS::ReqEnv re, const std::string path, const Ice ModeCheck mc(re, root, userLookup, groupLookup); errno = 0; char buf[PATH_MAX]; - boost::filesystem::path p(resolvePath(path)); + std::filesystem::path p(resolvePath(path)); mc.AssertRead(p); ssize_t rc = ::readlink(p.c_str(), buf, PATH_MAX); if (rc == -1) { @@ -151,7 +150,7 @@ VolumeServer::chmod(const NetFS::ReqEnv re, const std::string path, Ice::Int mod { ModeCheck mc(re, root, userLookup, groupLookup); errno = 0; - boost::filesystem::path p(resolvePath(path)); + std::filesystem::path p(resolvePath(path)); mc.AssertWritePerms(p); if (::chmod(p.c_str(), mode) != 0) { throw NetFS::SystemError(errno); @@ -163,7 +162,7 @@ VolumeServer::chown(const NetFS::ReqEnv re, const std::string path, Ice::Int uid { ModeCheck mc(re, root, userLookup, groupLookup); errno = 0; - boost::filesystem::path p(resolvePath(path)); + std::filesystem::path p(resolvePath(path)); mc.AssertWrite(p); if (::lchown(p.c_str(), uid, gid) != 0) { throw NetFS::SystemError(errno); @@ -181,7 +180,7 @@ VolumeServer::utimens(const NetFS::ReqEnv re, const std::string path, times[0].tv_nsec = ns0; times[1].tv_sec = s1; times[1].tv_nsec = ns1; - boost::filesystem::path p(resolvePath(path)); + std::filesystem::path p(resolvePath(path)); mc.AssertWrite(p); if (::utimensat(0, p.c_str(), times, AT_SYMLINK_NOFOLLOW) != 0) { throw NetFS::SystemError(errno); @@ -194,7 +193,7 @@ VolumeServer::statfs(const NetFS::ReqEnv re, const std::string path, const Ice:: ModeCheck mc(re, root, userLookup, groupLookup); errno = 0; struct statvfs s; - boost::filesystem::path p(resolvePath(path)); + std::filesystem::path p(resolvePath(path)); mc.AssertRead(p); if (::statvfs(p.c_str(), &s) != 0) { throw NetFS::SystemError(errno); @@ -207,7 +206,7 @@ VolumeServer::truncate(const NetFS::ReqEnv re, const std::string path, Ice::Long { ModeCheck mc(re, root, userLookup, groupLookup); errno = 0; - boost::filesystem::path p(resolvePath(path)); + std::filesystem::path p(resolvePath(path)); mc.AssertWrite(p); if (::truncate(p.c_str(), size) != 0) { throw NetFS::SystemError(errno); @@ -219,7 +218,7 @@ VolumeServer::unlink(const NetFS::ReqEnv re, const std::string path, const Ice:: { ModeCheck mc(re, root, userLookup, groupLookup); errno = 0; - boost::filesystem::path p(resolvePath(path)); + std::filesystem::path p(resolvePath(path)); mc.AssertWriteParent(p); if (::unlink(p.c_str()) != 0) { throw NetFS::SystemError(errno); @@ -231,7 +230,7 @@ VolumeServer::open(const NetFS::ReqEnv re, const std::string path, Ice::Int flag { ModeCheck mc(re, root, userLookup, groupLookup); errno = 0; - boost::filesystem::path p(resolvePath(path)); + std::filesystem::path p(resolvePath(path)); mc.AssertRead(p); if (flags & O_CREAT) { throw NetFS::SystemError(EINVAL); @@ -249,7 +248,7 @@ VolumeServer::create(const NetFS::ReqEnv re, const std::string path, Ice::Int fl { ModeCheck mc(re, root, userLookup, groupLookup); errno = 0; - boost::filesystem::path p(resolvePath(path)); + std::filesystem::path p(resolvePath(path)); mc.AssertWriteParent(p); int fd = ::open(p.c_str(), O_CREAT | O_EXCL | flags, mode); if (fd == -1) { @@ -269,7 +268,7 @@ VolumeServer::opendir(const NetFS::ReqEnv re, const std::string path, const Ice: { ModeCheck mc(re, root, userLookup, groupLookup); errno = 0; - boost::filesystem::path p(resolvePath(path)); + std::filesystem::path p(resolvePath(path)); mc.AssertRead(p); DIR * od = ::opendir(p.c_str()); if (!od) { @@ -284,7 +283,7 @@ VolumeServer::mkdir(const NetFS::ReqEnv re, const std::string path, Ice::Int mod { ModeCheck mc(re, root, userLookup, groupLookup); errno = 0; - boost::filesystem::path p(resolvePath(path)); + std::filesystem::path p(resolvePath(path)); mc.AssertWriteParent(p); if (::mkdir(p.c_str(), mode) != 0) { throw NetFS::SystemError(errno); @@ -300,15 +299,15 @@ VolumeServer::rmdir(const NetFS::ReqEnv re, const std::string path, const Ice::C { ModeCheck mc(re, root, userLookup, groupLookup); errno = 0; - boost::filesystem::path p(resolvePath(path)); + std::filesystem::path p(resolvePath(path)); mc.AssertWriteParent(p); if (::rmdir(p.c_str()) != 0) { throw NetFS::SystemError(errno); } } -boost::filesystem::path -normalizedAppend(boost::filesystem::path out, const boost::filesystem::path & in) +std::filesystem::path +normalizedAppend(std::filesystem::path out, const std::filesystem::path & in) { unsigned int depth = 0; for(auto e : in) { @@ -319,7 +318,7 @@ normalizedAppend(boost::filesystem::path out, const boost::filesystem::path & in if (depth == 0) { throw NetFS::SystemError(EPERM); } - out.remove_leaf(); + out.remove_filename(); depth -= 1; } else { @@ -330,7 +329,7 @@ normalizedAppend(boost::filesystem::path out, const boost::filesystem::path & in return out; } -boost::filesystem::path +std::filesystem::path VolumeServer::resolvePath(const std::string & path) const { return normalizedAppend(root, path); diff --git a/netfs/daemon/daemonVolume.h b/netfs/daemon/daemonVolume.h index 9f31aa7..1549f6d 100644 --- a/netfs/daemon/daemonVolume.h +++ b/netfs/daemon/daemonVolume.h @@ -3,13 +3,13 @@ #include #include -#include +#include #include #include class VolumeServer : public NetFS::Volume { public: - VolumeServer(const boost::filesystem::path & root, const EntCache &, const EntCache &); + VolumeServer(const std::filesystem::path & root, const EntCache &, const EntCache &); virtual ~VolumeServer(); virtual NetFS::DirectoryPrxPtr opendir(const NetFS::ReqEnv, const std::string path, const Ice::Current&) override; @@ -40,10 +40,10 @@ class VolumeServer : public NetFS::Volume { virtual void disconnect(const Ice::Current&) override; protected: - boost::filesystem::path resolvePath(const std::string & path) const; + std::filesystem::path resolvePath(const std::string & path) const; private: - const boost::filesystem::path root; + const std::filesystem::path root; const EntCache & userLookup; const EntCache & groupLookup; diff --git a/netfs/daemon/modeCheck.cpp b/netfs/daemon/modeCheck.cpp index df409bf..91bbe20 100644 --- a/netfs/daemon/modeCheck.cpp +++ b/netfs/daemon/modeCheck.cpp @@ -2,7 +2,7 @@ #include #include -ModeCheck::ModeCheck(const NetFS::ReqEnv & re, const boost::filesystem::path & r, const EntCache & u, const EntCache & g) : +ModeCheck::ModeCheck(const NetFS::ReqEnv & re, const std::filesystem::path & r, const EntCache & u, const EntCache & g) : myu(u.getEntry(re.user)->id), myg(g.getEntry(re.grp)->id), root(r), @@ -12,7 +12,7 @@ ModeCheck::ModeCheck(const NetFS::ReqEnv & re, const boost::filesystem::path & r } void -ModeCheck::AssertReadParent(const boost::filesystem::path & p) const +ModeCheck::AssertReadParent(const std::filesystem::path & p) const { if (p != root) { AssertRead(p.parent_path()); @@ -20,7 +20,7 @@ ModeCheck::AssertReadParent(const boost::filesystem::path & p) const } void -ModeCheck::AssertRead(const boost::filesystem::path & p) const +ModeCheck::AssertRead(const std::filesystem::path & p) const { if (p != root) { AssertRead(p.parent_path()); @@ -31,7 +31,7 @@ ModeCheck::AssertRead(const boost::filesystem::path & p) const } void -ModeCheck::AssertWriteParent(const boost::filesystem::path & p) const +ModeCheck::AssertWriteParent(const std::filesystem::path & p) const { if (p != root) { AssertWrite(p.parent_path()); @@ -42,7 +42,7 @@ ModeCheck::AssertWriteParent(const boost::filesystem::path & p) const } void -ModeCheck::AssertWrite(const boost::filesystem::path & p) const +ModeCheck::AssertWrite(const std::filesystem::path & p) const { if (p != root) { AssertRead(p.parent_path()); @@ -53,7 +53,7 @@ ModeCheck::AssertWrite(const boost::filesystem::path & p) const } void -ModeCheck::AssertWritePerms(const boost::filesystem::path & p) const +ModeCheck::AssertWritePerms(const std::filesystem::path & p) const { if (p != root) { AssertRead(p.parent_path()); @@ -65,7 +65,7 @@ ModeCheck::AssertWritePerms(const boost::filesystem::path & p) const } struct stat -ModeCheck::lstat(const boost::filesystem::path & p) +ModeCheck::lstat(const std::filesystem::path & p) { struct stat s; if (::lstat(p.c_str(), &s) != 0) { diff --git a/netfs/daemon/modeCheck.h b/netfs/daemon/modeCheck.h index 54a82e2..78c1708 100644 --- a/netfs/daemon/modeCheck.h +++ b/netfs/daemon/modeCheck.h @@ -3,29 +3,29 @@ #include #include -#include +#include #include class ModeCheck { public: - ModeCheck(const NetFS::ReqEnv & re, const boost::filesystem::path &, const EntCache &, const EntCache &); + ModeCheck(const NetFS::ReqEnv & re, const std::filesystem::path &, const EntCache &, const EntCache &); - void AssertReadParent(const boost::filesystem::path &) const; - void AssertRead(const boost::filesystem::path &) const; - void AssertWriteParent(const boost::filesystem::path &) const; - void AssertWrite(const boost::filesystem::path &) const; - void AssertWritePerms(const boost::filesystem::path &) const; + void AssertReadParent(const std::filesystem::path &) const; + void AssertRead(const std::filesystem::path &) const; + void AssertWriteParent(const std::filesystem::path &) const; + void AssertWrite(const std::filesystem::path &) const; + void AssertWritePerms(const std::filesystem::path &) const; const uid_t myu; const gid_t myg; - const boost::filesystem::path & root; + const std::filesystem::path & root; bool ReadableBy(const struct stat &, uid_t u, gid_t g) const; bool WritableBy(const struct stat &, uid_t u, gid_t g) const; bool ExecutableBy(const struct stat &, uid_t u, gid_t g) const; private: - static struct stat lstat(const boost::filesystem::path &); + static struct stat lstat(const std::filesystem::path &); const EntCache & userLookup; const EntCache & groupLookup; diff --git a/netfs/fuse/Jamfile.jam b/netfs/fuse/Jamfile.jam index 67a0600..6972e3f 100644 --- a/netfs/fuse/Jamfile.jam +++ b/netfs/fuse/Jamfile.jam @@ -15,7 +15,6 @@ lib netfs-client-configuration : ..//adhocutil : : ..//Ice - ..//boost_system ..//slicer ; @@ -28,8 +27,7 @@ lib netfs-client : netfs-client-configuration ../ice//netfs-api ../lib//netfs-common - ..//boost_system - ..//boost_filesystem + ..//stdc++fs ..//Ice Glacier2 ..//slicer diff --git a/netfs/fuse/fuseApp.cpp b/netfs/fuse/fuseApp.cpp index 6064e67..79fa0dd 100644 --- a/netfs/fuse/fuseApp.cpp +++ b/netfs/fuse/fuseApp.cpp @@ -66,7 +66,7 @@ NetFS::FuseApp::~FuseApp() } NetFS::Client::ConfigurationPtr -NetFS::FuseApp::ReadConfiguration(const boost::filesystem::path & path) const +NetFS::FuseApp::ReadConfiguration(const std::filesystem::path & path) const { auto s = Slicer::FileDeserializerFactory::createNew(path.extension().string(), path); return Slicer::DeserializeAnyWith(s); diff --git a/netfs/fuse/fuseApp.h b/netfs/fuse/fuseApp.h index f37acb7..23738b3 100644 --- a/netfs/fuse/fuseApp.h +++ b/netfs/fuse/fuseApp.h @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include #include @@ -102,7 +102,7 @@ namespace NetFS { protected: typedef std::function Configurator; Configurator configurator; - virtual NetFS::Client::ConfigurationPtr ReadConfiguration(const boost::filesystem::path &) const; + virtual NetFS::Client::ConfigurationPtr ReadConfiguration(const std::filesystem::path &) const; virtual NetFS::Client::ResourcePtr configureFromFile(const std::string &, const std::string &) const; virtual NetFS::Client::ResourcePtr configureFromUri(const std::string &) const; diff --git a/netfs/lib/Jamfile.jam b/netfs/lib/Jamfile.jam index 87b8ba4..a2d3454 100644 --- a/netfs/lib/Jamfile.jam +++ b/netfs/lib/Jamfile.jam @@ -2,7 +2,6 @@ lib netfs-common : [ glob *.cpp ] : ../ice - ..//boost_system ../ice//netfs-api ..//adhocutil ../ice//netfs-api diff --git a/netfs/unittests/Jamfile.jam b/netfs/unittests/Jamfile.jam index 2360739..a5dfbdf 100644 --- a/netfs/unittests/Jamfile.jam +++ b/netfs/unittests/Jamfile.jam @@ -1,8 +1,6 @@ import testing ; lib boost_utf : : boost_unit_test_framework ; -lib boost_system ; -lib boost_filesystem ; path-constant me : . ; @@ -10,8 +8,7 @@ lib testMocks : [ glob mock*.cpp ] : ..//Ice - boost_system - boost_filesystem + ..//stdc++fs ../daemon//netfsd++11 ../fuse//netfs-client ../ice//netfs-api @@ -21,8 +18,7 @@ lib testMocks : ROOT=\"$(me)\" : : ..//adhocutil - boost_system - boost_filesystem + ..//stdc++fs ../daemon//netfsd++11 ../fuse//netfs-client ROOT=\"$(me)\" diff --git a/netfs/unittests/mockDaemon.cpp b/netfs/unittests/mockDaemon.cpp index 74d4dab..14b843f 100644 --- a/netfs/unittests/mockDaemon.cpp +++ b/netfs/unittests/mockDaemon.cpp @@ -1,9 +1,8 @@ #include "mockDaemon.h" -#include #include #include -const boost::filesystem::path TestExportRoot(binDir / +const std::filesystem::path TestExportRoot(binDir / UniqueExport::get(getpid())); MockDaemon::MockDaemon(const std::string & ep) : @@ -13,7 +12,7 @@ MockDaemon::MockDaemon(const std::string & ep) : } NetFS::Daemon::ConfigurationPtr -MockDaemon::ReadConfiguration(const boost::filesystem::path & path) const +MockDaemon::ReadConfiguration(const std::filesystem::path & path) const { auto c = NetFSDaemon::ReadConfiguration(path); for(auto e : c->Exports) { @@ -28,15 +27,15 @@ MockDaemonHost::MockDaemonHost(const std::string & ep, const Ice::StringSeq & ps params(ps), daemon(nullptr) { - boost::filesystem::remove_all(TestExportRoot); - boost::filesystem::create_directories(TestExportRoot); + std::filesystem::remove_all(TestExportRoot); + std::filesystem::create_directories(TestExportRoot); restart(); } MockDaemonHost::~MockDaemonHost() { stop(); - boost::filesystem::remove_all(TestExportRoot); + std::filesystem::remove_all(TestExportRoot); } void diff --git a/netfs/unittests/mockDaemon.h b/netfs/unittests/mockDaemon.h index ae6614b..dd0a0ad 100644 --- a/netfs/unittests/mockDaemon.h +++ b/netfs/unittests/mockDaemon.h @@ -14,7 +14,7 @@ class DLL_PUBLIC MockDaemon : public NetFSDaemon { const std::string testEndpoint; protected: - virtual NetFS::Daemon::ConfigurationPtr ReadConfiguration(const boost::filesystem::path &) const override; + virtual NetFS::Daemon::ConfigurationPtr ReadConfiguration(const std::filesystem::path &) const override; }; class DLL_PUBLIC MockDaemonHost { diff --git a/netfs/unittests/mockFuse.cpp b/netfs/unittests/mockFuse.cpp index 1dca70b..d7b66a6 100644 --- a/netfs/unittests/mockFuse.cpp +++ b/netfs/unittests/mockFuse.cpp @@ -35,7 +35,7 @@ FuseMock::main(int, char **, const struct fuse_operations * o) } NetFS::Client::ConfigurationPtr -FuseMock::ReadConfiguration(const boost::filesystem::path & path) const +FuseMock::ReadConfiguration(const std::filesystem::path & path) const { auto c = FuseApp::ReadConfiguration(path); for(auto r : c->Resources) { diff --git a/netfs/unittests/mockFuse.h b/netfs/unittests/mockFuse.h index fa3a92b..9b3d2e0 100644 --- a/netfs/unittests/mockFuse.h +++ b/netfs/unittests/mockFuse.h @@ -16,7 +16,7 @@ class DLL_PUBLIC FuseMock : public NetFS::FuseApp { fuse_operations ops; protected: - virtual NetFS::Client::ConfigurationPtr ReadConfiguration(const boost::filesystem::path &) const override; + virtual NetFS::Client::ConfigurationPtr ReadConfiguration(const std::filesystem::path &) const override; private: const std::string testEndpoint; diff --git a/netfs/unittests/testCore.cpp b/netfs/unittests/testCore.cpp index 395644c..b56b3d5 100644 --- a/netfs/unittests/testCore.cpp +++ b/netfs/unittests/testCore.cpp @@ -4,7 +4,7 @@ #include "mockDaemon.h" #include "mockFuse.h" #include -#include +#include #include #include #include @@ -117,7 +117,7 @@ BOOST_AUTO_TEST_CASE( testNavigation ) int fd = fuse->create("/inside", 0666, &fi); BOOST_REQUIRE(fd >= 0); fuse->release("/inside", &fi); - BOOST_REQUIRE(boost::filesystem::exists(binDir / testExport / "inside")); + BOOST_REQUIRE(std::filesystem::exists(binDir / testExport / "inside")); BOOST_REQUIRE_EQUAL(lstat((binDir / testExport).c_str(), &rootattr), 0); BOOST_REQUIRE_EQUAL(lstat((binDir / testExport / "inside").c_str(), &insideattr), 0); BOOST_REQUIRE_EQUAL(0, fuse->getattr("/", &attr)); @@ -145,29 +145,29 @@ BOOST_AUTO_TEST_CASE( testNavigation ) BOOST_AUTO_TEST_CASE( testSandboxing ) { // A previous (bad) run might create one or more of these: - boost::filesystem::remove(binDir / "outside"); - boost::filesystem::remove(binDir / "sub" / "outside"); - boost::filesystem::remove(binDir / "sub"); + std::filesystem::remove(binDir / "outside"); + std::filesystem::remove(binDir / "sub" / "outside"); + std::filesystem::remove(binDir / "sub"); struct fuse_file_info fi; memset(&fi, 0, sizeof(fi)); BOOST_REQUIRE_EQUAL(fuse->create("../outside", 0666, &fi), -EPERM); - BOOST_REQUIRE(!boost::filesystem::exists(binDir / "outside")); + BOOST_REQUIRE(!std::filesystem::exists(binDir / "outside")); BOOST_REQUIRE_EQUAL(fuse->create("/../outside", 0666, &fi), -EPERM); - BOOST_REQUIRE(!boost::filesystem::exists(binDir / "outside")); + BOOST_REQUIRE(!std::filesystem::exists(binDir / "outside")); BOOST_REQUIRE_EQUAL(fuse->create("../sub/outside", 0666, &fi), -EPERM); - BOOST_REQUIRE(!boost::filesystem::exists(binDir / "sub" / "outside")); + BOOST_REQUIRE(!std::filesystem::exists(binDir / "sub" / "outside")); BOOST_REQUIRE_EQUAL(fuse->create("/../sub/outside", 0666, &fi), -EPERM); - BOOST_REQUIRE(!boost::filesystem::exists(binDir / "sub" / "outside")); + BOOST_REQUIRE(!std::filesystem::exists(binDir / "sub" / "outside")); BOOST_REQUIRE_EQUAL(fuse->create("../sub/../outside", 0666, &fi), -EPERM); - BOOST_REQUIRE(!boost::filesystem::exists(binDir / "outside")); + BOOST_REQUIRE(!std::filesystem::exists(binDir / "outside")); BOOST_REQUIRE_EQUAL(fuse->create("/../sub/../outside", 0666, &fi), -EPERM); - BOOST_REQUIRE(!boost::filesystem::exists(binDir / "outside")); + BOOST_REQUIRE(!std::filesystem::exists(binDir / "outside")); BOOST_REQUIRE_EQUAL(fuse->create("/inside", 0666, &fi), 0); BOOST_REQUIRE_EQUAL(fuse->release("/inside", &fi), 0); - BOOST_REQUIRE(boost::filesystem::exists(binDir / testExport / "inside")); + BOOST_REQUIRE(std::filesystem::exists(binDir / testExport / "inside")); BOOST_REQUIRE_EQUAL(fuse->create("inside2", 0666, &fi), 0); BOOST_REQUIRE_EQUAL(fuse->release("inside2", &fi), 0); - BOOST_REQUIRE(boost::filesystem::exists(binDir / testExport / "inside2")); + BOOST_REQUIRE(std::filesystem::exists(binDir / testExport / "inside2")); } void @@ -197,7 +197,7 @@ BOOST_AUTO_TEST_CASE( directories ) struct stat st; memset(&st, 0, sizeof(st)); BOOST_REQUIRE_EQUAL(fuse->mkdir("/test", 0700), 0); - BOOST_REQUIRE(boost::filesystem::is_directory(binDir / testExport / "test")); + BOOST_REQUIRE(std::filesystem::is_directory(binDir / testExport / "test")); BOOST_REQUIRE_EQUAL(fuse->mkdir("/test", 0700), -EEXIST); BOOST_REQUIRE_EQUAL(fuse->getattr("/test", &st), 0); @@ -230,7 +230,7 @@ BOOST_AUTO_TEST_CASE( directories ) BOOST_REQUIRE_EQUAL(fuse->rmdir("/test"), -ENOTEMPTY); BOOST_REQUIRE_EQUAL(fuse->rmdir("/test/sub"), 0); BOOST_REQUIRE_EQUAL(fuse->rmdir("/test"), 0); - BOOST_REQUIRE(!boost::filesystem::is_directory(binDir / testExport / "test")); + BOOST_REQUIRE(!std::filesystem::is_directory(binDir / testExport / "test")); BOOST_REQUIRE_EQUAL(fuse->rmdir("/test"), -ENOENT); BOOST_REQUIRE_EQUAL(fuse->getattr("/test", &st), -ENOENT); BOOST_REQUIRE_EQUAL(fuse->opendir("/test", &fi), -ENOENT); @@ -510,7 +510,7 @@ BOOST_AUTO_TEST_CASE( noListDir ) struct fuse_file_info fi; memset(&fi, 0, sizeof(fi)); BOOST_REQUIRE_EQUAL(fuse->mkdir("/test", 0700), 0); - BOOST_REQUIRE(boost::filesystem::is_directory(binDir / testExport / "test")); + BOOST_REQUIRE(std::filesystem::is_directory(binDir / testExport / "test")); BOOST_REQUIRE_EQUAL(fuse->mkdir("/test", 0700), -EEXIST); BOOST_REQUIRE_EQUAL(fuse->opendir("/test", &fi), 0); @@ -540,7 +540,7 @@ BOOST_AUTO_TEST_CASE( noListDir ) BOOST_REQUIRE_EQUAL(fuse->rmdir("/test"), -ENOTEMPTY); BOOST_REQUIRE_EQUAL(fuse->rmdir("/test/sub"), 0); BOOST_REQUIRE_EQUAL(fuse->rmdir("/test"), 0); - BOOST_REQUIRE(!boost::filesystem::is_directory(binDir / testExport / "test")); + BOOST_REQUIRE(!std::filesystem::is_directory(binDir / testExport / "test")); BOOST_REQUIRE_EQUAL(fuse->rmdir("/test"), -ENOENT); BOOST_REQUIRE_EQUAL(fuse->opendir("/test", &fi), -ENOENT); } diff --git a/netfs/unittests/testEdgeCases.cpp b/netfs/unittests/testEdgeCases.cpp index f105869..0cfb888 100644 --- a/netfs/unittests/testEdgeCases.cpp +++ b/netfs/unittests/testEdgeCases.cpp @@ -2,7 +2,6 @@ #include #include "mockDaemon.h" #include "mockFuse.h" -#include #include const std::string testEndpoint("tcp -h localhost -p 12014"); diff --git a/netfs/unittests/testGlacier.cpp b/netfs/unittests/testGlacier.cpp index b21b7e6..900a531 100644 --- a/netfs/unittests/testGlacier.cpp +++ b/netfs/unittests/testGlacier.cpp @@ -2,7 +2,6 @@ #include #include "mockDaemon.h" #include "mockFuse.h" -#include #include #include -- cgit v1.2.3