diff options
| -rw-r--r-- | netfs/daemon/daemon.cpp | 4 | ||||
| -rw-r--r-- | netfs/daemon/daemonFile.cpp | 2 | ||||
| -rw-r--r-- | netfs/daemon/daemonVolume.cpp | 2 | ||||
| -rw-r--r-- | netfs/fuse/fuseApp.cpp | 5 | ||||
| -rw-r--r-- | netfs/fuse/fuseDirs.cpp | 2 | ||||
| -rw-r--r-- | netfs/fuse/fuseFiles.cpp | 2 | ||||
| -rw-r--r-- | netfs/fuse/fuseMisc.cpp | 2 | ||||
| -rw-r--r-- | netfs/ice/typeConvert.cpp | 8 | ||||
| -rw-r--r-- | netfs/ice/typeConvert.h | 8 | ||||
| -rw-r--r-- | netfs/lib/entCache.cpp | 16 | ||||
| -rw-r--r-- | netfs/lib/entCache.h | 4 | 
11 files changed, 30 insertions, 25 deletions
diff --git a/netfs/daemon/daemon.cpp b/netfs/daemon/daemon.cpp index b5a2ddd..3ad6294 100644 --- a/netfs/daemon/daemon.cpp +++ b/netfs/daemon/daemon.cpp @@ -76,8 +76,8 @@ extern "C" {  }  TempPrivs::TempPrivs(const NetFS::ReqEnv & re, const boost::filesystem::path & r) : -	myu(UserEntCache::instance.getID(re.user)), -	myg(GroupEntCache::instance.getID(re.grp)), +	myu(UserEntCache::instance.getEntry(re.user)->id), +	myg(GroupEntCache::instance.getEntry(re.grp)->id),  	root(r)  {  } diff --git a/netfs/daemon/daemonFile.cpp b/netfs/daemon/daemonFile.cpp index 3268be8..3acd1ca 100644 --- a/netfs/daemon/daemonFile.cpp +++ b/netfs/daemon/daemonFile.cpp @@ -36,7 +36,7 @@ FileServer::fgetattr(const NetFS::ReqEnv & re, const Ice::Current &)  		throw NetFS::SystemError(errno);  	}  	NetFS::Attr a; -	a << StatSource { s, boost::bind(&UserEntCache::getName, &UserEntCache::instance, _1), boost::bind(&GroupEntCache::getName, &GroupEntCache::instance, _1) }; +	a << StatSource { s, boost::bind(&UserEntCache::getName, &UserEntCache::instance, _1, _2), boost::bind(&GroupEntCache::getName, &GroupEntCache::instance, _1, _2) };  	return a;  } diff --git a/netfs/daemon/daemonVolume.cpp b/netfs/daemon/daemonVolume.cpp index 0cad47e..0556d9a 100644 --- a/netfs/daemon/daemonVolume.cpp +++ b/netfs/daemon/daemonVolume.cpp @@ -70,7 +70,7 @@ 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, &UserEntCache::instance, _1), boost::bind(&GroupEntCache::getName, &GroupEntCache::instance, _1) }; +	a << StatSource { s, boost::bind(&UserEntCache::getName, &UserEntCache::instance, _1, _2), boost::bind(&GroupEntCache::getName, &GroupEntCache::instance, _1, _2) };  	return a;  } diff --git a/netfs/fuse/fuseApp.cpp b/netfs/fuse/fuseApp.cpp index c90cc15..fdcce57 100644 --- a/netfs/fuse/fuseApp.cpp +++ b/netfs/fuse/fuseApp.cpp @@ -171,6 +171,9 @@ NetFS::FuseApp::reqEnv()  	connectToService();  	connectToVolume();  	struct fuse_context * c = fuse_get_context(); -	return { UserEntCache::instance.getName(c->uid), GroupEntCache::instance.getName(c->gid) }; +	NetFS::ReqEnv re; +	UserEntCache::instance.getName(c->uid, &re.user); +	GroupEntCache::instance.getName(c->gid, &re.grp); +	return re;  } diff --git a/netfs/fuse/fuseDirs.cpp b/netfs/fuse/fuseDirs.cpp index 156dae6..1da9484 100644 --- a/netfs/fuse/fuseDirs.cpp +++ b/netfs/fuse/fuseDirs.cpp @@ -79,7 +79,7 @@ NetFS::FuseApp::readdir(const char * p, void * buf, fuse_fill_dir_t filler, off_  			statCache.Add(new OptimisticCallCacheable<struct stat, std::string, IceUtil::Shared>(  						[asga,this]() {  							struct stat s; -							s << AttrSource { volume->end_getattr(asga), boost::bind(&UserEntCache::getID, &UserEntCache::instance, _1), boost::bind(&GroupEntCache::getID, &GroupEntCache::instance, _1) }; +							s << AttrSource { volume->end_getattr(asga), boost::bind(&UserEntCache::getID, &UserEntCache::instance, _1, _2), boost::bind(&GroupEntCache::getID, &GroupEntCache::instance, _1, _2) };  							return s;  						}, epath, time_t(NULL) + 2));  		} diff --git a/netfs/fuse/fuseFiles.cpp b/netfs/fuse/fuseFiles.cpp index b8399f0..c6d4283 100644 --- a/netfs/fuse/fuseFiles.cpp +++ b/netfs/fuse/fuseFiles.cpp @@ -135,7 +135,7 @@ NetFS::FuseApp::fgetattr(const char *, struct stat * s, fuse_file_info * fi)  {  	try {  		auto remote = getFileProxy(fi->fh)->remote; -		*s << AttrSource { remote->fgetattr(reqEnv()), boost::bind(&UserEntCache::getID, &UserEntCache::instance, _1), boost::bind(&GroupEntCache::getID, &GroupEntCache::instance, _1) }; +		*s << AttrSource { remote->fgetattr(reqEnv()), boost::bind(&UserEntCache::getID, &UserEntCache::instance, _1, _2), boost::bind(&GroupEntCache::getID, &GroupEntCache::instance, _1, _2) };  		return 0;  	}  	catch (NetFS::SystemError & e) { diff --git a/netfs/fuse/fuseMisc.cpp b/netfs/fuse/fuseMisc.cpp index 670c9ae..1f999bd 100644 --- a/netfs/fuse/fuseMisc.cpp +++ b/netfs/fuse/fuseMisc.cpp @@ -19,7 +19,7 @@ NetFS::FuseApp::getattr(const char * p, struct stat * s)  			*s = *cacehedStat;  		}  		else { -			*s << AttrSource { volume->getattr(reqEnv(), p), boost::bind(&UserEntCache::getID, &UserEntCache::instance, _1), boost::bind(&GroupEntCache::getID, &GroupEntCache::instance, _1) }; +			*s << AttrSource { volume->getattr(reqEnv(), p), boost::bind(&UserEntCache::getID, &UserEntCache::instance, _1, _2), boost::bind(&GroupEntCache::getID, &GroupEntCache::instance, _1, _2) };  		}  		return 0;  	} diff --git a/netfs/ice/typeConvert.cpp b/netfs/ice/typeConvert.cpp index 538b894..cc3ee93 100644 --- a/netfs/ice/typeConvert.cpp +++ b/netfs/ice/typeConvert.cpp @@ -7,8 +7,8 @@ operator<<(struct stat & s, const AttrSource & a)  	s.st_ino = a.attr.inode;  	s.st_mode = a.attr.mode;  	s.st_nlink = a.attr.links; -	s.st_uid = a.user(a.attr.uid); -	s.st_gid = a.group(a.attr.gid); +	a.user(a.attr.uid, &s.st_uid); +	a.group(a.attr.gid, &s.st_gid);  	s.st_rdev = a.attr.rdev;  	s.st_size = a.attr.size;  	s.st_blksize = a.attr.blockSize; @@ -41,8 +41,8 @@ operator<<(NetFS::Attr & a, const struct StatSource & s)  	a.inode = s.stat.st_ino;  	a.mode = s.stat.st_mode;  	a.links = s.stat.st_nlink; -	a.uid = s.user(s.stat.st_uid); -	a.gid = s.group(s.stat.st_gid); +	s.user(s.stat.st_uid, &a.uid); +	s.group(s.stat.st_gid, &a.gid);  	a.rdev = s.stat.st_rdev;  	a.size = s.stat.st_size;  	a.blockSize = s.stat.st_blksize; diff --git a/netfs/ice/typeConvert.h b/netfs/ice/typeConvert.h index dd56a3f..13e2b44 100644 --- a/netfs/ice/typeConvert.h +++ b/netfs/ice/typeConvert.h @@ -3,11 +3,11 @@  #include <sys/statvfs.h>  #include <boost/function.hpp> -typedef boost::function<uid_t(const std::string &)> UserIdLookup; -typedef boost::function<gid_t(const std::string &)> GroupIdLookup; +typedef boost::function<void(const std::string &, uid_t *)> UserIdLookup; +typedef boost::function<void(const std::string &, gid_t *)> GroupIdLookup; -typedef boost::function<std::string(uid_t)> UserNameLookup; -typedef boost::function<std::string(gid_t)> GroupNameLookup; +typedef boost::function<void(uid_t, std::string *)> UserNameLookup; +typedef boost::function<void(gid_t, std::string *)> GroupNameLookup;  struct AttrSource {  	const NetFS::Attr & attr; diff --git a/netfs/lib/entCache.cpp b/netfs/lib/entCache.cpp index b07dda7..286c017 100644 --- a/netfs/lib/entCache.cpp +++ b/netfs/lib/entCache.cpp @@ -17,17 +17,19 @@ EntCache<entry_t>::~EntCache()  }  template<class entry_t> -const typename EntCache<entry_t>::id_t & -EntCache<entry_t>::getID(const EntCache<entry_t>::name_t & u) const +void +EntCache<entry_t>::getID(const EntCache<entry_t>::name_t & u, EntCache<entry_t>::id_t * target) const  { -	return getEntry(u)->id; +	auto e = getEntry(u); +	*target = e->id;  }  template<class entry_t> -const typename EntCache<entry_t>::name_t & -EntCache<entry_t>::getName(const EntCache<entry_t>::id_t & u) const +void +EntCache<entry_t>::getName(const EntCache<entry_t>::id_t & u, EntCache<entry_t>::name_t * target) const  { -	return getEntry(u)->name; +	auto e = getEntry(u); +	*target = e->name;  }  template<class entry_t> @@ -107,7 +109,7 @@ EntCache<Group>::fillCache() const  		auto g = new Group(grp->gr_gid, grp->gr_name);  		for (auto member = grp->gr_mem; *member; member++) {  			try { -				g->members.insert(EntCache<User>::instance.getID(*member)); +				g->members.insert(EntCache<User>::instance.getEntry((const name_t &)*member)->id);  			}  			catch (const NetFS::SystemError &) {  			} diff --git a/netfs/lib/entCache.h b/netfs/lib/entCache.h index ea941e8..443474f 100644 --- a/netfs/lib/entCache.h +++ b/netfs/lib/entCache.h @@ -38,8 +38,8 @@ class EntCache {  		virtual ~EntCache(); -		const id_t & getID(const name_t & ) const; -		const name_t & getName(const id_t &) const; +		void getID(const name_t &, id_t *) const; +		void getName(const id_t &, name_t *) const;  		template<class key_t>  		entry_ptr getEntry(const key_t &) const;  | 
