diff options
-rw-r--r-- | netfs/fuse/Jamfile.jam | 3 | ||||
-rw-r--r-- | netfs/fuse/fuseAppBase.cpp (renamed from libfusepp/fuseAppBase.cpp) | 14 | ||||
-rw-r--r-- | netfs/fuse/fuseAppBase.h (renamed from libfusepp/fuseAppBase.h) | 6 | ||||
-rw-r--r-- | netfs/fuse/netfs.cpp | 4 | ||||
-rw-r--r-- | netfs/unittests/mockFuse.cpp | 4 | ||||
-rw-r--r-- | netfs/unittests/mockFuse.h | 2 |
6 files changed, 22 insertions, 11 deletions
diff --git a/netfs/fuse/Jamfile.jam b/netfs/fuse/Jamfile.jam index 4340687..d0ad9b7 100644 --- a/netfs/fuse/Jamfile.jam +++ b/netfs/fuse/Jamfile.jam @@ -22,10 +22,8 @@ lib netfsClientConfiguration : lib netfsClient : netfsClientConfiguration [ glob *.cpp : netfs.cpp ] - [ glob ../../libfusepp/fuse*.cpp ] : <define>_FILE_OFFSET_BITS=64 - <include>../../libfusepp <implicit-dependency>../ice//netfsComms <library>netfsClientConfiguration <implicit-dependency>netfsClientConfiguration @@ -44,7 +42,6 @@ lib netfsClient : <library>..//slicer-xml : : <include>. - <include>../../libfusepp <library>../ice//netfsComms <library>Glacier2 <implicit-dependency>../ice//netfsComms diff --git a/libfusepp/fuseAppBase.cpp b/netfs/fuse/fuseAppBase.cpp index b56b765..4653efb 100644 --- a/libfusepp/fuseAppBase.cpp +++ b/netfs/fuse/fuseAppBase.cpp @@ -182,9 +182,21 @@ int FuseAppBase::fallocate(const char *, int, off_t, off_t, struct fuse_file_inf { return -ENOSYS; } +void FuseAppBase::log(int level, const char * message) const throw() +{ + logf(level, "%s", message); +} +void FuseAppBase::logf(int level, const char * fmt, ...) const throw() +{ + va_list args; + va_start(args, fmt); + vlogf(level, fmt, args); + va_end(args); +} + int FuseAppBase::onError(const std::exception & e) throw() { - log(LOG_ERR, stringf("Unknown exception (what: %s)\n", e.what())); + logf(LOG_ERR, "Unknown exception (what: %s)", e.what()); return -ENOSYS; } diff --git a/libfusepp/fuseAppBase.h b/netfs/fuse/fuseAppBase.h index 8efed83..388ac5b 100644 --- a/libfusepp/fuseAppBase.h +++ b/netfs/fuse/fuseAppBase.h @@ -58,7 +58,9 @@ class DLL_PUBLIC FuseAppBase { virtual int flock(const char *, struct fuse_file_info *, int op); virtual int fallocate(const char *, int, off_t, off_t, struct fuse_file_info *); virtual int onError(const std::exception & err) throw(); - virtual void log(int level, const std::string &) const throw() = 0; + void log(int level, const char * message) const throw(); + void logf(int level, const char * fmt, ...) const throw() __attribute__ ((__format__ (__printf__, 3, 4))); + virtual void vlogf(int level, const char * fmt, va_list) const throw() __attribute__ ((__format__ (__printf__, 3, 0))) = 0; virtual int fuse_opt_parse(struct fuse_args *args, void *data, const struct fuse_opt opts[], fuse_opt_proc_t proc) = 0; virtual int main(int, char **, const struct fuse_operations *) = 0; @@ -157,7 +159,7 @@ class DLL_PUBLIC FuseAppBase { return helper<f>(a...); } catch (...) { - fuseApp->log(LOG_ERR, stringf("Unknown exception calling %s\n", typeid(f).name())); + fuseApp->logf(LOG_ERR, "Unknown exception calling %s", typeid(f).name()); return -ENOSYS; } } diff --git a/netfs/fuse/netfs.cpp b/netfs/fuse/netfs.cpp index 945c599..2039eed 100644 --- a/netfs/fuse/netfs.cpp +++ b/netfs/fuse/netfs.cpp @@ -29,9 +29,9 @@ class FuseImpl : public NetFS::FuseApp { return ::fuse_main(argc, argv, ops, this); } - void log(int priority, const std::string & message) const throw() override + void vlogf(int priority, const char * fmt, va_list args) const throw() override { - syslog(priority, "%s", message.c_str()); + vsyslog(priority, fmt, args); } }; diff --git a/netfs/unittests/mockFuse.cpp b/netfs/unittests/mockFuse.cpp index 1a3b0ce..1dca70b 100644 --- a/netfs/unittests/mockFuse.cpp +++ b/netfs/unittests/mockFuse.cpp @@ -47,9 +47,9 @@ FuseMock::ReadConfiguration(const boost::filesystem::path & path) const } void -FuseMock::log(int, const std::string & message) const throw() +FuseMock::vlogf(int, const char * fmt, va_list args) const throw() { - BOOST_TEST_MESSAGE(message); + BOOST_TEST_MESSAGE(vstringf(fmt, args)); } FuseMockHost::FuseMockHost(const std::string & ep, const Ice::StringSeq & a) : diff --git a/netfs/unittests/mockFuse.h b/netfs/unittests/mockFuse.h index 4002dab..fa3a92b 100644 --- a/netfs/unittests/mockFuse.h +++ b/netfs/unittests/mockFuse.h @@ -11,7 +11,7 @@ class DLL_PUBLIC FuseMock : public NetFS::FuseApp { struct fuse_context * fuse_get_context() override; int fuse_opt_parse(struct fuse_args * args, void * data, const struct fuse_opt [], fuse_opt_proc_t proc) override; int main(int, char **, const struct fuse_operations * o) override; - void log(int, const std::string &) const throw() override; + void vlogf(int, const char *, va_list) const throw() override; fuse_operations ops; |