diff options
-rw-r--r-- | netfs/fuse/fuseApp.cpp | 9 | ||||
-rw-r--r-- | netfs/fuse/fuseApp.h | 1 | ||||
-rw-r--r-- | netfs/fuse/fuseAppBase.cpp | 4 | ||||
-rw-r--r-- | netfs/fuse/fuseAppBase.h | 2 |
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) { |