summaryrefslogtreecommitdiff
path: root/netfs/fuse
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-07-10 23:29:59 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-07-19 15:47:56 +0100
commit7fcbe6ac74f7a957d0be810401b93c30e7831bd8 (patch)
tree27b49005bb5c25eaab8493add800777296b15b2d /netfs/fuse
parentThe slicer feature should not be propergated, it's library specific whether i... (diff)
downloadnetfs-7fcbe6ac74f7a957d0be810401b93c30e7831bd8.tar.bz2
netfs-7fcbe6ac74f7a957d0be810401b93c30e7831bd8.tar.xz
netfs-7fcbe6ac74f7a957d0be810401b93c30e7831bd8.zip
Basic WIP support for Glacier2 routing
Diffstat (limited to 'netfs/fuse')
-rw-r--r--netfs/fuse/Jamfile.jam3
-rw-r--r--netfs/fuse/fuseApp.cpp27
-rw-r--r--netfs/fuse/fuseApp.h4
3 files changed, 34 insertions, 0 deletions
diff --git a/netfs/fuse/Jamfile.jam b/netfs/fuse/Jamfile.jam
index c5d3a7a..b0f04d6 100644
--- a/netfs/fuse/Jamfile.jam
+++ b/netfs/fuse/Jamfile.jam
@@ -1,4 +1,5 @@
lib fuse : : <name>fuse ;
+lib Glacier2 : : <name>Glacier2 ;
cpp-pch pch : pch.hpp :
<define>_FILE_OFFSET_BITS=64
@@ -43,6 +44,7 @@ lib netfsClient :
<library>..//boost_thread
<library>..//boost_system
<library>..//Ice
+ <library>Glacier2
<library>..//IceUtil
<library>..//pthread
<library>..//slicer
@@ -52,6 +54,7 @@ lib netfsClient :
<include>.
<include>../../libfusepp
<library>../ice//netfsComms
+ <library>Glacier2
<implicit-dependency>../ice//netfsComms
<library>netfsClientConfiguration
<implicit-dependency>netfsClientConfiguration
diff --git a/netfs/fuse/fuseApp.cpp b/netfs/fuse/fuseApp.cpp
index 940d0e6..0e7f941 100644
--- a/netfs/fuse/fuseApp.cpp
+++ b/netfs/fuse/fuseApp.cpp
@@ -1,4 +1,5 @@
#include <pch.hpp>
+#include <Glacier2/Router.h>
#include <string.h>
#include "fuseApp.h"
#include "lockHelpers.h"
@@ -13,6 +14,7 @@ template class OptimisticCallCacheable<struct stat, std::string, IceUtil::Shared
NetFS::FuseApp::FuseApp(int & argc, char ** argv) :
_argc(argc),
_argv(argv),
+ sessionOpened(false),
openDirID(0),
openFileID(0)
{
@@ -29,6 +31,9 @@ NetFS::FuseApp::~FuseApp()
if (volume) {
volume->disconnect();
}
+ if (session) {
+ session->destroy();
+ }
if (ic) {
ic->destroy();
}
@@ -74,6 +79,17 @@ NetFS::FuseApp::opt_parse(void *, const char * arg, int, struct fuse_args *)
}
void
+NetFS::FuseApp::connectSession()
+{
+ if (!sessionOpened && ic->getDefaultRouter()) {
+ Lock(_lock);
+ auto router = Glacier2::RouterPrx::checkedCast(ic->getDefaultRouter());
+ session = router->createSession("", "");
+ sessionOpened = true;
+ }
+}
+
+void
NetFS::FuseApp::connectToService()
{
if (!service) {
@@ -134,6 +150,15 @@ void
NetFS::FuseApp::verifyConnection()
{
Lock(_lock);
+ if (session) {
+ try {
+ session->ice_ping();
+ }
+ catch (const Ice::Exception &) {
+ session = NULL;
+ sessionOpened = false;
+ }
+ }
if (service) {
try {
service->ice_ping();
@@ -157,6 +182,7 @@ NetFS::FuseApp::onError(const std::exception & e) throw()
{
if (dynamic_cast<const Ice::ObjectNotExistException *>(&e)) {
verifyConnection();
+ connectSession();
connectToService();
connectToVolume();
connectHandles();
@@ -168,6 +194,7 @@ NetFS::FuseApp::onError(const std::exception & e) throw()
NetFS::ReqEnv
NetFS::FuseApp::reqEnv()
{
+ connectSession();
connectToService();
connectToVolume();
struct fuse_context * c = fuse_get_context();
diff --git a/netfs/fuse/fuseApp.h b/netfs/fuse/fuseApp.h
index e514b55..335a1c0 100644
--- a/netfs/fuse/fuseApp.h
+++ b/netfs/fuse/fuseApp.h
@@ -3,6 +3,7 @@
#include <boost/thread/shared_mutex.hpp>
#include <Ice/Ice.h>
+#include <Glacier2/Session.h>
#include <service.h>
#include "fuseAppBase.h"
#include "fuseConfig.h"
@@ -40,6 +41,7 @@ namespace NetFS {
void * init (struct fuse_conn_info * info);
int opt_parse(void *, const char * arg, int key, struct fuse_args *);
+ void connectSession();
void connectToService();
void connectToVolume();
void connectHandles();
@@ -102,6 +104,8 @@ namespace NetFS {
NetFS::VolumePrx volume;
NetFS::ServicePrx service;
+ Glacier2::SessionPrx session;
+ bool sessionOpened;
std::string mountPoint;
std::string resourceName;