diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-02-03 01:47:15 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-02-03 01:54:12 +0000 |
commit | b6d99e9e74c2f74513855ffac4564b0878a83273 (patch) | |
tree | c905a94914a1f1650e5fe67bf5c618bfdb68c9e4 | |
parent | Add missing explicit on install targets (diff) | |
download | netfs-b6d99e9e74c2f74513855ffac4564b0878a83273.tar.bz2 netfs-b6d99e9e74c2f74513855ffac4564b0878a83273.tar.xz netfs-b6d99e9e74c2f74513855ffac4564b0878a83273.zip |
Remove boost::filesystem in favour of std::filesystem
-rw-r--r-- | netfs/Jamfile.jam | 3 | ||||
-rw-r--r-- | netfs/daemon/Jamfile.jam | 7 | ||||
-rw-r--r-- | netfs/daemon/daemon.cpp | 4 | ||||
-rw-r--r-- | netfs/daemon/daemon.h | 6 | ||||
-rw-r--r-- | netfs/daemon/daemonVolume.cpp | 53 | ||||
-rw-r--r-- | netfs/daemon/daemonVolume.h | 8 | ||||
-rw-r--r-- | netfs/daemon/modeCheck.cpp | 14 | ||||
-rw-r--r-- | netfs/daemon/modeCheck.h | 18 | ||||
-rw-r--r-- | netfs/fuse/Jamfile.jam | 4 | ||||
-rw-r--r-- | netfs/fuse/fuseApp.cpp | 2 | ||||
-rw-r--r-- | netfs/fuse/fuseApp.h | 4 | ||||
-rw-r--r-- | netfs/lib/Jamfile.jam | 1 | ||||
-rw-r--r-- | netfs/unittests/Jamfile.jam | 8 | ||||
-rw-r--r-- | netfs/unittests/mockDaemon.cpp | 11 | ||||
-rw-r--r-- | netfs/unittests/mockDaemon.h | 2 | ||||
-rw-r--r-- | netfs/unittests/mockFuse.cpp | 2 | ||||
-rw-r--r-- | netfs/unittests/mockFuse.h | 2 | ||||
-rw-r--r-- | netfs/unittests/testCore.cpp | 34 | ||||
-rw-r--r-- | netfs/unittests/testEdgeCases.cpp | 1 | ||||
-rw-r--r-- | 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 : : <name>boost_filesystem ; -lib boost_system : : <name>boost_system ; +lib stdc++fs ; lib boost_random : : <name>boost_random ; lib Ice : : <name>Ice++11 ; lib IceBox : : <name>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 : <library>../ice//netfs-api <implicit-dependency>../ice//netfs-api <library>..//Ice - <library>..//boost_filesystem - <library>..//boost_system + <library>..//stdc++fs <library>..//slicer <library>..//adhocutil <slicer>yes : : <include>. <library>..//Ice - <library>..//boost_system <library>..//slicer ; @@ -28,8 +26,7 @@ lib netfsd++11 : <library>../ice//netfs-api <library>../lib//netfs-common <library>..//boost_random - <library>..//boost_filesystem - <library>..//boost_system + <library>..//stdc++fs <library>..//Ice <library>..//IceBox <library>..//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<NetFS::Daemon::ConfigurationPtr>(s); } void -NetFSDaemon::LoadConfiguration(const boost::filesystem::path & path) +NetFSDaemon::LoadConfiguration(const std::filesystem::path & path) { dc = std::make_shared<NetFS::Daemon::RuntimeConfiguration>(); 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 <Ice/Ice.h> #include <IceBox/IceBox.h> #include <daemonConfig.h> -#include <boost/filesystem/path.hpp> +#include <filesystem> #include <visibility.h> 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 <boost/filesystem/operations.hpp> #include <boost/algorithm/string/predicate.hpp> #include <entCache.h> #include "daemon.h" extern std::map<Ice::Int, int> files; -VolumeServer::VolumeServer(const boost::filesystem::path & r, const EntCache<User> & u, const EntCache<Group> & g) : - root(boost::filesystem::canonical(r)), +VolumeServer::VolumeServer(const std::filesystem::path & r, const EntCache<User> & u, const EntCache<Group> & 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 <volume.h> #include <shared_mutex> -#include <boost/filesystem/path.hpp> +#include <filesystem> #include <entCache.h> #include <typeConverter.h> class VolumeServer : public NetFS::Volume { public: - VolumeServer(const boost::filesystem::path & root, const EntCache<User> &, const EntCache<Group> &); + VolumeServer(const std::filesystem::path & root, const EntCache<User> &, const EntCache<Group> &); 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<User> & userLookup; const EntCache<Group> & 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 <entCache.h> #include <exceptions.h> -ModeCheck::ModeCheck(const NetFS::ReqEnv & re, const boost::filesystem::path & r, const EntCache<User> & u, const EntCache<Group> & g) : +ModeCheck::ModeCheck(const NetFS::ReqEnv & re, const std::filesystem::path & r, const EntCache<User> & u, const EntCache<Group> & 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 <sys/stat.h> #include <types.h> -#include <boost/filesystem/path.hpp> +#include <filesystem> #include <entCache.h> class ModeCheck { public: - ModeCheck(const NetFS::ReqEnv & re, const boost::filesystem::path &, const EntCache<User> &, const EntCache<Group> &); + ModeCheck(const NetFS::ReqEnv & re, const std::filesystem::path &, const EntCache<User> &, const EntCache<Group> &); - 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<User> & userLookup; const EntCache<Group> & 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 : <library>..//adhocutil : : <library>..//Ice - <library>..//boost_system <library>..//slicer ; @@ -28,8 +27,7 @@ lib netfs-client : <implicit-dependency>netfs-client-configuration <library>../ice//netfs-api <library>../lib//netfs-common - <library>..//boost_system - <library>..//boost_filesystem + <library>..//stdc++fs <library>..//Ice <library>Glacier2 <library>..//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<NetFS::Client::ConfigurationPtr>(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 <shared_mutex> #include <functional> -#include <boost/filesystem/path.hpp> +#include <filesystem> #include <Ice/Ice.h> #include <Glacier2/Session.h> #include <service.h> @@ -102,7 +102,7 @@ namespace NetFS { protected: typedef std::function<Client::ResourcePtr()> 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 ] : <include>../ice - <library>..//boost_system <library>../ice//netfs-api <library>..//adhocutil <implicit-dependency>../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 : : <name>boost_unit_test_framework ; -lib boost_system ; -lib boost_filesystem ; path-constant me : . ; @@ -10,8 +8,7 @@ lib testMocks : [ glob mock*.cpp ] : <library>..//Ice - <library>boost_system - <library>boost_filesystem + <library>..//stdc++fs <library>../daemon//netfsd++11 <library>../fuse//netfs-client <library>../ice//netfs-api @@ -21,8 +18,7 @@ lib testMocks : <define>ROOT=\"$(me)\" : : <library>..//adhocutil - <library>boost_system - <library>boost_filesystem + <library>..//stdc++fs <library>../daemon//netfsd++11 <library>../fuse//netfs-client <define>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 <boost/filesystem/operations.hpp> #include <definedDirs.h> #include <buffer.h> -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 <definedDirs.h> -#include <boost/filesystem/path.hpp> +#include <filesystem> #include <ostream> #include <algorithm> #include <fuseFiles.h> @@ -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 <boost/test/unit_test.hpp> #include "mockDaemon.h" #include "mockFuse.h" -#include <boost/filesystem/path.hpp> #include <definedDirs.h> 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 <boost/test/unit_test.hpp> #include "mockDaemon.h" #include "mockFuse.h" -#include <boost/filesystem/path.hpp> #include <boost/scope_exit.hpp> #include <definedDirs.h> |