From c8e886549581e02a5cde63ba99dec1a7b06b14a9 Mon Sep 17 00:00:00 2001 From: Antonio SJ Musumeci Date: Mon, 16 May 2022 23:54:48 -0400 Subject: [PATCH] checkpoint --- src/fuse_access_policy_factory.cpp | 2 +- src/fuse_access_policy_factory.hpp | 2 +- src/fuse_chmod_policy_factory.cpp | 2 +- src/fuse_chmod_policy_factory.hpp | 2 +- src/fuse_getattr_policy_factory.cpp | 8 ++++---- src/fuse_getattr_policy_ff.hpp | 4 ++-- src/fuse_link_policy_factory.cpp | 3 ++- src/fuse_removexattr_policy_base.hpp | 2 ++ src/fuse_setxattr_policy_factory.cpp | 4 ++-- src/fuse_symlink_policy_epff.hpp | 12 ++++++------ src/fuse_symlink_policy_factory.cpp | 18 ++++++++++-------- src/fuse_symlink_policy_ff.cpp | 15 +++++---------- src/fuse_symlink_policy_ff.hpp | 12 ++++++------ src/fuse_truncate_policy_all.cpp | 15 +++++---------- src/fuse_unlink_policy_factory.cpp | 12 ++++++------ src/fuse_utimens_policy_all.hpp | 12 ++++++------ src/fuse_utimens_policy_base.hpp | 11 ++++++----- src/fuse_utimens_policy_factory.cpp | 12 ++++++------ src/fuse_utimens_policy_factory.hpp | 8 ++++---- 19 files changed, 76 insertions(+), 80 deletions(-) diff --git a/src/fuse_access_policy_factory.cpp b/src/fuse_access_policy_factory.cpp index 8deda759..d20475d8 100644 --- a/src/fuse_access_policy_factory.cpp +++ b/src/fuse_access_policy_factory.cpp @@ -25,7 +25,7 @@ namespace FUSE::ACCESS::POLICY { Base::Ptr - Factory(const toml::value &toml_) + factory(const toml::value &toml_) { std::string str; diff --git a/src/fuse_access_policy_factory.hpp b/src/fuse_access_policy_factory.hpp index 26c56a0f..679d1e00 100644 --- a/src/fuse_access_policy_factory.hpp +++ b/src/fuse_access_policy_factory.hpp @@ -26,5 +26,5 @@ namespace FUSE::ACCESS::POLICY { Base::Ptr - Factory(const toml::value &); + factory(const toml::value &); } diff --git a/src/fuse_chmod_policy_factory.cpp b/src/fuse_chmod_policy_factory.cpp index cc8835c5..0872f0ef 100644 --- a/src/fuse_chmod_policy_factory.cpp +++ b/src/fuse_chmod_policy_factory.cpp @@ -25,7 +25,7 @@ namespace FUSE::CHMOD::POLICY { Base::Ptr - Factory(const toml::value &toml_) + factory(const toml::value &toml_) { std::string str; diff --git a/src/fuse_chmod_policy_factory.hpp b/src/fuse_chmod_policy_factory.hpp index 55bf376e..4504df9f 100644 --- a/src/fuse_chmod_policy_factory.hpp +++ b/src/fuse_chmod_policy_factory.hpp @@ -26,5 +26,5 @@ namespace FUSE::CHMOD::POLICY { Base::Ptr - Factory(const toml::value &); + factory(const toml::value &); } diff --git a/src/fuse_getattr_policy_factory.cpp b/src/fuse_getattr_policy_factory.cpp index ab52f35f..2986b23a 100644 --- a/src/fuse_getattr_policy_factory.cpp +++ b/src/fuse_getattr_policy_factory.cpp @@ -35,13 +35,13 @@ namespace FUSE::GETATTR::POLICY str = toml::find_or(toml_,"func","getattr","policy","ff"); if(str == "ff") - return std::make_shared(toml_); + return std::make_shared(toml_); if(str == "newest") - return std::make_shared(toml_); + return std::make_shared(toml_); if(str == "aggregate") - return std::make_shared(toml_); + return std::make_shared(toml_); if(str == "check-ff") - return std::make_shared(toml_); + return std::make_shared(toml_); throw std::runtime_error(""); } diff --git a/src/fuse_getattr_policy_ff.hpp b/src/fuse_getattr_policy_ff.hpp index 07baef14..09fd0825 100644 --- a/src/fuse_getattr_policy_ff.hpp +++ b/src/fuse_getattr_policy_ff.hpp @@ -26,12 +26,12 @@ #include "toml.hpp" -namespace FUSE::GETATTR +namespace FUSE::GETATTR::POLICY { class FF : public Base { public: - FF(const toml::value&); + FF(const toml::value &); public: int operator()(const gfs::path &fusepath, diff --git a/src/fuse_link_policy_factory.cpp b/src/fuse_link_policy_factory.cpp index 7cb82d99..0e7c9b58 100644 --- a/src/fuse_link_policy_factory.cpp +++ b/src/fuse_link_policy_factory.cpp @@ -17,7 +17,8 @@ */ #include "fuse_link_policy_factory.hpp" -#include "fuse_link_all_all.hpp" + +#include "fuse_link_policy_all.hpp" #include diff --git a/src/fuse_removexattr_policy_base.hpp b/src/fuse_removexattr_policy_base.hpp index 94d3c165..0c4567fb 100644 --- a/src/fuse_removexattr_policy_base.hpp +++ b/src/fuse_removexattr_policy_base.hpp @@ -18,6 +18,8 @@ #pragma once +#include "fs_path.hpp" + #include diff --git a/src/fuse_setxattr_policy_factory.cpp b/src/fuse_setxattr_policy_factory.cpp index cd16fdf4..0adcc1f9 100644 --- a/src/fuse_setxattr_policy_factory.cpp +++ b/src/fuse_setxattr_policy_factory.cpp @@ -25,13 +25,13 @@ namespace FUSE::SETXATTR { FuncBase::Ptr - FuncFactory(const toml::value &toml_) + factory(const toml::value &toml_) { std::string str; str = toml::find_or(toml_,"func","setxattr","policy","all"); if(str == "all") - return std::make_shared(toml_); + return std::make_shared(toml_); throw std::runtime_error(""); } diff --git a/src/fuse_symlink_policy_epff.hpp b/src/fuse_symlink_policy_epff.hpp index 0e06c89c..347be51d 100644 --- a/src/fuse_symlink_policy_epff.hpp +++ b/src/fuse_symlink_policy_epff.hpp @@ -18,21 +18,21 @@ #pragma once -#include "fuse_symlink_func_base.hpp" +#include "fuse_symlink_policy_base.hpp" #include "branches.hpp" -namespace FUSE::SYMLINK +namespace FUSE::SYMLINK::POLICY { - class FuncEPFF : public FuncBase + class EPFF : public Base { public: - FuncEPFF(const toml::value&); + EPFF(const toml::value &); public: - int operator()(const char *target, - const char *linkpath) final; + int operator()(const gfs::path &target, + const char *linkpath) final; private: Branches2 _branches; diff --git a/src/fuse_symlink_policy_factory.cpp b/src/fuse_symlink_policy_factory.cpp index da4057af..63f4f74b 100644 --- a/src/fuse_symlink_policy_factory.cpp +++ b/src/fuse_symlink_policy_factory.cpp @@ -16,24 +16,26 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "fuse_symlink_func_factory.hpp" -#include "fuse_symlink_func_ff.hpp" -#include "fuse_symlink_func_epff.hpp" +#include "fuse_symlink_policy_factory.hpp" + +#include "fuse_symlink_policy_ff.hpp" +#include "fuse_symlink_policy_epff.hpp" #include -namespace FUSE::SYMLINK + +namespace FUSE::SYMLINK::POLICY { - FuncBase::Ptr - FuncFactory(const toml::value &toml_) + Base::Ptr + factory(const toml::value &toml_) { std::string str; str = toml::find_or(toml_,"func","symlink","policy","ff"); if(str == "ff") - return std::make_shared(toml_); + return std::make_shared(toml_); if(str == "epff") - return std::make_shared(toml_); + return std::make_shared(toml_); throw std::runtime_error(""); } diff --git a/src/fuse_symlink_policy_ff.cpp b/src/fuse_symlink_policy_ff.cpp index b62c70f8..037a4fae 100644 --- a/src/fuse_symlink_policy_ff.cpp +++ b/src/fuse_symlink_policy_ff.cpp @@ -16,7 +16,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "fuse_symlink_func_ff.hpp" +#include "fuse_symlink_policy_ff.hpp" #include "fs_clonepath.hpp" #include "fs_clonepath_branches.hpp" @@ -24,29 +24,24 @@ #include "ugid.hpp" -namespace gfs = ghc::filesystem; - - -FUSE::SYMLINK::FuncFF::FuncFF(const toml::value &toml_) +FUSE::SYMLINK::POLICY::FF::FF(const toml::value &toml_) : _branches(toml_) { } int -FUSE::SYMLINK::FuncFF::operator()(const char *target_, - const char *linkpath_) +FUSE::SYMLINK::POLICY::FF::operator()(const char *target_, + const gfs::path &linkpath_) { int rv; - gfs::path linkpath; gfs::path fullpath; - linkpath = &linkpath_[1]; for(const auto &branch_group : _branches) { for(const auto &branch : branch_group) { - fullpath = branch.path / linkpath; + fullpath = branch.path / linkpath_; rv = fs::symlink(target_,fullpath); if(rv == -ENOENT) diff --git a/src/fuse_symlink_policy_ff.hpp b/src/fuse_symlink_policy_ff.hpp index f33730a2..36efc892 100644 --- a/src/fuse_symlink_policy_ff.hpp +++ b/src/fuse_symlink_policy_ff.hpp @@ -18,21 +18,21 @@ #pragma once -#include "fuse_symlink_func_base.hpp" +#include "fuse_symlink_policy_base.hpp" #include "branches.hpp" -namespace FUSE::SYMLINK +namespace FUSE::SYMLINK::POLICY { - class FuncFF : public FuncBase + class FF : public Base { public: - FuncFF(const toml::value&); + FF(const toml::value &); public: - int operator()(const char *target, - const char *linkpath) final; + int operator()(const gfs::path &target, + const char *linkpath) final; private: Branches2 _branches; diff --git a/src/fuse_truncate_policy_all.cpp b/src/fuse_truncate_policy_all.cpp index db60a0c6..85c7452f 100644 --- a/src/fuse_truncate_policy_all.cpp +++ b/src/fuse_truncate_policy_all.cpp @@ -16,35 +16,30 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "fuse_truncate_func_all.hpp" +#include "fuse_truncate_policy_all.hpp" #include "fuse_truncate_err.hpp" #include "fs_truncate.hpp" -namespace gfs = ghc::filesystem; - - -FUSE::TRUNCATE::FuncALL::FuncALL(const toml::value &toml_) +FUSE::TRUNCATE::POLICY::ALL::ALL(const toml::value &toml_) : _branches(toml_) { } int -FUSE::TRUNCATE::FuncALL::operator()(const char *fusepath_, - const off_t length_) +FUSE::TRUNCATE::POLICY::ALL::operator()(const gfs::path &fusepath_, + const off_t length_) { Err rv; - gfs::path fusepath; gfs::path fullpath; - fusepath = &fusepath_[1]; for(const auto &branch_group : _branches) { for(const auto &branch : branch_group) { - fullpath = branch.path / fusepath; + fullpath = branch.path / fusepath_; rv = fs::truncate(fullpath,length_); } diff --git a/src/fuse_unlink_policy_factory.cpp b/src/fuse_unlink_policy_factory.cpp index 9a2e5083..6b5ae710 100644 --- a/src/fuse_unlink_policy_factory.cpp +++ b/src/fuse_unlink_policy_factory.cpp @@ -16,22 +16,22 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "fuse_unlink_func_factory.hpp" -#include "fuse_unlink_func_all.hpp" +#include "fuse_unlink_policy_factory.hpp" +#include "fuse_unlink_policy_all.hpp" #include -namespace FUSE::UNLINK +namespace FUSE::UNLINK::POLICY { - FuncBase::Ptr - FuncFactory(const toml::value &toml_) + Base::Ptr + factory(const toml::value &toml_) { std::string str; str = toml::find_or(toml_,"func","unlink","policy","all"); if(str == "all") - return std::make_shared(toml_); + return std::make_shared(toml_); throw std::runtime_error(""); } diff --git a/src/fuse_utimens_policy_all.hpp b/src/fuse_utimens_policy_all.hpp index 7707c349..5984e97e 100644 --- a/src/fuse_utimens_policy_all.hpp +++ b/src/fuse_utimens_policy_all.hpp @@ -18,21 +18,21 @@ #pragma once -#include "fuse_utimens_func_base.hpp" +#include "fuse_utimens_policy_base.hpp" #include "branches.hpp" -namespace FUSE::UTIMENS +namespace FUSE::UTIMENS::POLICY { - class FuncALL : public FuncBase + class ALL : public Base { public: - FuncALL(const toml::value &); + ALL(const toml::value &); public: - int operator()(const char *fusepath, - const timespec ts[2]) final; + int operator()(const gfs::path &fusepath, + const timespec ts[2]) final; private: Branches2 _branches; diff --git a/src/fuse_utimens_policy_base.hpp b/src/fuse_utimens_policy_base.hpp index 069be495..8606b4fb 100644 --- a/src/fuse_utimens_policy_base.hpp +++ b/src/fuse_utimens_policy_base.hpp @@ -18,19 +18,20 @@ #pragma once +#include "fs_path.hpp" #include -namespace FUSE::UTIMENS +namespace FUSE::UTIMENS::POLICY { - class FuncBase + class Base { public: - typedef std::shared_ptr Ptr; + typedef std::shared_ptr Ptr; public: - virtual int operator()(const char *fusepath, - const timespec ts[2]) = 0; + virtual int operator()(const gfs::path &fusepath, + const timespec ts[2]) = 0; }; } diff --git a/src/fuse_utimens_policy_factory.cpp b/src/fuse_utimens_policy_factory.cpp index f60cfde4..7a42487f 100644 --- a/src/fuse_utimens_policy_factory.cpp +++ b/src/fuse_utimens_policy_factory.cpp @@ -16,22 +16,22 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "fuse_utimens_func_factory.hpp" -#include "fuse_utimens_func_all.hpp" +#include "fuse_utimens_policy_factory.hpp" +#include "fuse_utimens_policy_all.hpp" #include -namespace FUSE::UTIMENS +namespace FUSE::UTIMENS::POLICY { - FuncBase::Ptr - FuncFactory(const toml::value &toml_) + Base::Ptr + factory(const toml::value &toml_) { std::string str; str = toml::find_or(toml_,"func","utimens","policy","all"); if(str == "all") - return std::make_shared(toml_); + return std::make_shared(toml_); throw std::runtime_error(""); } diff --git a/src/fuse_utimens_policy_factory.hpp b/src/fuse_utimens_policy_factory.hpp index 327ba7ce..eab39d5d 100644 --- a/src/fuse_utimens_policy_factory.hpp +++ b/src/fuse_utimens_policy_factory.hpp @@ -18,13 +18,13 @@ #pragma once -#include "fuse_utimens_func_base.hpp" +#include "fuse_utimens_policy_base.hpp" #include "toml.hpp" -namespace FUSE::UTIMENS +namespace FUSE::UTIMENS::POLICY { - FuncBase::Ptr - FuncFactory(const toml::value &); + Base::Ptr + factory(const toml::value &); }