summaryrefslogtreecommitdiff
path: root/netfs/daemon
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-02-03 01:47:15 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2019-02-03 01:54:12 +0000
commitb6d99e9e74c2f74513855ffac4564b0878a83273 (patch)
treec905a94914a1f1650e5fe67bf5c618bfdb68c9e4 /netfs/daemon
parentAdd missing explicit on install targets (diff)
downloadnetfs-b6d99e9e74c2f74513855ffac4564b0878a83273.tar.bz2
netfs-b6d99e9e74c2f74513855ffac4564b0878a83273.tar.xz
netfs-b6d99e9e74c2f74513855ffac4564b0878a83273.zip
Remove boost::filesystem in favour of std::filesystem
Diffstat (limited to 'netfs/daemon')
-rw-r--r--netfs/daemon/Jamfile.jam7
-rw-r--r--netfs/daemon/daemon.cpp4
-rw-r--r--netfs/daemon/daemon.h6
-rw-r--r--netfs/daemon/daemonVolume.cpp53
-rw-r--r--netfs/daemon/daemonVolume.h8
-rw-r--r--netfs/daemon/modeCheck.cpp14
-rw-r--r--netfs/daemon/modeCheck.h18
7 files changed, 53 insertions, 57 deletions
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;