diff options
Diffstat (limited to 'netfs/daemon/daemonVolume.cpp')
-rw-r--r-- | netfs/daemon/daemonVolume.cpp | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/netfs/daemon/daemonVolume.cpp b/netfs/daemon/daemonVolume.cpp index 0779043..c87b1b0 100644 --- a/netfs/daemon/daemonVolume.cpp +++ b/netfs/daemon/daemonVolume.cpp @@ -12,13 +12,12 @@ #include "lockHelpers.h" #include "ioHelpers.h" #include <boost/filesystem/operations.hpp> +#include <entCache.h> extern std::map<Ice::Int, int> files; -VolumeServer::VolumeServer(const boost::filesystem::path & r, UserEntCache * u, GroupEntCache * g) : - root(r), - uentries(u), - gentries(g) +VolumeServer::VolumeServer(const boost::filesystem::path & r) : + root(r) { } @@ -35,7 +34,7 @@ VolumeServer::disconnect(const Ice::Current & ice) Ice::Int VolumeServer::access(const NetFS::ReqEnv & re, const std::string & path, Ice::Int mode, const Ice::Current &) { - TempPrivs tp(re, uentries, gentries, root); + TempPrivs tp(re, root); struct stat s; boost::filesystem::path p(resolvePath(path)); if (::stat(p.string().c_str(), &s) != 0) { @@ -61,7 +60,7 @@ VolumeServer::access(const NetFS::ReqEnv & re, const std::string & path, Ice::In NetFS::Attr VolumeServer::getattr(const NetFS::ReqEnv & re, const std::string & path, const Ice::Current &) { - TempPrivs tp(re, uentries, gentries, root); + TempPrivs tp(re, root); struct stat s; boost::filesystem::path p(resolvePath(path)); tp.AssertRead(p.parent_path()); @@ -69,14 +68,14 @@ VolumeServer::getattr(const NetFS::ReqEnv & re, const std::string & path, const throw NetFS::SystemError(errno); } NetFS::Attr a; - a << StatSource { s, boost::bind(&UserEntCache::getName, uentries, _1), boost::bind(&GroupEntCache::getName, gentries, _1) }; + a << StatSource { s, boost::bind(&UserEntCache::getName, &UserEntCache::instance, _1), boost::bind(&GroupEntCache::getName, &GroupEntCache::instance, _1) }; return a; } void VolumeServer::symlink(const NetFS::ReqEnv & re, const std::string & path1, const std::string & path2, const Ice::Current &) { - TempPrivs tp(re, uentries, gentries, root); + TempPrivs tp(re, root); errno = 0; boost::filesystem::path p(resolvePath(path2)); tp.AssertWrite(p.parent_path()); @@ -92,7 +91,7 @@ VolumeServer::symlink(const NetFS::ReqEnv & re, const std::string & path1, const void VolumeServer::link(const NetFS::ReqEnv & re, const std::string & path1, const std::string & path2, const Ice::Current &) { - TempPrivs tp(re, uentries, gentries, root); + TempPrivs tp(re, root); errno = 0; boost::filesystem::path p1(resolvePath(path1)); boost::filesystem::path p2(resolvePath(path2)); @@ -108,7 +107,7 @@ VolumeServer::link(const NetFS::ReqEnv & re, const std::string & path1, const st void VolumeServer::rename(const NetFS::ReqEnv & re, const std::string & from, const std::string & to, const Ice::Current &) { - TempPrivs tp(re, uentries, gentries, root); + TempPrivs tp(re, root); errno = 0; boost::filesystem::path f(resolvePath(from)); boost::filesystem::path t(resolvePath(to)); @@ -128,7 +127,7 @@ VolumeServer::rename(const NetFS::ReqEnv & re, const std::string & from, const s std::string VolumeServer::readlink(const NetFS::ReqEnv & re, const std::string & path, const Ice::Current &) { - TempPrivs tp(re, uentries, gentries, root); + TempPrivs tp(re, root); errno = 0; char buf[PATH_MAX]; boost::filesystem::path p(resolvePath(path)); @@ -143,7 +142,7 @@ VolumeServer::readlink(const NetFS::ReqEnv & re, const std::string & path, const void VolumeServer::chmod(const NetFS::ReqEnv & re, const std::string & path, Ice::Int mode, const Ice::Current &) { - TempPrivs tp(re, uentries, gentries, root); + TempPrivs tp(re, root); errno = 0; boost::filesystem::path p(resolvePath(path)); tp.AssertWrite(p); @@ -155,7 +154,7 @@ VolumeServer::chmod(const NetFS::ReqEnv & re, const std::string & path, Ice::Int void VolumeServer::chown(const NetFS::ReqEnv & re, const std::string & path, Ice::Int uid, Ice::Int gid, const Ice::Current &) { - TempPrivs tp(re, uentries, gentries, root); + TempPrivs tp(re, root); errno = 0; boost::filesystem::path p(resolvePath(path)); tp.AssertWrite(p); @@ -168,7 +167,7 @@ void VolumeServer::utimens(const NetFS::ReqEnv & re, const std::string & path, Ice::Long s0, Ice::Long ns0, Ice::Long s1, Ice::Long ns1, const Ice::Current&) { - TempPrivs tp(re, uentries, gentries, root); + TempPrivs tp(re, root); errno = 0; struct timespec times[2]; times[0].tv_sec = s0; @@ -185,7 +184,7 @@ VolumeServer::utimens(const NetFS::ReqEnv & re, const std::string & path, NetFS::VFS VolumeServer::statfs(const NetFS::ReqEnv & re, const std::string & path, const Ice::Current&) { - TempPrivs tp(re, uentries, gentries, root); + TempPrivs tp(re, root); errno = 0; struct statvfs s; boost::filesystem::path p(resolvePath(path)); @@ -201,7 +200,7 @@ VolumeServer::statfs(const NetFS::ReqEnv & re, const std::string & path, const I void VolumeServer::truncate(const NetFS::ReqEnv & re, const std::string & path, Ice::Long size, const Ice::Current&) { - TempPrivs tp(re, uentries, gentries, root); + TempPrivs tp(re, root); errno = 0; boost::filesystem::path p(resolvePath(path)); tp.AssertWrite(p); @@ -213,7 +212,7 @@ VolumeServer::truncate(const NetFS::ReqEnv & re, const std::string & path, Ice:: void VolumeServer::unlink(const NetFS::ReqEnv & re, const std::string & path, const Ice::Current&) { - TempPrivs tp(re, uentries, gentries, root); + TempPrivs tp(re, root); errno = 0; boost::filesystem::path p(resolvePath(path)); tp.AssertWrite(p); @@ -232,7 +231,7 @@ VolumeServer::openReadOnly(const NetFS::ReqEnv & re, const std::string & path, I NetFS::FilePrx VolumeServer::open(const NetFS::ReqEnv & re, const std::string & path, Ice::Int flags, const Ice::Current & ice) { - TempPrivs tp(re, uentries, gentries, root); + TempPrivs tp(re, root); errno = 0; boost::filesystem::path p(resolvePath(path)); tp.AssertRead(p); @@ -240,13 +239,13 @@ VolumeServer::open(const NetFS::ReqEnv & re, const std::string & path, Ice::Int if (fd == -1) { throw NetFS::SystemError(errno); } - return NetFS::FilePrx::checkedCast(ice.adapter->addWithUUID(new FileServer(fd, uentries, gentries))); + return NetFS::FilePrx::checkedCast(ice.adapter->addWithUUID(new FileServer(fd))); } NetFS::FilePrx VolumeServer::create(const NetFS::ReqEnv & re, const std::string & path, Ice::Int flags, Ice::Int mode, const Ice::Current & ice) { - TempPrivs tp(re, uentries, gentries, root); + TempPrivs tp(re, root); errno = 0; boost::filesystem::path p(resolvePath(path)); tp.AssertWrite(p.parent_path()); @@ -259,13 +258,13 @@ VolumeServer::create(const NetFS::ReqEnv & re, const std::string & path, Ice::In ::unlink(p.string().c_str()); throw NetFS::SystemError(errno); } - return NetFS::FilePrx::checkedCast(ice.adapter->addWithUUID(new FileServer(fd, uentries, gentries))); + return NetFS::FilePrx::checkedCast(ice.adapter->addWithUUID(new FileServer(fd))); } NetFS::DirectoryPrx VolumeServer::opendir(const NetFS::ReqEnv & re, const std::string & path, const Ice::Current & ice) { - TempPrivs tp(re, uentries, gentries, root); + TempPrivs tp(re, root); errno = 0; boost::filesystem::path p(resolvePath(path)); tp.AssertRead(p); @@ -279,7 +278,7 @@ VolumeServer::opendir(const NetFS::ReqEnv & re, const std::string & path, const void VolumeServer::mkdir(const NetFS::ReqEnv & re, const std::string & path, Ice::Int mode, const Ice::Current&) { - TempPrivs tp(re, uentries, gentries, root); + TempPrivs tp(re, root); errno = 0; boost::filesystem::path p(resolvePath(path)); tp.AssertWrite(p.parent_path()); @@ -295,7 +294,7 @@ VolumeServer::mkdir(const NetFS::ReqEnv & re, const std::string & path, Ice::Int void VolumeServer::rmdir(const NetFS::ReqEnv & re, const std::string & path, const Ice::Current&) { - TempPrivs tp(re, uentries, gentries, root); + TempPrivs tp(re, root); errno = 0; boost::filesystem::path p(resolvePath(path)); tp.AssertWrite(p); |