diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-04-09 16:08:00 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-04-09 16:08:00 +0100 |
commit | c1242b7cc805eb0ad73b9372544a3f689902ed6d (patch) | |
tree | 04728fb4f291ec18623ffe6d380102759d99f247 /netfs/daemon | |
parent | Add more assertions around times (diff) | |
download | netfs-c1242b7cc805eb0ad73b9372544a3f689902ed6d.tar.bz2 netfs-c1242b7cc805eb0ad73b9372544a3f689902ed6d.tar.xz netfs-c1242b7cc805eb0ad73b9372544a3f689902ed6d.zip |
Tidy up the mess that was type conversion
Diffstat (limited to 'netfs/daemon')
-rw-r--r-- | netfs/daemon/daemonFile.cpp | 11 | ||||
-rw-r--r-- | netfs/daemon/daemonFile.h | 7 | ||||
-rw-r--r-- | netfs/daemon/daemonVolume.cpp | 12 | ||||
-rw-r--r-- | netfs/daemon/daemonVolume.h | 2 |
4 files changed, 12 insertions, 20 deletions
diff --git a/netfs/daemon/daemonFile.cpp b/netfs/daemon/daemonFile.cpp index 48aa025..94aebe6 100644 --- a/netfs/daemon/daemonFile.cpp +++ b/netfs/daemon/daemonFile.cpp @@ -2,15 +2,14 @@ #include <errno.h> #include <map> #include <fcntl.h> -#include <typeConvert.h> +#include <typeConverter.h> #include <sys/stat.h> #include "daemonFile.h" #include <entCache.h> FileServer::FileServer(int f, const EntryResolver<uid_t> & u, const EntryResolver<gid_t> & g) : - fd(f), - userLookup(u), - groupLookup(g) + TypeConverter(u, g), + fd(f) { } @@ -36,9 +35,7 @@ FileServer::fgetattr(const NetFS::ReqEnv & re, const Ice::Current &) if (::fstat(fd, &s) != 0) { throw NetFS::SystemError(errno); } - NetFS::Attr a; - a << StatSource { s, userLookup, groupLookup }; - return a; + return convert(s); } void diff --git a/netfs/daemon/daemonFile.h b/netfs/daemon/daemonFile.h index 933d687..ca5b7ca 100644 --- a/netfs/daemon/daemonFile.h +++ b/netfs/daemon/daemonFile.h @@ -2,9 +2,9 @@ #define DAEMONFILE_H #include <file.h> -#include <typeConvert.h> +#include <typeConverter.h> -class FileServer : public NetFS::File { +class FileServer : public NetFS::File, TypeConverter { public: FileServer(int fd, const EntryResolver<uid_t> &, const EntryResolver<gid_t> &); virtual ~FileServer(); @@ -18,9 +18,6 @@ class FileServer : public NetFS::File { private: const int fd; - - const EntryResolver<uid_t> & userLookup; - const EntryResolver<gid_t> & groupLookup; }; #endif diff --git a/netfs/daemon/daemonVolume.cpp b/netfs/daemon/daemonVolume.cpp index 3ec6865..7603691 100644 --- a/netfs/daemon/daemonVolume.cpp +++ b/netfs/daemon/daemonVolume.cpp @@ -5,7 +5,6 @@ #include <sys/stat.h> #include <limits.h> #include <fcntl.h> -#include <typeConvert.h> #include "daemonVolume.h" #include "daemonFile.h" #include "daemonDirectory.h" @@ -21,7 +20,8 @@ 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)), userLookup(u), - groupLookup(g) + groupLookup(g), + converter(u, g) { } @@ -71,9 +71,7 @@ VolumeServer::getattr(const NetFS::ReqEnv & re, const std::string & path, const if (::lstat(p.c_str(), &s) != 0) { throw NetFS::SystemError(errno); } - NetFS::Attr a; - a << StatSource { s, userLookup, groupLookup }; - return a; + return converter.convert(s); } void @@ -202,9 +200,7 @@ VolumeServer::statfs(const NetFS::ReqEnv & re, const std::string & path, const I if (::statvfs(p.c_str(), &s) != 0) { throw NetFS::SystemError(errno); } - NetFS::VFS t; - t << s; - return t; + return converter.convert(s); } void diff --git a/netfs/daemon/daemonVolume.h b/netfs/daemon/daemonVolume.h index 14e06d3..b5e8b05 100644 --- a/netfs/daemon/daemonVolume.h +++ b/netfs/daemon/daemonVolume.h @@ -5,6 +5,7 @@ #include <boost/thread/shared_mutex.hpp> #include <boost/filesystem/path.hpp> #include <entCache.h> +#include <typeConverter.h> class VolumeServer : public NetFS::Volume { public: @@ -47,6 +48,7 @@ class VolumeServer : public NetFS::Volume { const EntCache<User> & userLookup; const EntCache<Group> & groupLookup; + TypeConverter converter; }; #endif |