From b60ac919728bea925f061dbc1243f8df3d084b61 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 29 Mar 2020 12:28:43 +0100 Subject: Pull definitions of OpenFile and Dir into their own header --- netfs/fuse/fuseApp.cpp | 2 ++ netfs/fuse/fuseApp.h | 26 ++------------------------ netfs/fuse/fuseDirs.cpp | 2 +- netfs/fuse/fuseDirs.h | 17 +++++++++++++++++ netfs/fuse/fuseFiles.h | 24 ++++++++++++++++++++---- 5 files changed, 42 insertions(+), 29 deletions(-) create mode 100644 netfs/fuse/fuseDirs.h diff --git a/netfs/fuse/fuseApp.cpp b/netfs/fuse/fuseApp.cpp index 21bff3d..fd26516 100644 --- a/netfs/fuse/fuseApp.cpp +++ b/netfs/fuse/fuseApp.cpp @@ -8,6 +8,8 @@ #include #include #include +#include "fuseDirs.h" +#include "fuseFiles.h" namespace AdHoc { template class Cache; diff --git a/netfs/fuse/fuseApp.h b/netfs/fuse/fuseApp.h index b38c97c..bef757b 100644 --- a/netfs/fuse/fuseApp.h +++ b/netfs/fuse/fuseApp.h @@ -14,37 +14,15 @@ #include "cache.h" #include #include -#include namespace NetFS { class DLL_PUBLIC FuseApp : public FuseAppBaseT { private: - class OpenDir { - public: - OpenDir(DirectoryPrxPtr remote, std::string path); - - DirectoryPrxPtr remote; - const std::string path; - }; + class OpenDir; using OpenDirPtr = std::shared_ptr; using OpenDirs = std::map; - class OpenFile { - public: - OpenFile(FilePrxPtr remote, std::string path, int flags); - - void flush(); - void wait() const; - - FilePrxPtr remote; - const std::string path; - const int flags; - class WriteState; - using BGs = boost::icl::interval_map>; - static BGs::interval_type range(off_t, size_t); - BGs bg; - mutable std::shared_mutex _lock; - }; + class OpenFile; using OpenFilePtr = std::shared_ptr; using OpenFiles = std::map; diff --git a/netfs/fuse/fuseDirs.cpp b/netfs/fuse/fuseDirs.cpp index d2597f8..a1748d8 100644 --- a/netfs/fuse/fuseDirs.cpp +++ b/netfs/fuse/fuseDirs.cpp @@ -1,4 +1,4 @@ -#include "fuseApp.impl.h" +#include "fuseDirs.h" #include #include diff --git a/netfs/fuse/fuseDirs.h b/netfs/fuse/fuseDirs.h new file mode 100644 index 0000000..55088dd --- /dev/null +++ b/netfs/fuse/fuseDirs.h @@ -0,0 +1,17 @@ +#ifndef NETFS_FUSE_DIRS_H +#define NETFS_FUSE_DIRS_H + +#include "fuseApp.impl.h" + +namespace NetFS { + class FuseApp::OpenDir { + public: + OpenDir(DirectoryPrxPtr remote, std::string path); + + DirectoryPrxPtr remote; + const std::string path; + }; +} + +#endif + diff --git a/netfs/fuse/fuseFiles.h b/netfs/fuse/fuseFiles.h index 5e05ad2..4c9a31a 100644 --- a/netfs/fuse/fuseFiles.h +++ b/netfs/fuse/fuseFiles.h @@ -2,14 +2,30 @@ #define NETFS_FUSE_FILES_H #include "fuseApp.h" +#include namespace NetFS { - class FuseApp::OpenFile::WriteState { + class FuseApp::OpenFile { public: - WriteState(); + OpenFile(FilePrxPtr remote, std::string path, int flags); - std::promise promise; - std::shared_future future; + void flush(); + void wait() const; + + FilePrxPtr remote; + const std::string path; + const int flags; + class WriteState { + public: + WriteState(); + + std::promise promise; + std::shared_future future; + }; + using BGs = boost::icl::interval_map>; + static BGs::interval_type range(off_t, size_t); + BGs bg; + mutable std::shared_mutex _lock; }; } -- cgit v1.2.3