summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-11-21 21:44:31 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2019-11-21 21:44:31 +0000
commit87744dfe4bcfb7b496410360e516f6fb1c6ee5ea (patch)
treee73c3a2ea96ecf7cdc04f9d17ae77ae206dd7a37
parentIce initialize must occur after any forking (diff)
downloadnetfs-87744dfe4bcfb7b496410360e516f6fb1c6ee5ea.tar.bz2
netfs-87744dfe4bcfb7b496410360e516f6fb1c6ee5ea.tar.xz
netfs-87744dfe4bcfb7b496410360e516f6fb1c6ee5ea.zip
Shuffle some code back to where it came from
-rw-r--r--netfs/fuse/fuseApp.cpp21
-rw-r--r--netfs/fuse/fuseApp.h6
-rw-r--r--netfs/fuse/fuseAppBase.h4
-rw-r--r--netfs/fuse/netfs.cpp20
4 files changed, 27 insertions, 24 deletions
diff --git a/netfs/fuse/fuseApp.cpp b/netfs/fuse/fuseApp.cpp
index 1db9690..1609280 100644
--- a/netfs/fuse/fuseApp.cpp
+++ b/netfs/fuse/fuseApp.cpp
@@ -107,6 +107,27 @@ NetFS::FuseApp::configureFromUri(const std::string & uriString) const
return r;
}
+int
+NetFS::FuseApp::opt_parse(void * data, const char * arg, int, struct fuse_args *)
+{
+ auto & iceArgs = *static_cast<Ice::StringSeq *>(data);
+ if (strncmp(arg, "--Ice.", 6) == 0) {
+ iceArgs.push_back(arg);
+ return 0;
+ }
+ else if (strncmp(arg, "_netdev", 7) == 0) {
+ return 0;
+ }
+ else if (arg[0] == '-') {
+ return 1;
+ }
+ else if (iceArgs.empty() || strncmp(iceArgs.front().c_str(), "--Ice.", 6) == 0) {
+ iceArgs.insert(iceArgs.begin(), arg);
+ return 0;
+ }
+ return 1;
+}
+
void
NetFS::FuseApp::connectSession()
{
diff --git a/netfs/fuse/fuseApp.h b/netfs/fuse/fuseApp.h
index d44960c..59fde20 100644
--- a/netfs/fuse/fuseApp.h
+++ b/netfs/fuse/fuseApp.h
@@ -52,6 +52,10 @@ namespace NetFS {
FuseApp(Ice::StringSeq &&);
~FuseApp();
+ // lifecycle
+ void * init (struct fuse_conn_info * info) override;
+ static int opt_parse(void * data, const char * arg, int, struct fuse_args *);
+
protected:
void connectSession();
virtual void connectToService();
@@ -60,8 +64,6 @@ namespace NetFS {
void verifyConnection();
public:
- // lifecycle
- void * init (struct fuse_conn_info * info) override;
// misc
int access(const char * p, int a) override;
int getattr(const char * p, struct stat * s) override;
diff --git a/netfs/fuse/fuseAppBase.h b/netfs/fuse/fuseAppBase.h
index 5de3a41..44943b7 100644
--- a/netfs/fuse/fuseAppBase.h
+++ b/netfs/fuse/fuseAppBase.h
@@ -142,7 +142,7 @@ class FuseAppBaseT : public FuseAppBase {
private:
template <typename BFunc, typename IFunc, BFunc bfunc, typename Rtn, typename ... Args>
- constexpr static Rtn(*getInternalHelper(Rtn(FuseAppBase::*)(Args...)))(Args...)
+ constexpr static auto getInternalHelper(Rtn(FuseAppBase::*)(Args...)) -> Rtn(*)(Args...)
{
if constexpr (!std::is_same<BFunc, IFunc>::value) {
return [](Args ... a) {
@@ -152,7 +152,7 @@ class FuseAppBaseT : public FuseAppBase {
return nullptr;
}
template <typename BFunc, typename IFunc, BFunc bfunc, typename ... Args>
- constexpr static int(*getHelper(int(FuseAppBase::*)(Args...)))(Args...)
+ constexpr static auto getHelper(int(FuseAppBase::*)(Args...)) -> int(*)(Args...)
{
if constexpr (!std::is_same<BFunc, IFunc>::value) {
return [](Args ... a) {
diff --git a/netfs/fuse/netfs.cpp b/netfs/fuse/netfs.cpp
index 14c3c93..78a566b 100644
--- a/netfs/fuse/netfs.cpp
+++ b/netfs/fuse/netfs.cpp
@@ -3,26 +3,6 @@
class FuseImpl : public fuse_args, public NetFS::FuseApp {
public:
- static int opt_parse(void * data, const char * arg, int, struct fuse_args *)
- {
- auto iceArgs = static_cast<Ice::StringSeq *>(data);
- if (strncmp(arg, "--Ice.", 6) == 0) {
- iceArgs->push_back(arg);
- return 0;
- }
- else if (strncmp(arg, "_netdev", 7) == 0) {
- return 0;
- }
- else if (arg[0] == '-') {
- return 1;
- }
- else if (iceArgs->empty() || strncmp(iceArgs->front().c_str(), "--Ice.", 6) == 0) {
- iceArgs->insert(iceArgs->begin(), arg);
- return 0;
- }
- return 1;
- }
-
FuseImpl(int c, char ** v) :
fuse_args(FUSE_ARGS_INIT(c, v)),
NetFS::FuseApp([this](){