From 4b8f75974f7bdce5d68b95ac8d4c2e9979c38057 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 15 Feb 2015 17:11:20 +0000 Subject: Refactor fuse lib deps into final exe --- libfusepp/fuseAppBase.h | 6 ++++-- netfs/fuse/Jamfile.jam | 3 +-- netfs/fuse/fuseApp.h | 2 ++ netfs/fuse/netfs.cpp | 17 ++++++++++++++++- 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 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::GetHelper(getattr), fuseCall::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 : ../lib//netfsCommon ..//boost_thread ..//boost_system - fuse ..//Ice ..//IceUtil ..//pthread @@ -57,11 +56,11 @@ lib netfsClient : netfsClientConfiguration netfsClientConfiguration _FILE_OFFSET_BITS=64 - fuse ; exe netfs : netfs.cpp : netfsClient + 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)); } -- cgit v1.2.3