summaryrefslogtreecommitdiff
path: root/netfs/fuse
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2020-08-31 19:52:11 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2020-09-05 17:30:07 +0100
commitfc6e9a3316b608b30b5a25b347774181f1730c59 (patch)
tree67c74913d0d199dc6c366de8c05bfa91e4d452bc /netfs/fuse
parentClang format all the code (diff)
downloadnetfs-fc6e9a3316b608b30b5a25b347774181f1730c59.tar.bz2
netfs-fc6e9a3316b608b30b5a25b347774181f1730c59.tar.xz
netfs-fc6e9a3316b608b30b5a25b347774181f1730c59.zip
First cut extensible mapper
Replaces the weird fallback half implementation with something that looks remotely fit for purpose.
Diffstat (limited to 'netfs/fuse')
-rw-r--r--netfs/fuse/Jamfile.jam4
-rw-r--r--netfs/fuse/fuseApp.cpp16
-rw-r--r--netfs/fuse/fuseApp.h2
-rw-r--r--netfs/fuse/fuseConfig.ice3
4 files changed, 15 insertions, 10 deletions
diff --git a/netfs/fuse/Jamfile.jam b/netfs/fuse/Jamfile.jam
index 14338d5..8516d8b 100644
--- a/netfs/fuse/Jamfile.jam
+++ b/netfs/fuse/Jamfile.jam
@@ -6,6 +6,8 @@ obj fuseConfig : fuseConfig.ice :
<toolset>tidy:<checker>none
<library>../ice//netfs-api
<implicit-dependency>../ice//netfs-api
+ <library>..//slicer
+ <include>.
;
lib netfs-client-configuration :
fuseConfig
@@ -19,9 +21,11 @@ lib netfs-client-configuration :
<library>..//Ice
<library>..//slicer
<library>..//adhocutil
+ <include>.
: :
<library>..//Ice
<library>..//slicer
+ <include>.
;
lib netfs-client :
diff --git a/netfs/fuse/fuseApp.cpp b/netfs/fuse/fuseApp.cpp
index 78a3a03..f0576b3 100644
--- a/netfs/fuse/fuseApp.cpp
+++ b/netfs/fuse/fuseApp.cpp
@@ -7,6 +7,7 @@
#include <boost/lexical_cast.hpp>
#include <compileTimeFormatter.h>
#include <cstring>
+#include <defaultMapper.h>
#include <entCache.h>
#include <safeMapFind.h>
#include <slicer/slicer.h>
@@ -17,10 +18,7 @@ namespace AdHoc {
template class CallCacheable<struct stat, std::string>;
}
-NetFS::FuseApp::FuseApp(Ice::StringSeq && a) :
- iceArgs(std::move(a)), sessionOpened(false), openHandleId(0), converter(userLookup, groupLookup)
-{
-}
+NetFS::FuseApp::FuseApp(Ice::StringSeq && a) : iceArgs(std::move(a)), sessionOpened(false), openHandleId(0) { }
NetFS::FuseApp::~FuseApp()
{
@@ -80,7 +78,11 @@ NetFS::FuseApp::init(struct fuse_conn_info *, struct fuse_config *)
fcr = configureFromFile(arg.substr(0, colon), arg.substr(colon + 1));
}
}
+ if (!fcr->mapper) {
+ fcr->mapper = std::make_shared<Mapping::DefaultMapper>();
+ }
BOOST_ASSERT(fcr);
+ converter.mapper = fcr->mapper;
return this;
}
@@ -275,8 +277,6 @@ NetFS::ReqEnv
NetFS::FuseApp::reqEnv()
{
struct fuse_context * c = fuse_get_context();
- NetFS::ReqEnv re;
- userLookup.getName(c->uid, &re.user);
- groupLookup.getName(c->gid, &re.grp);
- return re;
+ const auto t = converter.mapper->mapFileSystem(c->uid, c->gid);
+ return {t.username, t.groupname};
}
diff --git a/netfs/fuse/fuseApp.h b/netfs/fuse/fuseApp.h
index d373e94..b905b23 100644
--- a/netfs/fuse/fuseApp.h
+++ b/netfs/fuse/fuseApp.h
@@ -111,8 +111,6 @@ namespace NetFS {
OpenFiles openFiles;
int openHandleId;
- EntCache<User> userLookup;
- EntCache<Group> groupLookup;
EntryTypeConverter converter;
using StatCache = AdHoc::Cache<struct stat, std::string>;
diff --git a/netfs/fuse/fuseConfig.ice b/netfs/fuse/fuseConfig.ice
index 52116ea..2d2bf9f 100644
--- a/netfs/fuse/fuseConfig.ice
+++ b/netfs/fuse/fuseConfig.ice
@@ -1,4 +1,5 @@
#include <exceptions.ice>
+#include <mapper.ice>
module NetFS {
module Client {
@@ -20,6 +21,8 @@ module NetFS {
["slicer:name:async"]
bool Async = false;
+
+ Mapping::Mapper mapper;
};
["slicer:key:name","slicer:value:resource","slicer:item:resource"]