diff options
Diffstat (limited to 'netfs/fuse/fuseAppBase.cpp')
| -rw-r--r-- | netfs/fuse/fuseAppBase.cpp | 47 | 
1 files changed, 14 insertions, 33 deletions
| diff --git a/netfs/fuse/fuseAppBase.cpp b/netfs/fuse/fuseAppBase.cpp index 01ec8e1..0b6a90e 100644 --- a/netfs/fuse/fuseAppBase.cpp +++ b/netfs/fuse/fuseAppBase.cpp @@ -5,22 +5,28 @@  #include <unistd.h>  #include <cstdlib>  #include <typeinfo> +#include <boost/assert.hpp>  FuseAppBase * FuseAppBase::fuseApp; +FuseAppBase::FuseAppBase() +{ +	BOOST_ASSERT(!fuseApp); +	BOOST_ASSERT(this); +	fuseApp = this; +} + +FuseAppBase::~FuseAppBase() +{ +	BOOST_ASSERT(fuseApp); +	fuseApp = nullptr; +} +  // LCOV_EXCL_START  // These are all excluded from coverage because it is impossible  // to call them in a realistic manner. They exist only as the default  // implementation of the function which is never passed to libfuse  // unless it is overridden. -void * FuseAppBase::init(fuse_conn_info*) -{ -	return nullptr; -} -int FuseAppBase::opt_parse(void*, const char *, int, fuse_args*) -{ -	return 1; -}  int FuseAppBase::access(const char *, int)  {  	return -ENOSYS; @@ -190,11 +196,8 @@ void FuseAppBase::log(int level, const char * message) const noexcept  void FuseAppBase::logf(int level, const char * fmt, ...) const noexcept  {  	va_list args; -	// NOLINTNEXTLINE(hicpp-no-array-decay)  	va_start(args, fmt); -	// NOLINTNEXTLINE(hicpp-no-array-decay)  	vlogf(level, fmt, args); -	// NOLINTNEXTLINE(hicpp-no-array-decay)  	va_end(args);  } @@ -208,25 +211,3 @@ void FuseAppBase::beforeOperation()  {  } -void * FuseAppBase::fuseInit (struct fuse_conn_info *conn) -{ -	return fuseApp->init(conn); -} -void FuseAppBase::fuseDestroy(void *) -{ -	delete fuseApp; -} - -struct fuse_args -FuseAppBase::runint(int argc, char ** argv) -{ -	std::array<fuse_opt, 1> fuse_opts {}; -	fuseApp = this; -	struct fuse_args args = FUSE_ARGS_INIT(argc, argv); -	if (fuse_opt_parse(&args, fuseApp, fuse_opts.data(), -			&internalHelper<decltype(&FuseAppBase::opt_parse), &FuseAppBase::opt_parse>) == -1) { -		exit(1); -	} -	return args; -} - | 
