summaryrefslogtreecommitdiff
path: root/netfs/fuse
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2018-04-05 20:13:57 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2018-04-05 20:13:57 +0100
commit5d03ac8a6f0f69cec8956c3da9da04941652ee8c (patch)
tree38f9c7f2ee88e70ca92de5175ff39dc1415b2b04 /netfs/fuse
parentUpdated compile flags (diff)
downloadnetfs-5d03ac8a6f0f69cec8956c3da9da04941652ee8c.tar.bz2
netfs-5d03ac8a6f0f69cec8956c3da9da04941652ee8c.tar.xz
netfs-5d03ac8a6f0f69cec8956c3da9da04941652ee8c.zip
Upgrade to Ice-3.7
Diffstat (limited to 'netfs/fuse')
-rw-r--r--netfs/fuse/Jamfile.jam9
-rw-r--r--netfs/fuse/fuseApp.cpp10
-rw-r--r--netfs/fuse/fuseApp.h19
-rw-r--r--netfs/fuse/fuseDirs.cpp4
-rw-r--r--netfs/fuse/fuseFiles.cpp27
-rw-r--r--netfs/fuse/fuseFiles.h17
6 files changed, 55 insertions, 31 deletions
diff --git a/netfs/fuse/Jamfile.jam b/netfs/fuse/Jamfile.jam
index 9df3e89..8e25090 100644
--- a/netfs/fuse/Jamfile.jam
+++ b/netfs/fuse/Jamfile.jam
@@ -1,7 +1,7 @@
import package ;
lib fuse : : <name>fuse ;
-lib Glacier2 : : <name>Glacier2 ;
+lib Glacier2 : : <name>Glacier2++11 ;
lib netfs-client-configuration :
fuseConfig.ice
@@ -11,12 +11,9 @@ lib netfs-client-configuration :
<library>../ice//netfs-api
<implicit-dependency>../ice//netfs-api
<library>..//Ice
- <library>..//IceUtil
- <library>..//pthread
<library>..//slicer
<library>..//adhocutil
: :
- <library>..//IceUtil
<library>..//Ice
<library>..//boost_system
<library>..//slicer
@@ -26,7 +23,6 @@ lib netfs-client :
netfs-client-configuration
[ glob *.cpp : fuseConfigImpl.cpp netfs.cpp ]
:
- <define>_FILE_OFFSET_BITS=64
<implicit-dependency>../ice//netfs-api
<library>netfs-client-configuration
<implicit-dependency>netfs-client-configuration
@@ -37,8 +33,6 @@ lib netfs-client :
<library>..//boost_filesystem
<library>..//Ice
<library>Glacier2
- <library>..//IceUtil
- <library>..//pthread
<library>..//slicer
<library>..//adhocutil
<library>..//slicer-xml
@@ -49,7 +43,6 @@ lib netfs-client :
<implicit-dependency>../ice//netfs-api
<library>netfs-client-configuration
<implicit-dependency>netfs-client-configuration
- <define>_FILE_OFFSET_BITS=64
;
exe netfs :
diff --git a/netfs/fuse/fuseApp.cpp b/netfs/fuse/fuseApp.cpp
index 436df25..32de9a5 100644
--- a/netfs/fuse/fuseApp.cpp
+++ b/netfs/fuse/fuseApp.cpp
@@ -68,7 +68,7 @@ NetFS::FuseApp::~FuseApp()
NetFS::Client::ConfigurationPtr
NetFS::FuseApp::ReadConfiguration(const boost::filesystem::path & path) const
{
- auto s = Slicer::FileDeserializerFactory::createNew(path.extension().string(), path);
+ auto s = Slicer::DeserializerPtr(Slicer::FileDeserializerFactory::createNew(path.extension().string(), path));
return Slicer::DeserializeAnyWith<NetFS::Client::ConfigurationPtr>(s);
}
@@ -92,7 +92,7 @@ NetFS::FuseApp::configureFromUri(const std::string & uriString) const
{
AdHoc::Uri uri(uriString);
- NetFS::Client::ResourcePtr r = new NetFS::Client::Resource();
+ auto r = std::make_shared<NetFS::Client::Resource>();
r->ExportName = uri.path->string();
r->Endpoints.push_back(IceEndpointFmt::get(uri.scheme, uri.host, uri.port ? *uri.port : 4000));
if (uri.password) {
@@ -135,11 +135,11 @@ NetFS::FuseApp::connectSession()
{
if (!sessionOpened && ic->getDefaultRouter()) {
Lock(_lock);
- auto router = Glacier2::RouterPrx::checkedCast(ic->getDefaultRouter());
+ auto router = Ice::checkedCast<Glacier2::RouterPrx>(ic->getDefaultRouter());
session = router->createSession("", "");
if (int acmTimeout = router->getACMTimeout() > 0) {
Ice::ConnectionPtr conn = router->ice_getCachedConnection();
- conn->setACM(acmTimeout, IceUtil::None, Ice::HeartbeatAlways);
+ conn->setACM(acmTimeout, IceUtil::None, Ice::ACMHeartbeat::HeartbeatAlways);
}
sessionOpened = true;
}
@@ -155,7 +155,7 @@ NetFS::FuseApp::connectToService()
for (const auto & ep : fcr->Endpoints) {
proxyAddr += ":" + ep;
}
- service = NetFS::ServicePrx::checkedCast(ic->stringToProxy(proxyAddr));
+ service = Ice::checkedCast<NetFS::ServicePrx>(ic->stringToProxy(proxyAddr));
if (!service) {
throw std::runtime_error("Invalid service proxy: " + proxyAddr);
}
diff --git a/netfs/fuse/fuseApp.h b/netfs/fuse/fuseApp.h
index 41ff9ad..237e711 100644
--- a/netfs/fuse/fuseApp.h
+++ b/netfs/fuse/fuseApp.h
@@ -20,10 +20,10 @@ namespace NetFS {
private:
class OpenDir {
public:
- OpenDir(DirectoryPrx remote, const std::string & path);
+ OpenDir(DirectoryPrxPtr remote, const std::string & path);
- DirectoryPrx remote;
- DirectoryV2Prx remoteV2;
+ DirectoryPrxPtr remote;
+ DirectoryV2PrxPtr remoteV2;
const std::string path;
};
typedef std::shared_ptr<OpenDir> OpenDirPtr;
@@ -31,15 +31,16 @@ namespace NetFS {
class OpenFile {
public:
- OpenFile(FilePrx remote, const std::string & path, int flags);
+ OpenFile(FilePrxPtr remote, const std::string & path, int flags);
void flush();
void wait() const;
- FilePrx remote;
+ FilePrxPtr remote;
const std::string path;
const int flags;
- typedef boost::icl::interval_map<Ice::Long, Ice::AsyncResultPtr> BGs;
+ class WriteState;
+ typedef boost::icl::interval_map<Ice::Long, std::shared_ptr<WriteState>> BGs;
static BGs::interval_type range(off_t, size_t);
BGs bg;
mutable boost::shared_mutex _lock;
@@ -125,9 +126,9 @@ namespace NetFS {
Client::ResourcePtr fcr;
mutable boost::shared_mutex _lock;
- NetFS::VolumePrx volume;
- NetFS::ServicePrx service;
- Glacier2::SessionPrx session;
+ NetFS::VolumePrxPtr volume;
+ NetFS::ServicePrxPtr service;
+ Glacier2::SessionPrxPtr session;
bool sessionOpened;
std::string mountPoint;
diff --git a/netfs/fuse/fuseDirs.cpp b/netfs/fuse/fuseDirs.cpp
index 2b51a66..3d77101 100644
--- a/netfs/fuse/fuseDirs.cpp
+++ b/netfs/fuse/fuseDirs.cpp
@@ -3,9 +3,9 @@
#include <entCache.h>
namespace NetFS {
-FuseApp::OpenDir::OpenDir(DirectoryPrx r, const std::string & p) :
+FuseApp::OpenDir::OpenDir(DirectoryPrxPtr r, const std::string & p) :
remote(r),
- remoteV2(r->ice_getFacet() >= "v02" ? DirectoryV2Prx::uncheckedCast(r) : nullptr),
+ remoteV2(r->ice_getFacet() >= "v02" ? Ice::uncheckedCast<DirectoryV2Prx>(r) : nullptr),
path(p)
{
}
diff --git a/netfs/fuse/fuseFiles.cpp b/netfs/fuse/fuseFiles.cpp
index 222cab0..858a0a9 100644
--- a/netfs/fuse/fuseFiles.cpp
+++ b/netfs/fuse/fuseFiles.cpp
@@ -1,11 +1,17 @@
#include <string.h>
#include "fuseApp.impl.h"
+#include "fuseFiles.h"
#include "lockHelpers.h"
#include <entCache.h>
#include <mutex>
namespace NetFS {
-FuseApp::OpenFile::OpenFile(FilePrx r, const std::string & p, int f) :
+FuseApp::OpenFile::WriteState::WriteState() :
+ future(promise.get_future().share())
+{
+}
+
+FuseApp::OpenFile::OpenFile(FilePrxPtr r, const std::string & p, int f) :
remote(r),
path(p),
flags(f)
@@ -24,7 +30,7 @@ FuseApp::OpenFile::wait() const
{
SharedLock(_lock);
for (const auto & w : bg) {
- w.second->waitForCompleted();
+ w.second->future.wait();
}
}
@@ -37,7 +43,7 @@ FuseApp::OpenFile::flush()
};
while (auto w = first()) {
// background operations are void, so no need to actually get the return value
- w->throwLocalException();
+ w->future.wait();
}
}
@@ -123,13 +129,13 @@ FuseApp::waitOnWriteRangeAndThen(size_t s, off_t o, const OpenFilePtr & of, cons
else {
// Wait for them whilst unlocked
_l.release()->unlock();
- std::vector<Ice::AsyncResultPtr> overlap;
+ std::vector<std::shared_ptr<OpenFile::WriteState>> overlap;
overlap.reserve(std::distance(R.first, R.second));
for (auto i = R.first; i != R.second; i++) {
overlap.push_back(i->second);
}
for (const auto & r : overlap) {
- r->waitForCompleted();
+ r->future.wait();
}
// Cause this thread to yield so the callback can acquire _lock
usleep(0);
@@ -163,12 +169,19 @@ FuseApp::write(const char *, const char * buf, size_t s, off_t o, struct fuse_fi
auto remote = of->remote;
if (fcr->Async) {
waitOnWriteRangeAndThen<void>(s, o, of, [o, s, buf, &of, &remote](const auto & key){
- auto r = remote->begin_write(o, s, Buffer(buf, buf + s), [of,key](const Ice::AsyncResultPtr &) {
+ auto p = std::make_shared<OpenFile::WriteState>();
+ remote->writeAsync(o, s, Buffer(buf, buf + s), [p,of,key]() {
+ p->promise.set_value();
+ ScopeLock(of->_lock) {
+ of->bg.erase(key);
+ }
+ }, [p,of,key](auto e) {
+ p->promise.set_exception(e);
ScopeLock(of->_lock) {
of->bg.erase(key);
}
});
- of->bg.insert({key, r});
+ of->bg.insert({key, p});
});
}
else {
diff --git a/netfs/fuse/fuseFiles.h b/netfs/fuse/fuseFiles.h
new file mode 100644
index 0000000..5e05ad2
--- /dev/null
+++ b/netfs/fuse/fuseFiles.h
@@ -0,0 +1,17 @@
+#ifndef NETFS_FUSE_FILES_H
+#define NETFS_FUSE_FILES_H
+
+#include "fuseApp.h"
+
+namespace NetFS {
+ class FuseApp::OpenFile::WriteState {
+ public:
+ WriteState();
+
+ std::promise<void> promise;
+ std::shared_future<void> future;
+ };
+}
+
+#endif
+