From 9e5cee2e54a3482605d524f13eedb1cbfba5a971 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 2 Sep 2015 19:46:51 +0100 Subject: Use libadhocutil --- libfusepp/fuseAppBase.h | 6 ++---- netfs/Jamfile.jam | 1 + netfs/daemon/Jamfile.jam | 3 +-- netfs/daemon/daemon.h | 4 +--- netfs/fuse/Jamfile.jam | 9 +++------ netfs/fuse/fuseApp.cpp | 6 ++++-- netfs/fuse/fuseApp.h | 6 ++---- netfs/fuse/fuseDirs.cpp | 7 +++---- netfs/fuse/fuseMisc.cpp | 2 +- netfs/lib/Jamfile.jam | 4 +--- netfs/lib/entCache.cpp | 5 +---- netfs/lib/pch.hpp | 1 - netfs/unittests/Jamfile.jam | 2 +- 13 files changed, 21 insertions(+), 35 deletions(-) diff --git a/libfusepp/fuseAppBase.h b/libfusepp/fuseAppBase.h index a9be11b..5c8582c 100644 --- a/libfusepp/fuseAppBase.h +++ b/libfusepp/fuseAppBase.h @@ -8,10 +8,8 @@ #include #include #include -#include -#ifndef DLL_PUBLIC -#define DLL_PUBLIC __attribute__ ((visibility ("default"))) -#endif +#include +#include class DLL_PUBLIC FuseAppBase { public: diff --git a/netfs/Jamfile.jam b/netfs/Jamfile.jam index 6df8110..2bca779 100644 --- a/netfs/Jamfile.jam +++ b/netfs/Jamfile.jam @@ -15,6 +15,7 @@ lib IceBox : : IceBox ; lib pthread : : pthread ; lib slicer : : : : /usr/include/slicer ; lib slicer-xml : : : : /usr/include/slicer ; +lib adhocutil : : : : /usr/include/adhocutil ; build-project daemon ; build-project fuse ; diff --git a/netfs/daemon/Jamfile.jam b/netfs/daemon/Jamfile.jam index 47b81f6..0960f7b 100644 --- a/netfs/daemon/Jamfile.jam +++ b/netfs/daemon/Jamfile.jam @@ -1,7 +1,6 @@ cpp-pch pch : pch.hpp : _FILE_OFFSET_BITS=64 - ../../libmisc ../ice//netfsComms netfsdConfiguration ../ice//netfsComms @@ -35,7 +34,6 @@ lib netfsd : [ glob *.cpp ] : _FILE_OFFSET_BITS=64 - ../libmisc ../ice//netfsComms netfsdConfiguration netfsdConfiguration @@ -49,6 +47,7 @@ lib netfsd : ..//IceUtil ..//IceBox ..//libxmlpp + ..//adhocutil ..//slicer-xml -fvisibility=hidden release:-flto diff --git a/netfs/daemon/daemon.h b/netfs/daemon/daemon.h index 5f9542a..7599388 100644 --- a/netfs/daemon/daemon.h +++ b/netfs/daemon/daemon.h @@ -5,9 +5,7 @@ #include #include #include -#ifndef DLL_PUBLIC -#define DLL_PUBLIC __attribute__ ((visibility ("default"))) -#endif +#include class DLL_PUBLIC NetFSDaemon : public IceBox::Service { public: diff --git a/netfs/fuse/Jamfile.jam b/netfs/fuse/Jamfile.jam index 8413d1f..fb04fb4 100644 --- a/netfs/fuse/Jamfile.jam +++ b/netfs/fuse/Jamfile.jam @@ -3,13 +3,13 @@ lib Glacier2 : : Glacier2 ; cpp-pch pch : pch.hpp : _FILE_OFFSET_BITS=64 - ../../libmisc ../../libfusepp ../ice//netfsComms ../ice//netfsComms ..//boost_thread fuse ..//Ice + ..//adhocutil ; lib netfsClientConfiguration : @@ -29,17 +29,13 @@ lib netfsClientConfiguration : ..//slicer ; -obj misc : ../../libmisc/misc.cpp ; - lib netfsClient : pch - misc netfsClientConfiguration [ glob *.cpp : netfs.cpp ] [ glob ../../libfusepp/fuse*.cpp ] : _FILE_OFFSET_BITS=64 - ../../libmisc ../../libfusepp ../ice//netfsComms netfsClientConfiguration @@ -54,6 +50,7 @@ lib netfsClient : ..//pthread ..//slicer ..//libxmlpp + ..//adhocutil ..//slicer-xml -fvisibility=hidden release:-flto @@ -69,10 +66,10 @@ lib netfsClient : ; exe netfs : - misc netfs.cpp : netfsClient fuse + ..//adhocutil -fvisibility=hidden release:-flto ; diff --git a/netfs/fuse/fuseApp.cpp b/netfs/fuse/fuseApp.cpp index bc5caf0..1e2064c 100644 --- a/netfs/fuse/fuseApp.cpp +++ b/netfs/fuse/fuseApp.cpp @@ -8,8 +8,10 @@ #include #include -template class Cache>>; -template class OptimisticCallCacheable; +namespace AdHoc { + template class Cache; + template class CallCacheable; +} NetFS::FuseApp::FuseApp(const Ice::StringSeq & a) : args(a), diff --git a/netfs/fuse/fuseApp.h b/netfs/fuse/fuseApp.h index 3ad8f66..3e9f1c4 100644 --- a/netfs/fuse/fuseApp.h +++ b/netfs/fuse/fuseApp.h @@ -9,9 +9,7 @@ #include "fuseAppBase.h" #include "fuseConfig.h" #include "cache.h" -#ifndef DLL_PUBLIC -#define DLL_PUBLIC __attribute__ ((visibility ("default"))) -#endif +#include namespace NetFS { class DLL_PUBLIC FuseApp : public FuseAppBase { @@ -122,7 +120,7 @@ namespace NetFS { EntCache userLookup; EntCache groupLookup; - typedef Cache>> StatCache; + typedef AdHoc::Cache StatCache; StatCache statCache; }; } diff --git a/netfs/fuse/fuseDirs.cpp b/netfs/fuse/fuseDirs.cpp index fa9f13b..2d2be56 100644 --- a/netfs/fuse/fuseDirs.cpp +++ b/netfs/fuse/fuseDirs.cpp @@ -1,7 +1,6 @@ #include #include "fuseApp.h" -#include "misc.h" -#include "lockHelpers.h" +#include #include #include @@ -76,12 +75,12 @@ NetFS::FuseApp::readdir(const char * p, void * buf, fuse_fill_dir_t filler, off_ filler(buf, e.c_str(), NULL, 0); std::string epath = path + "/" + e; auto asga = volume->begin_getattr(reqEnv(), epath); - statCache.Add(new OptimisticCallCacheable( + statCache.add(epath, [asga,this]() { struct stat s; s << AttrSource { volume->end_getattr(asga), userLookup, groupLookup }; return s; - }, epath, time_t(NULL) + 2)); + }, time_t(NULL) + 2); } return 0; } diff --git a/netfs/fuse/fuseMisc.cpp b/netfs/fuse/fuseMisc.cpp index 12a550f..df28318 100644 --- a/netfs/fuse/fuseMisc.cpp +++ b/netfs/fuse/fuseMisc.cpp @@ -14,7 +14,7 @@ int NetFS::FuseApp::getattr(const char * p, struct stat * s) { try { - auto cacehedStat = statCache.Get(p); + auto cacehedStat = statCache.get(p); if (cacehedStat) { *s = *cacehedStat; } diff --git a/netfs/lib/Jamfile.jam b/netfs/lib/Jamfile.jam index 4172f3c..d2e7a4a 100644 --- a/netfs/lib/Jamfile.jam +++ b/netfs/lib/Jamfile.jam @@ -1,6 +1,5 @@ cpp-pch pch : pch.hpp : _FILE_OFFSET_BITS=64 - ../../libmisc ; lib netfsCommon : @@ -8,16 +7,15 @@ lib netfsCommon : [ glob *.cpp ] : _FILE_OFFSET_BITS=64 - ../../libmisc ../ice ..//boost_system ..//boost_thread ../ice//netfsComms + ..//adhocutil ../ice//netfsComms -fvisibility=hidden release:-flto : : . - ../../libmisc ; diff --git a/netfs/lib/entCache.cpp b/netfs/lib/entCache.cpp index 01a2de3..a8db44d 100644 --- a/netfs/lib/entCache.cpp +++ b/netfs/lib/entCache.cpp @@ -4,10 +4,7 @@ #include #include #include - -#ifndef DLL_PUBLIC -#define DLL_PUBLIC __attribute__ ((visibility ("default"))) -#endif +#include template EntCache::EntCache() : diff --git a/netfs/lib/pch.hpp b/netfs/lib/pch.hpp index fc37faa..026b3c8 100644 --- a/netfs/lib/pch.hpp +++ b/netfs/lib/pch.hpp @@ -12,7 +12,6 @@ #include #include #include -#include #endif #endif diff --git a/netfs/unittests/Jamfile.jam b/netfs/unittests/Jamfile.jam index 9aa8bda..0065b13 100644 --- a/netfs/unittests/Jamfile.jam +++ b/netfs/unittests/Jamfile.jam @@ -9,7 +9,6 @@ lib Ice ; path-constant me : . ; lib testMocks : - ../../libmisc/misc.cpp [ glob mock*.cpp ] : IceUtil @@ -19,6 +18,7 @@ lib testMocks : ../daemon//netfsd ../fuse//netfsClient ../ice//netfsComms + ..//adhocutil BOOST_TEST_DYN_LINK boost_utf ROOT=\"$(me)\" -- cgit v1.2.3