summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-02-15 17:11:20 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2015-02-15 17:11:20 +0000
commit08d7f2d862ba04aede40546d9721dfe1f6c9a2eb (patch)
treedf4339432eabb553d095933e1d6e44aaf14117d3
parentRename configs for uniqueness (diff)
downloadnetfs-08d7f2d862ba04aede40546d9721dfe1f6c9a2eb.tar.bz2
netfs-08d7f2d862ba04aede40546d9721dfe1f6c9a2eb.tar.xz
netfs-08d7f2d862ba04aede40546d9721dfe1f6c9a2eb.zip
Refactor fuse lib deps into final exe
-rw-r--r--libfusepp/fuseAppBase.h6
-rw-r--r--netfs/fuse/Jamfile.jam3
-rw-r--r--netfs/fuse/fuseApp.h2
-rw-r--r--netfs/fuse/netfs.cpp17
4 files changed, 23 insertions, 5 deletions
diff --git a/libfusepp/fuseAppBase.h b/libfusepp/fuseAppBase.h
index a320d36..91ba22f 100644
--- a/libfusepp/fuseAppBase.h
+++ b/libfusepp/fuseAppBase.h
@@ -56,11 +56,13 @@ class FuseAppBase {
virtual int fallocate(const char *, int, off_t, off_t, struct fuse_file_info *);
virtual int onError(const std::exception & err) throw();
+ virtual int fuse_opt_parse(struct fuse_args *args, void *data, const struct fuse_opt opts[], fuse_opt_proc_t proc) = 0;
+
#define GetHelper(func) getHelper<&FuseAppBase::func>(typeid(&FuseAppBase::func) != typeid(&FuseApp::func))
template <typename FuseApp>
static int run(int & argc, char** & argv, FuseApp * fa)
{
- auto args = runint(argc, argv, fa);
+ auto args = fa->runint(argc, argv, fa);
struct fuse_operations operations = {
fuseCall<const char *, struct stat *>::GetHelper(getattr),
fuseCall<const char *, char *, size_t>::GetHelper(readlink),
@@ -122,7 +124,7 @@ class FuseAppBase {
return fuse_main(args.argc, args.argv, &operations, fa);
}
private:
- static struct fuse_args runint(int &, char ** &, FuseAppBase *);
+ struct fuse_args runint(int &, char ** &, FuseAppBase *);
static void * fuseInit(struct fuse_conn_info *conn);
static void fuseDestroy(void *);
diff --git a/netfs/fuse/Jamfile.jam b/netfs/fuse/Jamfile.jam
index 737c6c8..c5d3a7a 100644
--- a/netfs/fuse/Jamfile.jam
+++ b/netfs/fuse/Jamfile.jam
@@ -42,7 +42,6 @@ lib netfsClient :
<library>../lib//netfsCommon
<library>..//boost_thread
<library>..//boost_system
- <library>fuse
<library>..//Ice
<library>..//IceUtil
<library>..//pthread
@@ -57,11 +56,11 @@ lib netfsClient :
<library>netfsClientConfiguration
<implicit-dependency>netfsClientConfiguration
<define>_FILE_OFFSET_BITS=64
- <library>fuse
;
exe netfs :
netfs.cpp :
<library>netfsClient
+ <library>fuse
;
diff --git a/netfs/fuse/fuseApp.h b/netfs/fuse/fuseApp.h
index 4eb01ff..4786591 100644
--- a/netfs/fuse/fuseApp.h
+++ b/netfs/fuse/fuseApp.h
@@ -78,6 +78,8 @@ namespace NetFS {
// stuff
int onError(const std::exception & err) throw();
+ virtual struct fuse_context * fuse_get_context() = 0;
+
private:
void setProxy(OpenFilePtr, uint64_t & fh);
OpenFilePtr getFileProxy(uint64_t localID) const;
diff --git a/netfs/fuse/netfs.cpp b/netfs/fuse/netfs.cpp
index de89660..21689f2 100644
--- a/netfs/fuse/netfs.cpp
+++ b/netfs/fuse/netfs.cpp
@@ -1,8 +1,23 @@
#include "fuseApp.h"
+class FuseImpl : public NetFS::FuseApp {
+ public:
+ FuseImpl(int & argc, char ** argv) : NetFS::FuseApp(argc, argv) { }
+
+ struct fuse_context * fuse_get_context() override
+ {
+ return ::fuse_get_context();
+ }
+
+ int fuse_opt_parse(struct fuse_args * args, void * data, const struct fuse_opt opts[], fuse_opt_proc_t proc) override
+ {
+ return ::fuse_opt_parse(args, data, opts, proc);
+ }
+};
+
int
main(int argc, char* argv[])
{
- return FuseAppBase::run(argc, argv, new NetFS::FuseApp(argc, argv));
+ return FuseAppBase::run(argc, argv, new FuseImpl(argc, argv));
}