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/fuse | |
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/fuse')
-rw-r--r-- | netfs/fuse/fuseApp.cpp | 3 | ||||
-rw-r--r-- | netfs/fuse/fuseApp.h | 2 | ||||
-rw-r--r-- | netfs/fuse/fuseDirs.cpp | 5 | ||||
-rw-r--r-- | netfs/fuse/fuseFiles.cpp | 3 | ||||
-rw-r--r-- | netfs/fuse/fuseMisc.cpp | 3 | ||||
-rw-r--r-- | netfs/fuse/fuseSystem.cpp | 3 |
6 files changed, 8 insertions, 11 deletions
diff --git a/netfs/fuse/fuseApp.cpp b/netfs/fuse/fuseApp.cpp index 9b2ba1c..de75c6f 100644 --- a/netfs/fuse/fuseApp.cpp +++ b/netfs/fuse/fuseApp.cpp @@ -16,7 +16,8 @@ NetFS::FuseApp::FuseApp(const Ice::StringSeq & a) : args(a), sessionOpened(false), openDirID(0), - openFileID(0) + openFileID(0), + converter(userLookup, groupLookup) { } diff --git a/netfs/fuse/fuseApp.h b/netfs/fuse/fuseApp.h index a210089..ec75d03 100644 --- a/netfs/fuse/fuseApp.h +++ b/netfs/fuse/fuseApp.h @@ -8,6 +8,7 @@ #include <Glacier2/Session.h> #include <service.h> #include <entCache.h> +#include <typeConverter.h> #include "fuseAppBase.h" #include "fuseConfig.h" #include "cache.h" @@ -124,6 +125,7 @@ namespace NetFS { EntCache<User> userLookup; EntCache<Group> groupLookup; + TypeConverter converter; typedef AdHoc::Cache<struct stat, std::string> StatCache; StatCache statCache; diff --git a/netfs/fuse/fuseDirs.cpp b/netfs/fuse/fuseDirs.cpp index ab09ca1..00c0ca4 100644 --- a/netfs/fuse/fuseDirs.cpp +++ b/netfs/fuse/fuseDirs.cpp @@ -1,6 +1,5 @@ #include "fuseApp.h" #include <lockHelpers.h> -#include <typeConvert.h> #include <entCache.h> NetFS::FuseApp::OpenDir::OpenDir(DirectoryPrx r, const std::string & p) : @@ -76,9 +75,7 @@ NetFS::FuseApp::readdir(const char * p, void * buf, fuse_fill_dir_t filler, off_ auto asga = volume->begin_getattr(reqEnv(), epath); statCache.addFactory(epath, [asga,this]() { - struct stat s; - s << AttrSource { volume->end_getattr(asga), userLookup, groupLookup }; - return s; + return converter.convert(volume->end_getattr(asga)); }, time(NULL) + 2); } return 0; diff --git a/netfs/fuse/fuseFiles.cpp b/netfs/fuse/fuseFiles.cpp index d7b5a6b..fcc58a9 100644 --- a/netfs/fuse/fuseFiles.cpp +++ b/netfs/fuse/fuseFiles.cpp @@ -1,5 +1,4 @@ #include <string.h> -#include <typeConvert.h> #include "fuseApp.h" #include "lockHelpers.h" #include <entCache.h> @@ -134,7 +133,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()), userLookup, groupLookup }; + *s = converter.convert(remote->fgetattr(reqEnv())); return 0; } catch (NetFS::SystemError & e) { diff --git a/netfs/fuse/fuseMisc.cpp b/netfs/fuse/fuseMisc.cpp index 25aa51a..5ece9a1 100644 --- a/netfs/fuse/fuseMisc.cpp +++ b/netfs/fuse/fuseMisc.cpp @@ -1,6 +1,5 @@ #include "fuseApp.h" #include <string.h> -#include <typeConvert.h> #include <entCache.h> int @@ -18,7 +17,7 @@ NetFS::FuseApp::getattr(const char * p, struct stat * s) *s = *cacehedStat; } else { - *s << AttrSource { volume->getattr(reqEnv(), p), userLookup, groupLookup }; + *s = converter.convert(volume->getattr(reqEnv(), p)); } return 0; } diff --git a/netfs/fuse/fuseSystem.cpp b/netfs/fuse/fuseSystem.cpp index 2440fa8..85432e8 100644 --- a/netfs/fuse/fuseSystem.cpp +++ b/netfs/fuse/fuseSystem.cpp @@ -1,11 +1,10 @@ -#include <typeConvert.h> #include "fuseApp.h" int NetFS::FuseApp::statfs(const char * p, struct statvfs * vfs) { try { - *vfs << volume->statfs(reqEnv(), p); + *vfs = converter.convert(volume->statfs(reqEnv(), p)); return 0; } catch (NetFS::SystemError & e) { |