summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--netfs/daemon/daemonConfig.cpp6
-rw-r--r--netfs/daemon/daemonConfig.h18
-rw-r--r--netfs/fuse/fuse.h9
-rw-r--r--netfs/fuse/fuseConfig.h13
-rw-r--r--netfs/fuse/fuseDirs.cpp13
-rw-r--r--netfs/fuse/fuseFiles.cpp31
-rw-r--r--netfs/lib/pch.hpp2
7 files changed, 34 insertions, 58 deletions
diff --git a/netfs/daemon/daemonConfig.cpp b/netfs/daemon/daemonConfig.cpp
index 7f171eb..7f75900 100644
--- a/netfs/daemon/daemonConfig.cpp
+++ b/netfs/daemon/daemonConfig.cpp
@@ -10,6 +10,12 @@ myHostname()
return buf;
}
+bool
+DaemonConfig::Host::operator<(const DaemonConfig::Host & other) const
+{
+ return (this->name < other.name);
+}
+
DaemonConfigPtr
DaemonConfig::Load(const std::string & path)
{
diff --git a/netfs/daemon/daemonConfig.h b/netfs/daemon/daemonConfig.h
index f27aedb..c4513cb 100644
--- a/netfs/daemon/daemonConfig.h
+++ b/netfs/daemon/daemonConfig.h
@@ -4,26 +4,26 @@
#include <string>
#include <map>
#include <set>
-#include <intrusivePtrBase.h>
-#include <boost/intrusive_ptr.hpp>
+#include <IceUtil/Shared.h>
#include <boost/filesystem/path.hpp>
#include "xml.h"
-class DaemonConfig : public virtual IntrusivePtrBase {
+class DaemonConfig : public IceUtil::Shared {
public:
- class Host : public virtual IntrusivePtrBase {
+ class Host : public IceUtil::Shared {
public:
Host(xmlNodePtr);
std::string iceEndpoint;
std::string name;
bool self;
+ bool operator<(const Host &) const;
};
- typedef boost::intrusive_ptr<Host> HostPtr;
+ typedef IceUtil::Handle<Host> HostPtr;
typedef std::map<std::string, HostPtr> HostMap;
typedef std::set<HostPtr> HostSet;
- class Export : public virtual IntrusivePtrBase {
+ class Export : public IceUtil::Shared {
public:
Export(xmlNodePtr, const HostMap &);
@@ -31,18 +31,18 @@ class DaemonConfig : public virtual IntrusivePtrBase {
std::string name;
HostSet replicate;
};
- typedef boost::intrusive_ptr<Export> ExportPtr;
+ typedef IceUtil::Handle<Export> ExportPtr;
typedef std::map<std::string, ExportPtr> ExportMap;
DaemonConfig(xmlNodePtr);
- static boost::intrusive_ptr<DaemonConfig> Load(const std::string & path);
+ static IceUtil::Handle<DaemonConfig> Load(const std::string & path);
ExportMap exports;
HostMap hosts;
HostPtr self;
};
-typedef boost::intrusive_ptr<DaemonConfig> DaemonConfigPtr;
+typedef IceUtil::Handle<DaemonConfig> DaemonConfigPtr;
#endif
diff --git a/netfs/fuse/fuse.h b/netfs/fuse/fuse.h
index 033d7fa..0b9e10e 100644
--- a/netfs/fuse/fuse.h
+++ b/netfs/fuse/fuse.h
@@ -7,7 +7,6 @@
#include "fuseapp.h"
#include "fuseConfig.h"
#include "entCache.h"
-#include "intrusivePtrBase.h"
#define LOCK boost::unique_lock<boost::shared_mutex> _lck(_lock)
#define SLOCK boost::shared_lock<boost::shared_mutex> _lck(_lock)
@@ -15,17 +14,17 @@
namespace NetFS {
class FuseApp : public FuseAppBase {
private:
- class OpenDir : public IntrusivePtrBase {
+ class OpenDir : public IceUtil::Shared {
public:
OpenDir(DirectoryPrx remote, const std::string & path);
DirectoryPrx remote;
const std::string path;
};
- typedef boost::intrusive_ptr<OpenDir> OpenDirPtr;
+ typedef IceUtil::Handle<OpenDir> OpenDirPtr;
typedef std::map<int, OpenDirPtr> OpenDirs;
- class OpenFile : public IntrusivePtrBase {
+ class OpenFile : public IceUtil::Shared {
public:
OpenFile(FilePrx remote, const std::string & path, int flags);
@@ -33,7 +32,7 @@ namespace NetFS {
const std::string path;
const int flags;
};
- typedef boost::intrusive_ptr<OpenFile> OpenFilePtr;
+ typedef IceUtil::Handle<OpenFile> OpenFilePtr;
typedef std::map<int, OpenFilePtr> OpenFiles;
public:
diff --git a/netfs/fuse/fuseConfig.h b/netfs/fuse/fuseConfig.h
index f33c8f7..32f25b4 100644
--- a/netfs/fuse/fuseConfig.h
+++ b/netfs/fuse/fuseConfig.h
@@ -4,16 +4,15 @@
#include <string>
#include <map>
#include <set>
-#include <intrusivePtrBase.h>
-#include <boost/intrusive_ptr.hpp>
+#include <IceUtil/Shared.h>
#include "xml.h"
-class FuseConfig : public virtual IntrusivePtrBase {
+class FuseConfig : public IceUtil::Shared {
public:
class Export;
- typedef boost::intrusive_ptr<Export> ExportPtr;
+ typedef IceUtil::Handle<Export> ExportPtr;
typedef std::map<std::string, ExportPtr> ExportMap;
- class Export : public virtual IntrusivePtrBase {
+ class Export : public IceUtil::Shared {
public:
typedef std::set<std::string> Endpoints;
Export(xmlNodePtr);
@@ -23,11 +22,11 @@ class FuseConfig : public virtual IntrusivePtrBase {
};
FuseConfig(xmlNodePtr);
- static boost::intrusive_ptr<FuseConfig> Load(const std::string & path);
+ static IceUtil::Handle<FuseConfig> Load(const std::string & path);
ExportMap exports;
};
-typedef boost::intrusive_ptr<FuseConfig> FuseConfigPtr;
+typedef IceUtil::Handle<FuseConfig> FuseConfigPtr;
#endif
diff --git a/netfs/fuse/fuseDirs.cpp b/netfs/fuse/fuseDirs.cpp
index 216d032..fac70a6 100644
--- a/netfs/fuse/fuseDirs.cpp
+++ b/netfs/fuse/fuseDirs.cpp
@@ -19,6 +19,7 @@ NetFS::FuseApp::setProxy(OpenDirPtr od, uint64_t & fh)
NetFS::FuseApp::OpenDirPtr
NetFS::FuseApp::getDirProxy(uint64_t localID) const
{
+ SLOCK;
OpenDirs::const_iterator i = openDirs.find(localID);
if (i != openDirs.end()) {
return i->second;
@@ -50,11 +51,7 @@ int
NetFS::FuseApp::releasedir(const char *, struct fuse_file_info * fi)
{
try {
- DirectoryPrx remote;
- {
- LOCK;
- remote = getDirProxy(fi->fh)->remote;
- }
+ auto remote = getDirProxy(fi->fh)->remote;
remote->close();
clearDirProxy(fi->fh);
return 0;
@@ -68,11 +65,7 @@ int
NetFS::FuseApp::readdir(const char *, void * buf, fuse_fill_dir_t filler, off_t, struct fuse_file_info * fi)
{
try {
- DirectoryPrx remote;
- {
- LOCK;
- remote = getDirProxy(fi->fh)->remote;
- }
+ auto remote = getDirProxy(fi->fh)->remote;
NetFS::NameList ds = remote->readdir();
BOOST_FOREACH(const auto & e, ds) {
filler(buf, e.c_str(), NULL, 0);
diff --git a/netfs/fuse/fuseFiles.cpp b/netfs/fuse/fuseFiles.cpp
index c8d2495..4a96e51 100644
--- a/netfs/fuse/fuseFiles.cpp
+++ b/netfs/fuse/fuseFiles.cpp
@@ -21,6 +21,7 @@ NetFS::FuseApp::setProxy(OpenFilePtr of, uint64_t & fh)
NetFS::FuseApp::OpenFilePtr
NetFS::FuseApp::getFileProxy(uint64_t localID) const
{
+ SLOCK;
OpenFiles::const_iterator i = openFiles.find(localID);
if (i != openFiles.end()) {
return i->second;
@@ -65,11 +66,7 @@ int
NetFS::FuseApp::release(const char *, struct fuse_file_info * fi)
{
try {
- FilePrx remote;
- {
- LOCK;
- remote = getFileProxy(fi->fh)->remote;
- }
+ auto remote = getFileProxy(fi->fh)->remote;
remote->close();
clearFileProxy(fi->fh);
return 0;
@@ -83,11 +80,7 @@ int
NetFS::FuseApp::read(const char *, char * buf, size_t s, off_t o, struct fuse_file_info * fi)
{
try {
- FilePrx remote;
- {
- LOCK;
- remote = getFileProxy(fi->fh)->remote;
- }
+ auto remote = getFileProxy(fi->fh)->remote;
NetFS::Buffer data = remote->read(o, s);
memcpy(buf, &data.front(), data.size());
return data.size();
@@ -101,11 +94,7 @@ int
NetFS::FuseApp::write(const char *, const char * buf, size_t s, off_t o, struct fuse_file_info * fi)
{
try {
- FilePrx remote;
- {
- LOCK;
- remote = getFileProxy(fi->fh)->remote;
- }
+ auto remote = getFileProxy(fi->fh)->remote;
remote->write(o, s, NetFS::Buffer(buf, buf + s));
return s;
}
@@ -130,11 +119,7 @@ int
NetFS::FuseApp::ftruncate(const char *, off_t o, fuse_file_info * fi)
{
try {
- FilePrx remote;
- {
- LOCK;
- remote = getFileProxy(fi->fh)->remote;
- }
+ auto remote = getFileProxy(fi->fh)->remote;
remote->ftruncate(reqEnv(), o);
return 0;
}
@@ -147,11 +132,7 @@ int
NetFS::FuseApp::fgetattr(const char *, struct stat * s, fuse_file_info * fi)
{
try {
- FilePrx remote;
- {
- LOCK;
- remote = getFileProxy(fi->fh)->remote;
- }
+ auto remote = getFileProxy(fi->fh)->remote;
*s << AttrSource { remote->fgetattr(reqEnv()), boost::bind(&UserEntCache::getID, &uentries, _1), boost::bind(&GroupEntCache::getID, &gentries, _1) };
return 0;
}
diff --git a/netfs/lib/pch.hpp b/netfs/lib/pch.hpp
index e5ee5d7..bfa768e 100644
--- a/netfs/lib/pch.hpp
+++ b/netfs/lib/pch.hpp
@@ -3,14 +3,12 @@
#define NETFS_PCH
#include <boost/foreach.hpp>
-#include <boost/intrusive_ptr.hpp>
#include <boost/thread/locks.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/shared_mutex.hpp>
#include <boost/tuple/tuple.hpp>
#include <exception>
#include <Ice/Ice.h>
-#include <intrusivePtrBase.h>
#include <map>
#include <set>
#include <string>