diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-07-26 16:08:36 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-07-26 16:08:36 +0100 |
commit | 288c59d4a2d90c092bc66c4b873c28c25c52d527 (patch) | |
tree | aba0736352705ccc988933be6a5440568df2fd66 /netfs/fuse | |
parent | Fix unittest Jamfile (diff) | |
download | netfs-288c59d4a2d90c092bc66c4b873c28c25c52d527.tar.bz2 netfs-288c59d4a2d90c092bc66c4b873c28c25c52d527.tar.xz netfs-288c59d4a2d90c092bc66c4b873c28c25c52d527.zip |
No more static entcache hack
Diffstat (limited to 'netfs/fuse')
-rw-r--r-- | netfs/fuse/fuseApp.cpp | 4 | ||||
-rw-r--r-- | netfs/fuse/fuseApp.h | 4 | ||||
-rw-r--r-- | netfs/fuse/fuseDirs.cpp | 2 | ||||
-rw-r--r-- | netfs/fuse/fuseFiles.cpp | 2 | ||||
-rw-r--r-- | netfs/fuse/fuseMisc.cpp | 2 |
5 files changed, 9 insertions, 5 deletions
diff --git a/netfs/fuse/fuseApp.cpp b/netfs/fuse/fuseApp.cpp index a752e47..133860a 100644 --- a/netfs/fuse/fuseApp.cpp +++ b/netfs/fuse/fuseApp.cpp @@ -202,8 +202,8 @@ NetFS::FuseApp::reqEnv() connectToVolume(); struct fuse_context * c = fuse_get_context(); NetFS::ReqEnv re; - UserEntCache::instance.getName(c->uid, &re.user); - GroupEntCache::instance.getName(c->gid, &re.grp); + userLookup.getName(c->uid, &re.user); + groupLookup.getName(c->gid, &re.grp); return re; } diff --git a/netfs/fuse/fuseApp.h b/netfs/fuse/fuseApp.h index 3ab1cb0..60ecee9 100644 --- a/netfs/fuse/fuseApp.h +++ b/netfs/fuse/fuseApp.h @@ -5,6 +5,7 @@ #include <Ice/Ice.h> #include <Glacier2/Session.h> #include <service.h> +#include <entCache.h> #include "fuseAppBase.h" #include "fuseConfig.h" #include "cache.h" @@ -115,6 +116,9 @@ namespace NetFS { OpenFiles openFiles; int openFileID; + EntCache<User> userLookup; + EntCache<Group> groupLookup; + typedef Cache<struct stat, std::string, IceUtil::Shared, IceUtil::Handle<Cacheable<struct stat, std::string, IceUtil::Shared>>> StatCache; StatCache statCache; }; diff --git a/netfs/fuse/fuseDirs.cpp b/netfs/fuse/fuseDirs.cpp index 1da9484..fa9f13b 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, _2), boost::bind(&GroupEntCache::getID, &GroupEntCache::instance, _1, _2) }; + s << AttrSource { volume->end_getattr(asga), userLookup, groupLookup }; return s; }, epath, time_t(NULL) + 2)); } diff --git a/netfs/fuse/fuseFiles.cpp b/netfs/fuse/fuseFiles.cpp index c6d4283..6206749 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, _2), boost::bind(&GroupEntCache::getID, &GroupEntCache::instance, _1, _2) }; + *s << AttrSource { remote->fgetattr(reqEnv()), userLookup, groupLookup }; return 0; } catch (NetFS::SystemError & e) { diff --git a/netfs/fuse/fuseMisc.cpp b/netfs/fuse/fuseMisc.cpp index 1f999bd..12a550f 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, _2), boost::bind(&GroupEntCache::getID, &GroupEntCache::instance, _1, _2) }; + *s << AttrSource { volume->getattr(reqEnv(), p), userLookup, groupLookup }; } return 0; } |