summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-12-16 18:06:26 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2017-12-16 19:48:37 +0000
commit221c0b38ee81e4f9e8575668cf079118568e52c8 (patch)
treea8e9c3946bf4bf500d007b358e8fc3e5c205d68b
parentProvide an internal helper for calling member functions via libfuse (diff)
downloadnetfs-1.2.1.tar.bz2
netfs-1.2.1.tar.xz
netfs-1.2.1.zip
Fix order of execution with gcc-7.2netfs-1.2.1
proxy->operation(function()) where function() is responsible for initializing proxy fails under gcc-7.2 because proxy is resolved before function is called. This change moves connectSession, ...ToService and ...ToVolume into a single beforeOperation function called from the fuse helper wrapper.
-rw-r--r--netfs/fuse/fuseApp.cpp9
-rw-r--r--netfs/fuse/fuseApp.h1
-rw-r--r--netfs/fuse/fuseAppBase.cpp4
-rw-r--r--netfs/fuse/fuseAppBase.h2
4 files changed, 14 insertions, 2 deletions
diff --git a/netfs/fuse/fuseApp.cpp b/netfs/fuse/fuseApp.cpp
index d4d7866..a998f94 100644
--- a/netfs/fuse/fuseApp.cpp
+++ b/netfs/fuse/fuseApp.cpp
@@ -262,12 +262,17 @@ NetFS::FuseApp::onError(const std::exception & e) throw()
return FuseAppBase::onError(e);
}
-NetFS::ReqEnv
-NetFS::FuseApp::reqEnv()
+void
+NetFS::FuseApp::beforeOperation()
{
connectSession();
connectToService();
connectToVolume();
+}
+
+NetFS::ReqEnv
+NetFS::FuseApp::reqEnv()
+{
struct fuse_context * c = fuse_get_context();
NetFS::ReqEnv re;
userLookup.getName(c->uid, &re.user);
diff --git a/netfs/fuse/fuseApp.h b/netfs/fuse/fuseApp.h
index 27acd3b..0d2dd1d 100644
--- a/netfs/fuse/fuseApp.h
+++ b/netfs/fuse/fuseApp.h
@@ -85,6 +85,7 @@ namespace NetFS {
int statfs(const char *, struct statvfs *) override;
// stuff
int onError(const std::exception & err) throw() override;
+ void beforeOperation() override;
virtual struct fuse_context * fuse_get_context() = 0;
diff --git a/netfs/fuse/fuseAppBase.cpp b/netfs/fuse/fuseAppBase.cpp
index f0d6b52..3eadd8f 100644
--- a/netfs/fuse/fuseAppBase.cpp
+++ b/netfs/fuse/fuseAppBase.cpp
@@ -206,6 +206,10 @@ int FuseAppBase::onError(const std::exception & e) throw()
return -ENOSYS;
}
+void FuseAppBase::beforeOperation()
+{
+}
+
void * FuseAppBase::fuseInit (struct fuse_conn_info *conn)
{
return fuseApp->init(conn);
diff --git a/netfs/fuse/fuseAppBase.h b/netfs/fuse/fuseAppBase.h
index daa8cb1..d899e00 100644
--- a/netfs/fuse/fuseAppBase.h
+++ b/netfs/fuse/fuseAppBase.h
@@ -58,6 +58,7 @@ class DLL_PUBLIC FuseAppBase {
virtual int flock(const char *, struct fuse_file_info *, int op);
virtual int fallocate(const char *, int, off_t, off_t, struct fuse_file_info *);
virtual int onError(const std::exception & err) throw();
+ virtual void beforeOperation();
void log(int level, const char * message) const throw();
void logf(int level, const char * fmt, ...) const throw() __attribute__ ((__format__ (__printf__, 3, 4)));
virtual void vlogf(int level, const char * fmt, va_list) const throw() __attribute__ ((__format__ (__printf__, 3, 0))) = 0;
@@ -151,6 +152,7 @@ class DLL_PUBLIC FuseAppBase {
{
for (int t = 0; ; ++t) {
try {
+ fuseApp->beforeOperation();
return (fuseApp->*f)(a...);
}
catch (const std::exception & ex) {