diff --git a/src/fuse_access_func.cpp b/src/fuse_access_func.cpp deleted file mode 100644 index 04ce271e..00000000 --- a/src/fuse_access_func.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_access_func.hpp" -#include "fuse_access_func_factory.hpp" - -#include "toml.hpp" - - -FUSE::ACCESS::Func::Func(const toml::value &toml_) -{ - _access = FuncFactory(toml_); -} - -int -FUSE::ACCESS::Func::operator()(const gfs::path &fusepath_, - const int mask_) -{ - return (*_access)(fusepath_,mask_); -} diff --git a/src/fuse_access_func.hpp b/src/fuse_access_func.hpp deleted file mode 100644 index 66403dd6..00000000 --- a/src/fuse_access_func.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_access_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::ACCESS -{ - class Func - { - public: - Func(const toml::value &); - - public: - int operator()(const gfs::path &fusepath, - const int mask); - - private: - FuncBase::Ptr _access; - }; -} diff --git a/src/fuse_access_func_base.hpp b/src/fuse_access_func_base.hpp deleted file mode 100644 index 096aed08..00000000 --- a/src/fuse_access_func_base.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fs_path.hpp" - -#include - - -namespace FUSE::ACCESS -{ - class FuncBase - { - public: - typedef std::shared_ptr Ptr; - - public: - virtual int operator()(const gfs::path &fusepath, - const int mask) = 0; - }; -} diff --git a/src/fuse_access_func_factory.cpp b/src/fuse_access_func_factory.cpp deleted file mode 100644 index 42ed2f69..00000000 --- a/src/fuse_access_func_factory.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_access_func_factory.hpp" -#include "fuse_access_func_ff.hpp" - -#include - -namespace FUSE::ACCESS -{ - FuncBase::Ptr - FuncFactory(const toml::value &toml_) - { - std::string str; - - str = toml::find_or(toml_,"func","access","policy","ff"); - if(str == "ff") - return std::make_shared(toml_); - - throw std::runtime_error(""); - } -} diff --git a/src/fuse_access_func_factory.hpp b/src/fuse_access_func_factory.hpp deleted file mode 100644 index 723576cb..00000000 --- a/src/fuse_access_func_factory.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_access_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::ACCESS -{ - FuncBase::Ptr - FuncFactory(const toml::value &); -} diff --git a/src/fuse_access_func_ff.cpp b/src/fuse_access_func_ff.cpp deleted file mode 100644 index ff85a5e9..00000000 --- a/src/fuse_access_func_ff.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_access_func_ff.hpp" - -#include "fs_eaccess.hpp" - - -FUSE::ACCESS::FuncFF::FuncFF(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::ACCESS::FuncFF::operator()(const gfs::path &fusepath_, - const int mode_) -{ - int rv; - gfs::path fullpath; - - for(const auto &branch_group : _branches) - { - for(const auto &branch : branch_group) - { - fullpath = branch.path / fusepath_; - - rv = fs::eaccess(fullpath,mode_); - if(rv != 0) - continue; - - return 0; - } - } - - return -errno; -} diff --git a/src/fuse_access_func_ff.hpp b/src/fuse_access_func_ff.hpp deleted file mode 100644 index cab1af52..00000000 --- a/src/fuse_access_func_ff.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_access_func_base.hpp" - -#include "branches.hpp" - - -namespace FUSE::ACCESS -{ - class FuncFF : public FuncBase - { - public: - FuncFF(const toml::value&); - - public: - int operator()(const gfs::path &fusepath, - const int mode) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_chmod_func.cpp b/src/fuse_chmod_func.cpp deleted file mode 100644 index 37a59ec1..00000000 --- a/src/fuse_chmod_func.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_chmod_func.hpp" -#include "fuse_chmod_func_factory.hpp" - -#include "toml.hpp" - - -FUSE::CHMOD::Func::Func(const toml::value &toml_) -{ - _chmod = FuncFactory(toml_); -} - -int -FUSE::CHMOD::Func::operator()(const gfs::path &fusepath_, - const mode_t mode_) -{ - return (*_chmod)(fusepath_,mode_); -} diff --git a/src/fuse_chmod_func.hpp b/src/fuse_chmod_func.hpp deleted file mode 100644 index 30f405ca..00000000 --- a/src/fuse_chmod_func.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_chmod_func_base.hpp" - -#include "toml.hpp" - -#include - - -namespace FUSE::CHMOD -{ - class Func - { - public: - Func(const toml::value &); - - public: - int operator()(const gfs::path &fusepath, - const mode_t mode); - - private: - FuncBase::Ptr _chmod; - }; -} diff --git a/src/fuse_chmod_func_all.cpp b/src/fuse_chmod_func_all.cpp deleted file mode 100644 index d38936b9..00000000 --- a/src/fuse_chmod_func_all.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_chmod_func_all.hpp" -#include "fuse_chmod_err.hpp" - -#include "fs_lchmod.hpp" - - -FUSE::CHMOD::FuncALL::FuncALL(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::CHMOD::FuncALL::operator()(const gfs::path &fusepath_, - const mode_t mode_) -{ - Err rv; - gfs::path fullpath; - - for(const auto &branch_group : _branches) - { - for(const auto &branch : branch_group) - { - fullpath = branch.path / fusepath_; - - rv = fs::lchmod(fullpath,mode_); - } - } - - return rv; -} diff --git a/src/fuse_chmod_func_all.hpp b/src/fuse_chmod_func_all.hpp deleted file mode 100644 index 4a910e95..00000000 --- a/src/fuse_chmod_func_all.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_chmod_func_base.hpp" - -#include "branches.hpp" - - -namespace FUSE::CHMOD -{ - class FuncALL : public FuncBase - { - public: - FuncALL(const toml::value &); - - public: - int operator()(const gfs::path &fusepath, - const mode_t mode) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_chmod_func_base.hpp b/src/fuse_chmod_func_base.hpp deleted file mode 100644 index 1e711d98..00000000 --- a/src/fuse_chmod_func_base.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fs_path.hpp" - -#include - - -namespace FUSE::CHMOD -{ - class FuncBase - { - public: - typedef std::shared_ptr Ptr; - - public: - virtual int operator()(const gfs::path &fusepath, - const mode_t mode) = 0; - }; -} diff --git a/src/fuse_chmod_func_factory.cpp b/src/fuse_chmod_func_factory.cpp deleted file mode 100644 index a5f1ee4d..00000000 --- a/src/fuse_chmod_func_factory.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_chmod_func_factory.hpp" -#include "fuse_chmod_func_all.hpp" - -#include - - -namespace FUSE::CHMOD -{ - FuncBase::Ptr - FuncFactory(const toml::value &toml_) - { - std::string str; - - str = toml::find_or(toml_,"func","chmod","policy","all"); - if(str == "all") - return std::make_shared(toml_); - - throw std::runtime_error(""); - } -} diff --git a/src/fuse_chmod_func_factory.hpp b/src/fuse_chmod_func_factory.hpp deleted file mode 100644 index 7f02193e..00000000 --- a/src/fuse_chmod_func_factory.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_chmod_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::CHMOD -{ - FuncBase::Ptr - FuncFactory(const toml::value &); -} diff --git a/src/fuse_chown_func.cpp b/src/fuse_chown_func.cpp deleted file mode 100644 index 5e38638e..00000000 --- a/src/fuse_chown_func.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_chown_func.hpp" -#include "fuse_chown_func_factory.hpp" - -#include "toml.hpp" - - -FUSE::CHOWN::Func::Func(const toml::value &toml_) -{ - _chown = FuncFactory(toml_); -} - -int -FUSE::CHOWN::Func::operator()(const gfs::path &fusepath_, - const uid_t uid_, - const gid_t gid_) -{ - return (*_chown)(fusepath_,uid_,gid_); -} diff --git a/src/fuse_chown_func.hpp b/src/fuse_chown_func.hpp deleted file mode 100644 index ae8c37fd..00000000 --- a/src/fuse_chown_func.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_chown_func_base.hpp" - -#include "toml.hpp" - -#include - - -namespace FUSE::CHOWN -{ - class Func - { - public: - Func(const toml::value &); - - public: - int operator()(const gfs::path &fusepath, - const uid_t uid, - const gid_t gid); - - private: - FuncBase::Ptr _chown; - }; -} diff --git a/src/fuse_chown_func_all.cpp b/src/fuse_chown_func_all.cpp deleted file mode 100644 index 25151e69..00000000 --- a/src/fuse_chown_func_all.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_chown_func_all.hpp" -#include "fuse_chown_err.hpp" - -#include "fs_lchown.hpp" - - -FUSE::CHOWN::FuncALL::FuncALL(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::CHOWN::FuncALL::operator()(const gfs::path &fusepath_, - const uid_t uid_, - const gid_t gid_) -{ - Err rv; - gfs::path fusepath; - gfs::path fullpath; - - for(const auto &branch_group : _branches) - { - for(const auto &branch : branch_group) - { - fullpath = branch.path / fusepath_; - - rv = fs::lchown(fullpath,uid_,gid_); - } - } - - return rv; -} diff --git a/src/fuse_chown_func_all.hpp b/src/fuse_chown_func_all.hpp deleted file mode 100644 index 61dce75c..00000000 --- a/src/fuse_chown_func_all.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_chown_func_base.hpp" - -#include "branches.hpp" - - -namespace FUSE::CHOWN -{ - class FuncALL : public FuncBase - { - public: - FuncALL(const toml::value &); - - public: - int operator()(const gfs::path &fusepath, - const uid_t uid, - const gid_t gid) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_chown_func_base.hpp b/src/fuse_chown_func_base.hpp deleted file mode 100644 index 7f54d19e..00000000 --- a/src/fuse_chown_func_base.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fs_path.hpp" - -#include - -#include - - -namespace FUSE::CHOWN -{ - class FuncBase - { - public: - typedef std::shared_ptr Ptr; - - public: - virtual int operator()(const gfs::path &fusepath, - const uid_t uid, - const gid_t gid) = 0; - }; -} diff --git a/src/fuse_chown_func_factory.cpp b/src/fuse_chown_func_factory.cpp deleted file mode 100644 index 732771c5..00000000 --- a/src/fuse_chown_func_factory.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_chown_func_factory.hpp" -#include "fuse_chown_func_all.hpp" - -#include - - -namespace FUSE::CHOWN -{ - FuncBase::Ptr - FuncFactory(const toml::value &toml_) - { - std::string str; - - str = toml::find_or(toml_,"func","chown","policy","all"); - if(str == "all") - return std::make_shared(toml_); - - throw std::runtime_error(""); - } -} diff --git a/src/fuse_chown_func_factory.hpp b/src/fuse_chown_func_factory.hpp deleted file mode 100644 index df29da77..00000000 --- a/src/fuse_chown_func_factory.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_chown_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::CHOWN -{ - FuncBase::Ptr - FuncFactory(const toml::value &); -} diff --git a/src/fuse_create_func.cpp b/src/fuse_create_func.cpp deleted file mode 100644 index 18d51975..00000000 --- a/src/fuse_create_func.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_create_func.hpp" -#include "fuse_create_func_factory.hpp" - -#include "toml.hpp" - - -FUSE::CREATE::Func::Func(const toml::value &toml_) -{ - _create = FuncFactory(toml_); -} - -int -FUSE::CREATE::Func::operator()(const gfs::path &fusepath_, - const mode_t mode_, - const mode_t umask_, - fuse_file_info_t *ffi_) -{ - return (*_create)(fusepath_,mode_,umask_,ffi_); -} diff --git a/src/fuse_create_func.hpp b/src/fuse_create_func.hpp deleted file mode 100644 index 7a70403d..00000000 --- a/src/fuse_create_func.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_create_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::CREATE -{ - class Func - { - public: - Func(const toml::value &); - - public: - int operator()(const gfs::path &fusepath, - const mode_t mode, - const mode_t umask, - fuse_file_info_t *ffi); - - private: - FuncBase::Ptr _create; - }; -} diff --git a/src/fuse_create_func_base.hpp b/src/fuse_create_func_base.hpp deleted file mode 100644 index 624a0d2a..00000000 --- a/src/fuse_create_func_base.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fs_path.hpp" - -#include "fuse.h" - -#include - - -namespace FUSE::CREATE -{ - class FuncBase - { - public: - typedef std::shared_ptr Ptr; - - public: - virtual int operator()(const gfs::path &fusepath, - const mode_t mode, - const mode_t umask, - fuse_file_info_t *ffi) = 0; - }; -} diff --git a/src/fuse_create_func_epff.cpp b/src/fuse_create_func_epff.cpp deleted file mode 100644 index 186878a0..00000000 --- a/src/fuse_create_func_epff.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_create_func_epff.hpp" - -#include "fileinfo.hpp" -#include "fs_acl.hpp" -#include "fs_open.hpp" - - -FUSE::CREATE::FuncEPFF::FuncEPFF(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::CREATE::FuncEPFF::operator()(const gfs::path &fusepath_, - const mode_t mode_, - const mode_t umask_, - fuse_file_info_t *ffi_) -{ - int rv; - mode_t mode; - gfs::path fullpath; - - mode = mode_; - for(const auto &branch_group : _branches) - { - for(const auto &branch : branch_group) - { - fullpath = branch.path / fusepath_; - - rv = fs::acl::dir_has_defaults(fullpath); - if(rv == -ENOENT) - continue; - if(rv >= 0) - mode &= umask_; - - rv = fs::open(fullpath,ffi_->flags,mode); - if(rv == -ENOENT) - continue; - if(rv < 0) - return rv; - - ffi_->fh = reinterpret_cast(new FileInfo(rv,fusepath_)); - - return 0; - } - } - - return -ENOENT; -} diff --git a/src/fuse_create_func_epff.hpp b/src/fuse_create_func_epff.hpp deleted file mode 100644 index 628cdb50..00000000 --- a/src/fuse_create_func_epff.hpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_create_func_base.hpp" - -#include "branches.hpp" - -#include "fs_path.hpp" - - -namespace FUSE::CREATE -{ - class FuncEPFF : public FuncBase - { - public: - FuncEPFF(const toml::value&); - - public: - int operator()(const gfs::path &fusepath, - const mode_t mode, - const mode_t umask, - fuse_file_info_t *ffi) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_create_func_factory.cpp b/src/fuse_create_func_factory.cpp deleted file mode 100644 index 34b3f434..00000000 --- a/src/fuse_create_func_factory.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_create_func_factory.hpp" -#include "fuse_create_func_ff.hpp" -#include "fuse_create_func_epff.hpp" - -#include - -namespace FUSE::CREATE -{ - FuncBase::Ptr - FuncFactory(const toml::value &toml_) - { - std::string str; - - str = toml::find_or(toml_,"func","create","policy","ff"); - if(str == "ff") - return std::make_shared(toml_); - if(str == "epff") - return std::make_shared(toml_); - - throw std::runtime_error(""); - } -} diff --git a/src/fuse_create_func_factory.hpp b/src/fuse_create_func_factory.hpp deleted file mode 100644 index 98ad0db5..00000000 --- a/src/fuse_create_func_factory.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_create_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::CREATE -{ - FuncBase::Ptr - FuncFactory(const toml::value &); -} diff --git a/src/fuse_create_func_ff.cpp b/src/fuse_create_func_ff.cpp deleted file mode 100644 index 1606f410..00000000 --- a/src/fuse_create_func_ff.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_create_func_ff.hpp" - -#include "fileinfo.hpp" -#include "fs_acl.hpp" -#include "fs_clonepath.hpp" -#include "fs_clonepath_branches.hpp" -#include "fs_open.hpp" -#include "ugid.hpp" - - -namespace gfs = ghc::filesystem; - - -FUSE::CREATE::FuncFF::FuncFF(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::CREATE::FuncFF::operator()(const gfs::path &fusepath_, - const mode_t mode_, - const mode_t umask_, - fuse_file_info_t *ffi_) -{ - int rv; - mode_t mode; - gfs::path fullpath; - - mode = mode_; - for(const auto &branch_group : _branches) - { - for(const auto &branch : branch_group) - { - fullpath = branch.path / fusepath_; - - rv = fs::acl::dir_has_defaults(fullpath); - if(rv == -ENOENT) - { - rv = fs::clonepath_as_root(_branches,branch.path,fusepath_); - if(rv >= 0) - rv = fs::acl::dir_has_defaults(fullpath); - } - - if(rv >= 0) - mode &= ~umask_; - - rv = fs::open(fullpath,ffi_->flags,mode); - if(rv == -ENOENT) - { - rv = fs::clonepath_as_root(_branches,branch.path,fusepath_); - if(rv >= 0) - { - rv = fs::acl::dir_has_defaults(fullpath); - if(rv >= 0) - mode &= ~umask_; - rv = fs::open(fullpath,ffi_->flags,mode); - } - } - - if(rv < 0) - return rv; - - ffi_->fh = reinterpret_cast(new FileInfo(rv,fusepath_)); - - return 0; - } - } - - return -ENOENT; -} diff --git a/src/fuse_create_func_ff.hpp b/src/fuse_create_func_ff.hpp deleted file mode 100644 index c8f780f9..00000000 --- a/src/fuse_create_func_ff.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_create_func_base.hpp" - -#include "branches.hpp" - - -namespace FUSE::CREATE -{ - class FuncFF : public FuncBase - { - public: - FuncFF(const toml::value&); - - public: - int operator()(const gfs::path &fusepath, - const mode_t mode, - const mode_t umask, - fuse_file_info_t *ffi) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_getattr_func.hpp b/src/fuse_getattr_func.hpp index 4017a5bd..b5e4d0b1 100644 --- a/src/fuse_getattr_func.hpp +++ b/src/fuse_getattr_func.hpp @@ -27,6 +27,7 @@ #include + namespace FUSE::GETATTR { class Func diff --git a/src/fuse_getattr_func_aggregate.cpp b/src/fuse_getattr_func_aggregate.cpp deleted file mode 100644 index a880ac2f..00000000 --- a/src/fuse_getattr_func_aggregate.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_getattr_func_aggregate.hpp" - -#include "timespec.hpp" - -#include - - -namespace gfs = ghc::filesystem; - - -FUSE::GETATTR::FuncAggregate::FuncAggregate(const toml::value &toml_) - : _branches(toml_) -{ - Stat::Func statfunc = Stat::no_follow; - - _statfunc = toml::find_or(toml_,"func","getattr","follow-symlinks",statfunc); -} - -int -FUSE::GETATTR::FuncAggregate::operator()(const gfs::path &fusepath_, - struct stat *st_, - fuse_timeouts_t *timeout_) -{ - int rv; - gfs::path fullpath; - struct stat st = {0}; - - st_->st_mtime = std::numeric_limits::min(); - for(const auto &branch_group : _branches) - { - for(const auto &branch : branch_group) - { - fullpath = branch.path / fusepath_; - - rv = _statfunc(fullpath,&st); - if(rv != 0) - continue; - - if(st_->st_mtime == std::numeric_limits::min()) - { - *st_ = st; - } - else - { - st_->st_nlink += st.st_nlink; - if(st_->st_atim < st.st_atim) - st_->st_atim = st.st_atim; - if(st_->st_mtim < st.st_mtim) - st_->st_mtim = st.st_mtim; - if(st_->st_ctim < st.st_ctim) - st_->st_ctim = st.st_ctim; - } - } - } - - if(st_->st_mtime == std::numeric_limits::min()) - return -ENOENT; - - return 0; -} diff --git a/src/fuse_getattr_func_aggregate.hpp b/src/fuse_getattr_func_aggregate.hpp deleted file mode 100644 index 4f0e395c..00000000 --- a/src/fuse_getattr_func_aggregate.hpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_getattr_func_base.hpp" - -#include "branches.hpp" -#include "stat_func.hpp" - -#include "toml.hpp" - -namespace FUSE::GETATTR -{ - class FuncAggregate : public FuncBase - { - public: - FuncAggregate(const toml::value&); - - public: - int operator()(const gfs::path &fusepath, - struct stat *st, - fuse_timeouts_t *timeout) final; - - private: - Stat::Func _statfunc; - Branches2 _branches; - }; -} diff --git a/src/fuse_getattr_func_check_ff.cpp b/src/fuse_getattr_func_check_ff.cpp deleted file mode 100644 index afd5cf81..00000000 --- a/src/fuse_getattr_func_check_ff.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_getattr_func_check_ff.hpp" - -#include - - -namespace gfs = ghc::filesystem; - - -namespace l -{ - static - void - alert(const gfs::path &fullpath_, - const char *attr_, - const uint64_t val1_, - const uint64_t val2_) - { - fprintf(stderr, - "%s: %s - %lx != %lx", - fullpath_.c_str(), - attr_, - val1_, - val2_); - } -} - -FUSE::GETATTR::FuncCheckFF::FuncCheckFF(const toml::value &toml_) - : _branches(toml_) -{ - Stat::Func statfunc = Stat::no_follow; - - _statfunc = toml::find_or(toml_,"func","getattr","follow-symlinks",statfunc); -} - -int -FUSE::GETATTR::FuncCheckFF::operator()(const gfs::path &fusepath_, - struct stat *st_, - fuse_timeouts_t *timeout_) -{ - int rv; - size_t i, ei; - size_t j, ej; - gfs::path fullpath; - struct stat st = {0}; - - for(i = 0, ei = _branches.size(); i < ei; i++) - { - for(j = 0, ej = _branches[i].size(); j < ej; j++) - { - fullpath = _branches[i][j].path / fusepath_; - - rv = _statfunc(fullpath,&st); - if(rv != 0) - continue; - - j++; - *st_ = st; - goto main_loop; - } - } - - main_loop: - for(; i < ei; i++) - { - for(; j < ej; j++) - { - fullpath = _branches[i][j].path / fusepath_; - - rv = _statfunc(fullpath,&st); - if(rv != 0) - continue; - - if(st.st_mode != st_->st_mode) - l::alert(fullpath,"mode",st_->st_mode,st.st_mode); - } - } - - - return 0; -} diff --git a/src/fuse_getattr_func_check_ff.hpp b/src/fuse_getattr_func_check_ff.hpp deleted file mode 100644 index 21a27664..00000000 --- a/src/fuse_getattr_func_check_ff.hpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_getattr_func_base.hpp" - -#include "branches.hpp" -#include "stat_func.hpp" - -#include "toml.hpp" - -namespace FUSE::GETATTR -{ - class FuncCheckFF : public FuncBase - { - public: - FuncCheckFF(const toml::value&); - - public: - int operator()(const gfs::path &fusepath, - struct stat *st, - fuse_timeouts_t *timeout) final; - - private: - Stat::Func _statfunc; - Branches2 _branches; - }; -} diff --git a/src/fuse_getattr_func_factory.cpp b/src/fuse_getattr_func_factory.cpp deleted file mode 100644 index ae613c53..00000000 --- a/src/fuse_getattr_func_factory.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_getattr_func_factory.hpp" - -#include "fuse_getattr_func_base.hpp" -#include "fuse_getattr_func_ff.hpp" -#include "fuse_getattr_func_newest.hpp" -#include "fuse_getattr_func_aggregate.hpp" -#include "fuse_getattr_func_check_ff.hpp" - -#include - -namespace FUSE::GETATTR -{ - FuncBase::Ptr - FuncFactory(const toml::value &toml_) - { - std::string str; - - str = toml::find_or(toml_,"func","getattr","policy","ff"); - if(str == "ff") - return std::make_shared(toml_); - if(str == "newest") - return std::make_shared(toml_); - if(str == "aggregate") - return std::make_shared(toml_); - if(str == "check-ff") - return std::make_shared(toml_); - - throw std::runtime_error(""); - } -} diff --git a/src/fuse_getattr_func_factory.hpp b/src/fuse_getattr_func_factory.hpp deleted file mode 100644 index 11d97797..00000000 --- a/src/fuse_getattr_func_factory.hpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_getattr_func_base.hpp" - -#include "toml.hpp" - -namespace FUSE::GETATTR -{ - FuncBase::Ptr - FuncFactory(const toml::value &); -} diff --git a/src/fuse_getattr_func_ff.cpp b/src/fuse_getattr_func_ff.cpp deleted file mode 100644 index 03f67fef..00000000 --- a/src/fuse_getattr_func_ff.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_getattr_func_ff.hpp" - - -namespace gfs = ghc::filesystem; - - -FUSE::GETATTR::FuncFF::FuncFF(const toml::value &toml_) - : _branches(toml_) -{ - Stat::Func statfunc = Stat::no_follow; - - _statfunc = toml::find_or(toml_,"func","getattr","follow-symlinks",statfunc); -} - -int -FUSE::GETATTR::FuncFF::operator()(const gfs::path &fusepath_, - struct stat *st_, - fuse_timeouts_t *timeout_) -{ - int rv; - gfs::path fullpath; - - for(const auto &branch_group : _branches) - { - for(const auto &branch : branch_group) - { - fullpath = branch.path / fusepath_; - - rv = _statfunc(fullpath,st_); - if(rv == -ENOENT) - continue; - - return rv; - } - } - - return -ENOENT; -} diff --git a/src/fuse_getattr_func_ff.hpp b/src/fuse_getattr_func_ff.hpp deleted file mode 100644 index ec4abcd7..00000000 --- a/src/fuse_getattr_func_ff.hpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_getattr_func.hpp" - -#include "branches.hpp" -#include "stat_func.hpp" - -#include "toml.hpp" - -namespace FUSE::GETATTR -{ - class FuncFF : public FuncBase - { - public: - FuncFF(const toml::value&); - - public: - int operator()(const gfs::path &fusepath, - struct stat *st, - fuse_timeouts_t *timeout) final; - - private: - Stat::Func _statfunc; - Branches2 _branches; - }; -} diff --git a/src/fuse_getattr_func_newest.cpp b/src/fuse_getattr_func_newest.cpp deleted file mode 100644 index 311c6520..00000000 --- a/src/fuse_getattr_func_newest.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_getattr_func_newest.hpp" - -#include - - -namespace gfs = ghc::filesystem; - - -FUSE::GETATTR::FuncNewest::FuncNewest(const toml::value &toml_) - : _branches(toml_) -{ - Stat::Func statfunc = Stat::no_follow; - - _statfunc = toml::find_or(toml_,"func","getattr","follow-symlinks",statfunc); -} - -int -FUSE::GETATTR::FuncNewest::operator()(const gfs::path &fusepath_, - struct stat *st_, - fuse_timeouts_t *timeout_) -{ - int rv; - struct stat st; - gfs::path fullpath; - - st_->st_mtime = std::numeric_limits::min(); - for(const auto &branch_group : _branches) - { - for(const auto &branch : branch_group) - { - fullpath = branch.path / fusepath_; - - rv = _statfunc(fullpath,&st); - if(rv != 0) - continue; - if(st_->st_mtime < st.st_mtime) - continue; - - *st_ = st; - } - } - - if(st_->st_mtime == std::numeric_limits::min()) - return -ENOENT; - - return 0; -} diff --git a/src/fuse_getattr_func_newest.hpp b/src/fuse_getattr_func_newest.hpp deleted file mode 100644 index ea029b5a..00000000 --- a/src/fuse_getattr_func_newest.hpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_getattr_func_base.hpp" - -#include "branches.hpp" -#include "stat_func.hpp" - -#include "toml.hpp" - -namespace FUSE::GETATTR -{ - class FuncNewest : public FuncBase - { - public: - FuncNewest(const toml::value&); - - public: - int operator()(const gfs::path &fusepath, - struct stat *st, - fuse_timeouts_t *timeout) final; - - private: - Stat::Func _statfunc; - Branches2 _branches; - }; -} diff --git a/src/fuse_getxattr_func.cpp b/src/fuse_getxattr_func.cpp deleted file mode 100644 index 26ac876b..00000000 --- a/src/fuse_getxattr_func.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_getxattr_func.hpp" -#include "fuse_getxattr_func_factory.hpp" - -#include "state.hpp" - - -FUSE::GETXATTR::Func::Func(const toml::value &toml_) -{ - _getxattr = FuncFactory(toml_); -} - -int -FUSE::GETXATTR::Func::operator()(const gfs::path &fusepath_, - const char *attrname_, - char *buf_, - size_t count_) -{ - return (*_getxattr)(fusepath_,attrname_,buf_,count_); -} diff --git a/src/fuse_getxattr_func.hpp b/src/fuse_getxattr_func.hpp deleted file mode 100644 index fad00fb4..00000000 --- a/src/fuse_getxattr_func.hpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_getxattr_func_base.hpp" - -#include "fuse_timeouts.h" - -#include "toml.hpp" - -#include - -#include - -namespace FUSE::GETXATTR -{ - class Func - { - public: - Func(const toml::value &); - - public: - int operator()(const gfs::path &fusepath, - const char *attrname, - char *buf, - size_t count); - - private: - FuncBase::Ptr _getxattr; - }; -} diff --git a/src/fuse_getxattr_func_base.hpp b/src/fuse_getxattr_func_base.hpp deleted file mode 100644 index cf94f41c..00000000 --- a/src/fuse_getxattr_func_base.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fs_path.hpp" - -#include - -#include - -namespace FUSE::GETXATTR -{ - class FuncBase - { - public: - typedef std::shared_ptr Ptr; - - public: - virtual int operator()(const gfs::path &fusepath, - const char *attrname, - char *buf, - size_t count) = 0; - }; -} diff --git a/src/fuse_getxattr_func_factory.cpp b/src/fuse_getxattr_func_factory.cpp deleted file mode 100644 index 92c65ffd..00000000 --- a/src/fuse_getxattr_func_factory.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_getxattr_func_factory.hpp" - -#include "fuse_getxattr_func_ff.hpp" - -#include - -namespace FUSE::GETXATTR -{ - FuncBase::Ptr - FuncFactory(const toml::value &toml_) - { - std::string str; - - str = toml::find_or(toml_,"func","getxattr","policy","ff"); - if(str == "ff") - return std::make_shared(toml_); - - throw std::runtime_error(""); - } -} diff --git a/src/fuse_getxattr_func_factory.hpp b/src/fuse_getxattr_func_factory.hpp deleted file mode 100644 index d4b61166..00000000 --- a/src/fuse_getxattr_func_factory.hpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_getxattr_func_base.hpp" - -#include "toml.hpp" - -namespace FUSE::GETXATTR -{ - FuncBase::Ptr - FuncFactory(const toml::value &); -} diff --git a/src/fuse_getxattr_func_ff.cpp b/src/fuse_getxattr_func_ff.cpp deleted file mode 100644 index 6d9de780..00000000 --- a/src/fuse_getxattr_func_ff.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_getxattr_func_ff.hpp" - -#include "fs_lgetxattr.hpp" - - -namespace gfs = ghc::filesystem; - - -FUSE::GETXATTR::FuncFF::FuncFF(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::GETXATTR::FuncFF::operator()(const gfs::path &fusepath_, - const char *attrname_, - char *buf_, - size_t count_) -{ - int rv; - gfs::path fullpath; - - for(const auto &branch_group : _branches) - { - for(const auto &branch : branch_group) - { - fullpath = branch.path / fusepath_; - - rv = fs::lgetxattr(fullpath,attrname_,buf_,count_); - if(rv == -ENOENT) - continue; - - return rv; - } - } - - return -ENOENT; -} diff --git a/src/fuse_getxattr_func_ff.hpp b/src/fuse_getxattr_func_ff.hpp deleted file mode 100644 index 1ae03be0..00000000 --- a/src/fuse_getxattr_func_ff.hpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_getxattr_func.hpp" - -#include "branches.hpp" -#include "stat_func.hpp" - -#include "toml.hpp" - -namespace FUSE::GETXATTR -{ - class FuncFF : public FuncBase - { - public: - FuncFF(const toml::value&); - - public: - int operator()(const gfs::path &fusepath, - const char *attrname, - char *buf, - size_t count) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_ioctl_func.cpp b/src/fuse_ioctl_func.cpp deleted file mode 100644 index 9baf6e48..00000000 --- a/src/fuse_ioctl_func.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_ioctl_func.hpp" -#include "fuse_ioctl_func_factory.hpp" - -#include "toml.hpp" - - -FUSE::IOCTL::Func::Func(const toml::value &toml_) -{ - _ioctl = FuncFactory(toml_); -} - -int -FUSE::IOCTL::Func::operator()(const fuse_file_info_t *ffi_, - const unsigned long cmd_, - const unsigned int flags_, - void *data_, - uint32_t *out_bufsz_) -{ - return (*_ioctl)(ffi_,cmd_,flags_,data_,out_bufsz_); -} diff --git a/src/fuse_ioctl_func.hpp b/src/fuse_ioctl_func.hpp deleted file mode 100644 index de9ef91a..00000000 --- a/src/fuse_ioctl_func.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_ioctl_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::IOCTL -{ - class Func - { - public: - Func(const toml::value &); - - public: - int operator()(const fuse_file_info_t *ffi_, - const unsigned long cmd, - const unsigned int flags, - void *data, - uint32_t *out_bufsz); - - private: - FuncBase::Ptr _ioctl; - }; -} diff --git a/src/fuse_ioctl_func_all.cpp b/src/fuse_ioctl_func_all.cpp deleted file mode 100644 index 577c4838..00000000 --- a/src/fuse_ioctl_func_all.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_ioctl_func_all.hpp" -#include "fuse_ioctl_err.hpp" - -#include "fs_ioctl.hpp" - - -namespace gfs = ghc::filesystem; - - -FUSE::IOCTL::FuncALL::FuncALL(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::IOCTL::FuncALL::operator()(const fuse_file_info_t *ffi_, - const unsigned long cmd_, - const unsigned int flags_, - void *data_, - uint32_t *out_bufsz_) -{ - Err rv; - gfs::path fusepath; - gfs::path fullpath; - - for(const auto &branch_group : _branches) - { - for(const auto &branch : branch_group) - { - fullpath = branch.path / fusepath; - - } - } - - return rv; -} diff --git a/src/fuse_ioctl_func_all.hpp b/src/fuse_ioctl_func_all.hpp deleted file mode 100644 index 2a664ef4..00000000 --- a/src/fuse_ioctl_func_all.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_ioctl_func_base.hpp" - -#include "branches.hpp" - - -namespace FUSE::IOCTL -{ - class FuncALL : public FuncBase - { - public: - FuncALL(const toml::value &); - - public: - int operator()(const fuse_file_info_t *ffi, - const unsigned long cmd, - const unsigned int flags, - void *data, - uint32_t *out_bufsz) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_ioctl_func_base.hpp b/src/fuse_ioctl_func_base.hpp deleted file mode 100644 index d40d9e90..00000000 --- a/src/fuse_ioctl_func_base.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse.h" - -#include - - -namespace FUSE::IOCTL -{ - class FuncBase - { - public: - typedef std::shared_ptr Ptr; - - public: - virtual int operator()(const fuse_file_info_t *ffi, - const unsigned long cmd, - const unsigned int flags, - void *data, - uint32_t *out_bufsz) = 0; - }; -} diff --git a/src/fuse_ioctl_func_factory.cpp b/src/fuse_ioctl_func_factory.cpp deleted file mode 100644 index 52bc7622..00000000 --- a/src/fuse_ioctl_func_factory.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_ioctl_func_factory.hpp" -#include "fuse_ioctl_func_all.hpp" - -#include - - -namespace FUSE::IOCTL -{ - FuncBase::Ptr - FuncFactory(const toml::value &toml_) - { - std::string str; - - str = toml::find_or(toml_,"func","ioctl","policy","all"); - if(str == "all") - return std::make_shared(toml_); - - throw std::runtime_error(""); - } -} diff --git a/src/fuse_ioctl_func_factory.hpp b/src/fuse_ioctl_func_factory.hpp deleted file mode 100644 index d2be09b1..00000000 --- a/src/fuse_ioctl_func_factory.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_ioctl_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::IOCTL -{ - FuncBase::Ptr - FuncFactory(const toml::value &); -} diff --git a/src/fuse_link_func.cpp b/src/fuse_link_func.cpp deleted file mode 100644 index fd4d3075..00000000 --- a/src/fuse_link_func.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_link_func.hpp" -#include "fuse_link_func_factory.hpp" - -#include "toml.hpp" - - -FUSE::LINK::Func::Func(const toml::value &toml_) -{ - _link = FuncFactory(toml_); -} diff --git a/src/fuse_link_func.hpp b/src/fuse_link_func.hpp deleted file mode 100644 index 115f73d8..00000000 --- a/src/fuse_link_func.hpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_link_func_base.hpp" - -#include "toml.hpp" - -#include "fuse.h" - - -namespace FUSE::LINK -{ - class Func - { - public: - Func(const toml::value &); - - public: - int - operator()(const gfs::path &oldpath_, - const gfs::path &newpath_) - { - return (*_link)(oldpath_,newpath_); - } - - private: - FuncBase::Ptr _link; - }; -} diff --git a/src/fuse_link_func_all.cpp b/src/fuse_link_func_all.cpp deleted file mode 100644 index 49eeef94..00000000 --- a/src/fuse_link_func_all.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_link_func_all.hpp" -#include "fuse_link_err.hpp" - -#include "fs_clonepath_branches.hpp" -#include "fs_exists.hpp" -#include "fs_link.hpp" - - -namespace gfs = ghc::filesystem; - - -FUSE::LINK::FuncALL::FuncALL(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::LINK::FuncALL::operator()(const gfs::path &oldpath_, - const gfs::path &newpath_) -{ - int rv; - Err err; - gfs::path fulloldpath; - gfs::path fullnewpath; - - for(const auto &branch_group : _branches) - { - for(const auto &branch : branch_group) - { - fulloldpath = branch.path / oldpath_; - fullnewpath = branch.path / newpath_; - - rv = fs::link(fulloldpath,fullnewpath); - if(rv == -ENOENT) - { - if(!fs::exists(fulloldpath)) - continue; - - rv = fs::clonepath_as_root(_branches,branch.path,newpath_.parent_path()); - if(rv < 0) - continue; - - rv = fs::link(fulloldpath,fullnewpath); - } - - err = rv; - } - } - - return err; -} diff --git a/src/fuse_link_func_all.hpp b/src/fuse_link_func_all.hpp deleted file mode 100644 index 890a51ce..00000000 --- a/src/fuse_link_func_all.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_link_func_base.hpp" - -#include "branches.hpp" - - -namespace FUSE::LINK -{ - class FuncALL : public FuncBase - { - public: - FuncALL(const toml::value&); - - public: - int operator()(const gfs::path &oldpath, - const gfs::path &newpath) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_link_func_base.hpp b/src/fuse_link_func_base.hpp deleted file mode 100644 index 5648a0bd..00000000 --- a/src/fuse_link_func_base.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fs_path.hpp" - -#include "fuse.h" - -#include - - -namespace FUSE::LINK -{ - class FuncBase - { - public: - typedef std::shared_ptr Ptr; - - public: - virtual int operator()(const gfs::path &oldpath, - const gfs::path &newpath) = 0; - - }; -} diff --git a/src/fuse_link_func_factory.cpp b/src/fuse_link_func_factory.cpp deleted file mode 100644 index 17f0b544..00000000 --- a/src/fuse_link_func_factory.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_link_func_factory.hpp" -#include "fuse_link_func_all.hpp" - -#include - - -namespace FUSE::LINK -{ - FuncBase::Ptr - FuncFactory(const toml::value &toml_) - { - std::string str; - - str = toml::find_or(toml_,"func","link","policy","all"); - if(str == "all") - return std::make_shared(toml_); - - throw std::runtime_error(""); - } -} diff --git a/src/fuse_link_func_factory.hpp b/src/fuse_link_func_factory.hpp deleted file mode 100644 index 96e874c4..00000000 --- a/src/fuse_link_func_factory.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_link_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::LINK -{ - FuncBase::Ptr - FuncFactory(const toml::value &); -} diff --git a/src/fuse_listxattr_func.cpp b/src/fuse_listxattr_func.cpp deleted file mode 100644 index dc8e2c39..00000000 --- a/src/fuse_listxattr_func.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_listxattr_func.hpp" -#include "fuse_listxattr_func_factory.hpp" - - -FUSE::LISTXATTR::Func::Func(const toml::value &toml_) -{ - _listxattr = FuncFactory(toml_); -} - -int -FUSE::LISTXATTR::Func::operator()(const gfs::path &fusepath_, - char *list_, - const size_t size_) -{ - return (*_listxattr)(fusepath_,list_,size_); -} diff --git a/src/fuse_listxattr_func.hpp b/src/fuse_listxattr_func.hpp deleted file mode 100644 index 79102da1..00000000 --- a/src/fuse_listxattr_func.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "from_toml.hpp" -#include "fuse_listxattr_func_base.hpp" - -#include - -#include - -namespace FUSE::LISTXATTR -{ - class Func - { - public: - Func(const toml::value &); - - public: - int operator()(const gfs::path &fusepath, - char *buf, - size_t count); - - private: - FuncBase::Ptr _listxattr; - }; -} diff --git a/src/fuse_listxattr_func_base.hpp b/src/fuse_listxattr_func_base.hpp deleted file mode 100644 index 215d65c0..00000000 --- a/src/fuse_listxattr_func_base.hpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fs_path.hpp" - -#include - - -namespace FUSE::LISTXATTR -{ - class FuncBase - { - public: - typedef std::shared_ptr Ptr; - - public: - virtual int operator()(const gfs::path &fusepath, - char *list, - const size_t size) = 0; - }; -} diff --git a/src/fuse_listxattr_func_factory.cpp b/src/fuse_listxattr_func_factory.cpp deleted file mode 100644 index 3f0eda74..00000000 --- a/src/fuse_listxattr_func_factory.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_listxattr_func_factory.hpp" - -#include "fuse_listxattr_func_ff.hpp" - -#include - -namespace FUSE::LISTXATTR -{ - FuncBase::Ptr - FuncFactory(const toml::value &toml_) - { - std::string str; - - str = toml::find_or(toml_,"func","listxattr","policy","ff"); - if(str == "ff") - return std::make_shared(toml_); - - throw std::runtime_error(""); - } -} diff --git a/src/fuse_listxattr_func_factory.hpp b/src/fuse_listxattr_func_factory.hpp deleted file mode 100644 index 20247333..00000000 --- a/src/fuse_listxattr_func_factory.hpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_listxattr_func_base.hpp" - -#include "toml.hpp" - -namespace FUSE::LISTXATTR -{ - FuncBase::Ptr - FuncFactory(const toml::value &); -} diff --git a/src/fuse_listxattr_func_ff.cpp b/src/fuse_listxattr_func_ff.cpp deleted file mode 100644 index 4d9802b4..00000000 --- a/src/fuse_listxattr_func_ff.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_listxattr_func_ff.hpp" - -#include "fs_llistxattr.hpp" - - -FUSE::LISTXATTR::FuncFF::FuncFF(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::LISTXATTR::FuncFF::operator()(const gfs::path &fusepath_, - char *list_, - const size_t size_) -{ - int rv; - gfs::path fullpath; - - for(const auto &branch_group : _branches) - { - for(const auto &branch : branch_group) - { - fullpath = branch.path / fusepath_; - - rv = fs::llistxattr(fullpath,list_,size_); - if(rv == -ENOENT) - continue; - - return rv; - } - } - - return -ENOENT; -} diff --git a/src/fuse_listxattr_func_ff.hpp b/src/fuse_listxattr_func_ff.hpp deleted file mode 100644 index 07fd0704..00000000 --- a/src/fuse_listxattr_func_ff.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_listxattr_func.hpp" - -#include "branches.hpp" - -#include "toml.hpp" - -namespace FUSE::LISTXATTR -{ - class FuncFF : public FuncBase - { - public: - FuncFF(const toml::value&); - - public: - int operator()(const gfs::path &fusepath, - char *list, - const size_t size) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_mkdir_func.cpp b/src/fuse_mkdir_func.cpp deleted file mode 100644 index 07ce11ac..00000000 --- a/src/fuse_mkdir_func.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_mkdir_func.hpp" -#include "fuse_mkdir_func_factory.hpp" - -#include "toml.hpp" - - -FUSE::MKDIR::Func::Func(const toml::value &toml_) -{ - _mkdir = FuncFactory(toml_); -} - -int -FUSE::MKDIR::Func::operator()(const gfs::path &fusepath_, - const mode_t mode_, - const mode_t umask_) -{ - return (*_mkdir)(fusepath_,mode_,umask_); -} diff --git a/src/fuse_mkdir_func.hpp b/src/fuse_mkdir_func.hpp deleted file mode 100644 index ef19b870..00000000 --- a/src/fuse_mkdir_func.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_mkdir_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::MKDIR -{ - class Func - { - public: - Func(const toml::value &); - - public: - int operator()(const gfs::path &fusepath, - const mode_t mode, - const mode_t umask); - - private: - FuncBase::Ptr _mkdir; - }; -} diff --git a/src/fuse_mkdir_func_base.hpp b/src/fuse_mkdir_func_base.hpp deleted file mode 100644 index a06ada8a..00000000 --- a/src/fuse_mkdir_func_base.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fs_path.hpp" - -#include "fuse.h" - -#include - - -namespace FUSE::MKDIR -{ - class FuncBase - { - public: - typedef std::shared_ptr Ptr; - - public: - virtual int operator()(const gfs::path &fusepath, - const mode_t mode, - const mode_t umask) = 0; - }; -} diff --git a/src/fuse_mkdir_func_epff.cpp b/src/fuse_mkdir_func_epff.cpp deleted file mode 100644 index a4719880..00000000 --- a/src/fuse_mkdir_func_epff.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_mkdir_func_epff.hpp" -#include "fuse_mkdir_mkdir.hpp" - - -namespace gfs = ghc::filesystem; - - -FUSE::MKDIR::FuncEPFF::FuncEPFF(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::MKDIR::FuncEPFF::operator()(const gfs::path &fusepath_, - const mode_t mode_, - const mode_t umask_) -{ - int rv; - gfs::path fullpath; - - for(const auto &branch_group : _branches) - { - for(const auto &branch : branch_group) - { - fullpath = branch.path / fusepath_; - - rv = FUSE::MKDIR::mkdir(fullpath,mode_,umask_); - if(rv == -ENOENT) - continue; - - return rv; - } - } - - return -ENOENT; -} diff --git a/src/fuse_mkdir_func_epff.hpp b/src/fuse_mkdir_func_epff.hpp deleted file mode 100644 index 31d11d32..00000000 --- a/src/fuse_mkdir_func_epff.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_mkdir_func_base.hpp" - -#include "branches.hpp" - - -namespace FUSE::MKDIR -{ - class FuncEPFF : public FuncBase - { - public: - FuncEPFF(const toml::value&); - - public: - int operator()(const gfs::path &fusepath, - const mode_t mode, - const mode_t umask) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_mkdir_func_factory.cpp b/src/fuse_mkdir_func_factory.cpp deleted file mode 100644 index 980916b6..00000000 --- a/src/fuse_mkdir_func_factory.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_mkdir_func_factory.hpp" -#include "fuse_mkdir_func_ff.hpp" -#include "fuse_mkdir_func_epff.hpp" - -#include - -namespace FUSE::MKDIR -{ - FuncBase::Ptr - FuncFactory(const toml::value &toml_) - { - std::string str; - - str = toml::find_or(toml_,"func","mkdir","policy","ff"); - if(str == "ff") - return std::make_shared(toml_); - if(str == "epff") - return std::make_shared(toml_); - - throw std::runtime_error(""); - } -} diff --git a/src/fuse_mkdir_func_factory.hpp b/src/fuse_mkdir_func_factory.hpp deleted file mode 100644 index 8d1a5d59..00000000 --- a/src/fuse_mkdir_func_factory.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_mkdir_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::MKDIR -{ - FuncBase::Ptr - FuncFactory(const toml::value &); -} diff --git a/src/fuse_mkdir_func_ff.cpp b/src/fuse_mkdir_func_ff.cpp deleted file mode 100644 index f9c80279..00000000 --- a/src/fuse_mkdir_func_ff.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_mkdir_func_ff.hpp" -#include "fuse_mkdir_mkdir.hpp" - -#include "fs_clonepath_branches.hpp" - - -namespace gfs = ghc::filesystem; - - -FUSE::MKDIR::FuncFF::FuncFF(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::MKDIR::FuncFF::operator()(const gfs::path &fusepath_, - const mode_t mode_, - const mode_t umask_) -{ - int rv; - gfs::path fullpath; - - for(const auto &branch_group : _branches) - { - for(const auto &branch : branch_group) - { - fullpath = branch.path / fusepath_; - - rv = FUSE::MKDIR::mkdir(fullpath,mode_,umask_); - if(rv == -ENOENT) - { - rv = fs::clonepath_as_root(_branches,branch.path,fusepath_); - if(rv >= 0) - rv = FUSE::MKDIR::mkdir(fullpath,mode_,umask_); - } - - return rv; - } - } - - return -ENOENT; -} diff --git a/src/fuse_mkdir_func_ff.hpp b/src/fuse_mkdir_func_ff.hpp deleted file mode 100644 index 1cef1b74..00000000 --- a/src/fuse_mkdir_func_ff.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_mkdir_func_base.hpp" - -#include "branches.hpp" - - -namespace FUSE::MKDIR -{ - class FuncFF : public FuncBase - { - public: - FuncFF(const toml::value&); - - public: - int operator()(const gfs::path &fusepath, - const mode_t mode, - const mode_t umask) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_mknod.cpp b/src/fuse_mknod.cpp index ba8ce0ae..ef3c07c8 100644 --- a/src/fuse_mknod.cpp +++ b/src/fuse_mknod.cpp @@ -154,9 +154,11 @@ namespace FUSE::MKNOD dev_t rdev_) { State s; + gfs::path fusepath; const fuse_context *fc = fuse_get_context(); const ugid::Set ugid(fc->uid,fc->gid); - return s->mknod(fusepath_,mode_,fc->umask,rdev_); + fusepath = &fusepath_[1]; + return s->mknod(fusepath,mode_,fc->umask,rdev_); } } diff --git a/src/fuse_mknod_func.cpp b/src/fuse_mknod_func.cpp deleted file mode 100644 index 69dbd477..00000000 --- a/src/fuse_mknod_func.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_mknod_func.hpp" -#include "fuse_mknod_func_factory.hpp" - -#include "toml.hpp" - - -FUSE::MKNOD::Func::Func(const toml::value &toml_) -{ - _mknod = FuncFactory(toml_); -} - -int -FUSE::MKNOD::Func::operator()(const char *fusepath_, - const mode_t mode_, - const mode_t umask_, - const dev_t dev_) -{ - return (*_mknod)(fusepath_,mode_,umask_,dev_); -} diff --git a/src/fuse_mknod_func.hpp b/src/fuse_mknod_func.hpp deleted file mode 100644 index 3f66eac2..00000000 --- a/src/fuse_mknod_func.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_mknod_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::MKNOD -{ - class Func - { - public: - Func(const toml::value &); - - public: - int operator()(const char *fusepath, - const mode_t mode, - const mode_t umask, - const dev_t dev); - - private: - FuncBase::Ptr _mknod; - }; -} diff --git a/src/fuse_mknod_func_base.hpp b/src/fuse_mknod_func_base.hpp deleted file mode 100644 index 610b6384..00000000 --- a/src/fuse_mknod_func_base.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include - -#include -#include -#include -#include - - -namespace FUSE::MKNOD -{ - class FuncBase - { - public: - typedef std::shared_ptr Ptr; - - public: - virtual int operator()(const char *fusepath, - const mode_t mode, - const mode_t umask, - const dev_t dev) = 0; - }; -} diff --git a/src/fuse_mknod_func_epff.cpp b/src/fuse_mknod_func_epff.cpp deleted file mode 100644 index cac3f60c..00000000 --- a/src/fuse_mknod_func_epff.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_mknod_func_epff.hpp" - -#include "fileinfo.hpp" -#include "fs_acl.hpp" -#include "fs_mknod.hpp" - - -namespace gfs = ghc::filesystem; - - -FUSE::MKNOD::FuncEPFF::FuncEPFF(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::MKNOD::FuncEPFF::operator()(const char *fusepath_, - const mode_t mode_, - const mode_t umask_, - const dev_t dev_) -{ - int rv; - mode_t mode; - gfs::path fusepath; - gfs::path fullpath; - - mode = mode_; - fusepath = &fusepath_[1]; - for(const auto &branch_group : _branches) - { - for(const auto &branch : branch_group) - { - fullpath = branch.path / fusepath; - - rv = fs::acl::dir_has_defaults(fullpath); - if(rv == -ENOENT) - continue; - if(rv >= 0) - mode &= umask_; - - rv = fs::mknod(fullpath,mode,dev_); - if(rv == -ENOENT) - continue; - - return rv; - } - } - - return -ENOENT; -} diff --git a/src/fuse_mknod_func_epff.hpp b/src/fuse_mknod_func_epff.hpp deleted file mode 100644 index d11e2682..00000000 --- a/src/fuse_mknod_func_epff.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_mknod_func_base.hpp" - -#include "branches.hpp" - - -namespace FUSE::MKNOD -{ - class FuncEPFF : public FuncBase - { - public: - FuncEPFF(const toml::value&); - - public: - int operator()(const char *fusepath, - const mode_t mode, - const mode_t umask, - const dev_t dev) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_mknod_func_factory.cpp b/src/fuse_mknod_func_factory.cpp deleted file mode 100644 index e8add84d..00000000 --- a/src/fuse_mknod_func_factory.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_mknod_func_factory.hpp" -#include "fuse_mknod_func_ff.hpp" -#include "fuse_mknod_func_epff.hpp" - -#include - -namespace FUSE::MKNOD -{ - FuncBase::Ptr - FuncFactory(const toml::value &toml_) - { - std::string str; - - str = toml::find_or(toml_,"func","mknod","policy","ff"); - if(str == "ff") - return std::make_shared(toml_); - if(str == "epff") - return std::make_shared(toml_); - - throw std::runtime_error(""); - } -} diff --git a/src/fuse_mknod_func_factory.hpp b/src/fuse_mknod_func_factory.hpp deleted file mode 100644 index f96db87f..00000000 --- a/src/fuse_mknod_func_factory.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_mknod_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::MKNOD -{ - FuncBase::Ptr - FuncFactory(const toml::value &); -} diff --git a/src/fuse_mknod_func_ff.cpp b/src/fuse_mknod_func_ff.cpp deleted file mode 100644 index 06683f97..00000000 --- a/src/fuse_mknod_func_ff.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_mknod_func_ff.hpp" - -#include "fileinfo.hpp" -#include "fs_acl.hpp" -#include "fs_clonepath.hpp" -#include "fs_clonepath_branches.hpp" -#include "fs_mknod.hpp" -#include "ugid.hpp" - - -namespace gfs = ghc::filesystem; - - -FUSE::MKNOD::FuncFF::FuncFF(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::MKNOD::FuncFF::operator()(const char *fusepath_, - const mode_t mode_, - const mode_t umask_, - const dev_t dev_) -{ - int rv; - mode_t mode; - gfs::path fusepath; - gfs::path fullpath; - - mode = mode_; - fusepath = &fusepath_[1]; - for(const auto &branch_group : _branches) - { - for(const auto &branch : branch_group) - { - fullpath = branch.path / fusepath; - - rv = fs::acl::dir_has_defaults(fullpath); - if(rv == -ENOENT) - { - rv = fs::clonepath_as_root(_branches,branch.path,fusepath); - if(rv >= 0) - rv = fs::acl::dir_has_defaults(fullpath); - } - - if(rv >= 0) - mode &= ~umask_; - - rv = fs::mknod(fullpath,mode,dev_); - if(rv == -ENOENT) - { - rv = fs::clonepath_as_root(_branches,branch.path,fusepath); - if(rv >= 0) - { - rv = fs::acl::dir_has_defaults(fullpath); - if(rv >= 0) - mode &= ~umask_; - rv = fs::mknod(fullpath,mode,dev_); - } - } - - return rv; - } - } - - return -ENOENT; -} diff --git a/src/fuse_mknod_func_ff.hpp b/src/fuse_mknod_func_ff.hpp deleted file mode 100644 index 84114c32..00000000 --- a/src/fuse_mknod_func_ff.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_mknod_func_base.hpp" - -#include "branches.hpp" - - -namespace FUSE::MKNOD -{ - class FuncFF : public FuncBase - { - public: - FuncFF(const toml::value&); - - public: - int operator()(const char *fusepath, - const mode_t mode, - const mode_t umask, - const dev_t dev) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_open_func.cpp b/src/fuse_open_func.cpp deleted file mode 100644 index 02e661cc..00000000 --- a/src/fuse_open_func.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_open_func.hpp" -#include "fuse_open_func_factory.hpp" - -#include "state.hpp" - - -FUSE::OPEN::Func::Func(const toml::value &toml_) -{ - _open = FuncFactory(toml_); -} - -void -FUSE::OPEN::Func::operator=(const toml::value &toml_) -{ - _open = FuncFactory(toml_); -} - -int -FUSE::OPEN::Func::operator()(const char *fusepath_, - fuse_file_info_t *ffi_) -{ - return (*_open)(fusepath_,ffi_); -} diff --git a/src/fuse_open_func.hpp b/src/fuse_open_func.hpp deleted file mode 100644 index 12fc52ee..00000000 --- a/src/fuse_open_func.hpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_open_func_base.hpp" - -#include "fuse.h" - -#include "toml.hpp" - -#include - - -namespace FUSE::OPEN -{ - class Func - { - public: - Func(const toml::value &); - - public: - int operator()(const char *fusepath, - fuse_file_info_t *ffi); - - - void operator=(const toml::value&); - - private: - FuncBase::Ptr _open; - }; -} diff --git a/src/fuse_open_func_base.hpp b/src/fuse_open_func_base.hpp deleted file mode 100644 index bdcb8d8a..00000000 --- a/src/fuse_open_func_base.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse.h" - -#include - - -namespace FUSE::OPEN -{ - class FuncBase - { - public: - typedef std::shared_ptr Ptr; - - public: - virtual int operator()(const char *fusepath, - fuse_file_info_t *ffi) = 0; - }; -} diff --git a/src/fuse_open_func_factory.cpp b/src/fuse_open_func_factory.cpp deleted file mode 100644 index be923860..00000000 --- a/src/fuse_open_func_factory.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_open_func_factory.hpp" - -#include "fuse_open_func_ff.hpp" - -#include - - -namespace FUSE::OPEN -{ - FuncBase::Ptr - FuncFactory(const toml::value &toml_) - { - std::string str; - - str = toml::find_or(toml_,"func","open","policy","ff"); - if(str == "ff") - return std::make_shared(toml_); - - throw std::runtime_error(""); - } -} diff --git a/src/fuse_open_func_factory.hpp b/src/fuse_open_func_factory.hpp deleted file mode 100644 index 4a4d8cff..00000000 --- a/src/fuse_open_func_factory.hpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_open_func_base.hpp" - -#include "toml.hpp" - -namespace FUSE::OPEN -{ - FuncBase::Ptr - FuncFactory(const toml::value &); -} diff --git a/src/fuse_open_func_ff.cpp b/src/fuse_open_func_ff.cpp deleted file mode 100644 index 463a7710..00000000 --- a/src/fuse_open_func_ff.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_open_func_ff.hpp" - -#include "fs_open.hpp" -#include "fileinfo.hpp" - - -namespace gfs = ghc::filesystem; - - -FUSE::OPEN::FuncFF::FuncFF(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::OPEN::FuncFF::operator()(const char *fusepath_, - fuse_file_info_t *ffi_) -{ - int 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; - - rv = fs::open(fullpath,ffi_->flags); - if(rv == -ENOENT) - continue; - if(rv < 0) - return rv; - - ffi_->fh = reinterpret_cast(new FileInfo(rv,fusepath_)); - - return 0; - } - } - - return -ENOENT; -} diff --git a/src/fuse_open_func_ff.hpp b/src/fuse_open_func_ff.hpp deleted file mode 100644 index 0edaca7f..00000000 --- a/src/fuse_open_func_ff.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_open_func.hpp" - -#include "branches.hpp" - -#include "toml.hpp" - - -namespace FUSE::OPEN -{ - class FuncFF : public FuncBase - { - public: - FuncFF(const toml::value&); - - public: - int operator()(const char *fusepath, - fuse_file_info_t *ffi) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_readlink_func.cpp b/src/fuse_readlink_func.cpp deleted file mode 100644 index e4d8465e..00000000 --- a/src/fuse_readlink_func.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_readlink_func.hpp" -#include "fuse_readlink_func_factory.hpp" - -#include "state.hpp" - - -FUSE::READLINK::Func::Func(const toml::value &toml_) -{ - _readlink = FuncFactory(toml_); -} - -void -FUSE::READLINK::Func::operator=(const toml::value &toml_) -{ - _readlink = FuncFactory(toml_); -} - -int -FUSE::READLINK::Func::operator()(const char *fusepath_, - char *buf_, - const size_t bufsiz_) -{ - return (*_readlink)(fusepath_,buf_,bufsiz_); -} diff --git a/src/fuse_readlink_func.hpp b/src/fuse_readlink_func.hpp deleted file mode 100644 index 596084d1..00000000 --- a/src/fuse_readlink_func.hpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "from_toml.hpp" -#include "fuse_readlink_func_base.hpp" - -#include "fuse_timeouts.h" - -#include - -#include - -namespace FUSE::READLINK -{ - class Func - { - public: - Func(const toml::value &); - - public: - int operator()(const char *fusepath, - char *buf_, - const size_t bufsiz_); - - void operator=(const toml::value&); - - private: - FuncBase::Ptr _readlink; - }; -} diff --git a/src/fuse_readlink_func_base.hpp b/src/fuse_readlink_func_base.hpp deleted file mode 100644 index 33f3e6a1..00000000 --- a/src/fuse_readlink_func_base.hpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include - - -namespace FUSE::READLINK -{ - class FuncBase - { - public: - typedef std::shared_ptr Ptr; - - public: - virtual int operator()(const char *fusepath, - char *buf, - const size_t bufsiz) = 0; - }; -} diff --git a/src/fuse_readlink_func_factory.cpp b/src/fuse_readlink_func_factory.cpp deleted file mode 100644 index 49830c6c..00000000 --- a/src/fuse_readlink_func_factory.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_readlink_func_factory.hpp" - -#include "fuse_readlink_func_ff.hpp" - -#include - - -namespace FUSE::READLINK -{ - FuncBase::Ptr - FuncFactory(const toml::value &toml_) - { - std::string str; - - str = toml::find_or(toml_,"func","readlink","policy","ff"); - if(str == "ff") - return std::make_shared(toml_); - - throw std::runtime_error(""); - } -} diff --git a/src/fuse_readlink_func_factory.hpp b/src/fuse_readlink_func_factory.hpp deleted file mode 100644 index 75ca5360..00000000 --- a/src/fuse_readlink_func_factory.hpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_readlink_func_base.hpp" - -#include "toml.hpp" - -namespace FUSE::READLINK -{ - FuncBase::Ptr - FuncFactory(const toml::value &); -} diff --git a/src/fuse_readlink_func_ff.cpp b/src/fuse_readlink_func_ff.cpp deleted file mode 100644 index 8ee5ea89..00000000 --- a/src/fuse_readlink_func_ff.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_readlink_func_ff.hpp" - -#include "fs_readlink.hpp" - - -namespace gfs = ghc::filesystem; - - -FUSE::READLINK::FuncFF::FuncFF(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::READLINK::FuncFF::operator()(const char *fusepath_, - char *buf_, - const size_t bufsiz_) -{ - int 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; - - rv = fs::readlink(fullpath,buf_,bufsiz_); - if(rv == -ENOENT) - continue; - - return rv; - } - } - - return -ENOENT; -} diff --git a/src/fuse_readlink_func_ff.hpp b/src/fuse_readlink_func_ff.hpp deleted file mode 100644 index f1dc48f2..00000000 --- a/src/fuse_readlink_func_ff.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_readlink_func.hpp" - -#include "branches.hpp" - -#include "toml.hpp" - -namespace FUSE::READLINK -{ - class FuncFF : public FuncBase - { - public: - FuncFF(const toml::value&); - - public: - int operator()(const char *fusepath, - char *buf, - const size_t bufsiz) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_removexattr_func.cpp b/src/fuse_removexattr_func.cpp deleted file mode 100644 index 0115f1db..00000000 --- a/src/fuse_removexattr_func.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_removexattr_func.hpp" -#include "fuse_removexattr_func_factory.hpp" - -#include "toml.hpp" - - -FUSE::REMOVEXATTR::Func::Func(const toml::value &toml_) -{ - _removexattr = FuncFactory(toml_); -} - -int -FUSE::REMOVEXATTR::Func::operator()(const char *fusepath_, - const char *attrname_) -{ - return (*_removexattr)(fusepath_,attrname_); -} diff --git a/src/fuse_removexattr_func.hpp b/src/fuse_removexattr_func.hpp deleted file mode 100644 index 417cfac6..00000000 --- a/src/fuse_removexattr_func.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_removexattr_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::REMOVEXATTR -{ - class Func - { - public: - Func(const toml::value &); - - public: - int operator()(const char *fusepath, - const char *attrname); - - private: - FuncBase::Ptr _removexattr; - }; -} diff --git a/src/fuse_removexattr_func_all.cpp b/src/fuse_removexattr_func_all.cpp deleted file mode 100644 index e3662bdc..00000000 --- a/src/fuse_removexattr_func_all.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_removexattr_func_all.hpp" -#include "fuse_removexattr_err.hpp" - -#include "fs_lremovexattr.hpp" - - -namespace gfs = ghc::filesystem; - - -FUSE::REMOVEXATTR::FuncALL::FuncALL(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::REMOVEXATTR::FuncALL::operator()(const char *fusepath_, - const char *attrname_) -{ - 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; - - rv = fs::lremovexattr(fullpath,attrname_); - } - } - - return rv; -} diff --git a/src/fuse_removexattr_func_all.hpp b/src/fuse_removexattr_func_all.hpp deleted file mode 100644 index 6dadcb5d..00000000 --- a/src/fuse_removexattr_func_all.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_removexattr_func_base.hpp" - -#include "branches.hpp" - - -namespace FUSE::REMOVEXATTR -{ - class FuncALL : public FuncBase - { - public: - FuncALL(const toml::value &); - - public: - int operator()(const char *fusepath, - const char *attrname) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_removexattr_func_base.hpp b/src/fuse_removexattr_func_base.hpp deleted file mode 100644 index e2eda000..00000000 --- a/src/fuse_removexattr_func_base.hpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - - -#include - - -namespace FUSE::REMOVEXATTR -{ - class FuncBase - { - public: - typedef std::shared_ptr Ptr; - - public: - virtual int operator()(const char *fusepath, - const char *attrname) = 0; - }; -} diff --git a/src/fuse_removexattr_func_factory.cpp b/src/fuse_removexattr_func_factory.cpp deleted file mode 100644 index e18daceb..00000000 --- a/src/fuse_removexattr_func_factory.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_removexattr_func_factory.hpp" -#include "fuse_removexattr_func_all.hpp" - -#include - - -namespace FUSE::REMOVEXATTR -{ - FuncBase::Ptr - FuncFactory(const toml::value &toml_) - { - std::string str; - - str = toml::find_or(toml_,"func","removexattr","policy","all"); - if(str == "all") - return std::make_shared(toml_); - - throw std::runtime_error(""); - } -} diff --git a/src/fuse_removexattr_func_factory.hpp b/src/fuse_removexattr_func_factory.hpp deleted file mode 100644 index 83be21f9..00000000 --- a/src/fuse_removexattr_func_factory.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_removexattr_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::REMOVEXATTR -{ - FuncBase::Ptr - FuncFactory(const toml::value &); -} diff --git a/src/fuse_rename_func.cpp b/src/fuse_rename_func.cpp deleted file mode 100644 index 5374a590..00000000 --- a/src/fuse_rename_func.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_rename_func.hpp" -#include "fuse_rename_func_factory.hpp" - -#include "toml.hpp" - - -FUSE::RENAME::Func::Func(const toml::value &toml_) -{ - _rename = FuncFactory(toml_); -} diff --git a/src/fuse_rename_func.hpp b/src/fuse_rename_func.hpp deleted file mode 100644 index 1fa3488f..00000000 --- a/src/fuse_rename_func.hpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_rename_func_base.hpp" - -#include "ghc/filesystem.hpp" -#include "toml.hpp" - - -namespace FUSE::RENAME -{ - class Func - { - public: - Func(const toml::value &); - - public: - int - operator()(const gfs::path &oldpath_, - const gfs::path &newpath_) - { - return (*_rename)(oldpath_,newpath_); - } - - private: - FuncBase::Ptr _rename; - }; -} diff --git a/src/fuse_rename_func_all.cpp b/src/fuse_rename_func_all.cpp deleted file mode 100644 index b89e2188..00000000 --- a/src/fuse_rename_func_all.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_rename_func_all.hpp" -#include "fuse_rename_err.hpp" - -#include "fs_rename.hpp" - -#include "fs_path.hpp" - - -FUSE::RENAME::FuncALL::FuncALL(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::RENAME::FuncALL::operator()(const gfs::path &oldpath_, - const gfs::path &newpath_) -{ - Err rv; - gfs::path fullpath; - - for(const auto &branch_group : _branches) - { - for(const auto &branch : branch_group) - { - fullpath = branch.path / oldpath_; - - rv = 0; - } - } - - return rv; -} diff --git a/src/fuse_rename_func_all.hpp b/src/fuse_rename_func_all.hpp deleted file mode 100644 index b02a3bd3..00000000 --- a/src/fuse_rename_func_all.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_rename_func_base.hpp" - -#include "branches.hpp" - -#include "fs_path.hpp" - - -namespace FUSE::RENAME -{ - class FuncALL : public FuncBase - { - public: - FuncALL(const toml::value &); - - public: - int operator()(const gfs::path &oldpath, - const gfs::path &newpath) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_rename_func_base.hpp b/src/fuse_rename_func_base.hpp deleted file mode 100644 index 80a06904..00000000 --- a/src/fuse_rename_func_base.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fs_path.hpp" - -#include - - -namespace FUSE::RENAME -{ - class FuncBase - { - public: - typedef std::shared_ptr Ptr; - - public: - virtual int operator()(const gfs::path &oldpath, - const gfs::path &newpath) = 0; - }; -} diff --git a/src/fuse_rename_func_factory.cpp b/src/fuse_rename_func_factory.cpp deleted file mode 100644 index a538cab9..00000000 --- a/src/fuse_rename_func_factory.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_rename_func_factory.hpp" -#include "fuse_rename_func_all.hpp" - -#include - - -namespace FUSE::RENAME -{ - FuncBase::Ptr - FuncFactory(const toml::value &toml_) - { - std::string str; - - str = toml::find_or(toml_,"func","rename","policy","all"); - if(str == "all") - return std::make_shared(toml_); - - throw std::runtime_error(""); - } -} diff --git a/src/fuse_rename_func_factory.hpp b/src/fuse_rename_func_factory.hpp deleted file mode 100644 index 2177e650..00000000 --- a/src/fuse_rename_func_factory.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_rename_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::RENAME -{ - FuncBase::Ptr - FuncFactory(const toml::value &); -} diff --git a/src/fuse_rmdir_func.cpp b/src/fuse_rmdir_func.cpp deleted file mode 100644 index fe944329..00000000 --- a/src/fuse_rmdir_func.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_rmdir_func.hpp" -#include "fuse_rmdir_func_factory.hpp" - -#include "toml.hpp" - - -FUSE::RMDIR::Func::Func(const toml::value &toml_) -{ - _rmdir = FuncFactory(toml_); -} - -int -FUSE::RMDIR::Func::operator()(const char *fusepath_) -{ - return (*_rmdir)(fusepath_); -} diff --git a/src/fuse_rmdir_func.hpp b/src/fuse_rmdir_func.hpp deleted file mode 100644 index 30f7498b..00000000 --- a/src/fuse_rmdir_func.hpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_rmdir_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::RMDIR -{ - class Func - { - public: - Func(const toml::value &); - - public: - int operator()(const char *fusepath); - - private: - FuncBase::Ptr _rmdir; - }; -} diff --git a/src/fuse_rmdir_func_all.cpp b/src/fuse_rmdir_func_all.cpp deleted file mode 100644 index 940ccff9..00000000 --- a/src/fuse_rmdir_func_all.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_rmdir_func_all.hpp" -#include "fuse_rmdir_err.hpp" - -#include "fs_rmdir.hpp" - - -namespace gfs = ghc::filesystem; - - -FUSE::RMDIR::FuncALL::FuncALL(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::RMDIR::FuncALL::operator()(const char *fusepath_) -{ - 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; - - rv = fs::rmdir(fullpath); - } - } - - return rv; -} diff --git a/src/fuse_rmdir_func_all.hpp b/src/fuse_rmdir_func_all.hpp deleted file mode 100644 index 133ab9ee..00000000 --- a/src/fuse_rmdir_func_all.hpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_rmdir_func_base.hpp" - -#include "branches.hpp" - - -namespace FUSE::RMDIR -{ - class FuncALL : public FuncBase - { - public: - FuncALL(const toml::value &); - - public: - int operator()(const char *fusepath) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_rmdir_func_base.hpp b/src/fuse_rmdir_func_base.hpp deleted file mode 100644 index b1ab5328..00000000 --- a/src/fuse_rmdir_func_base.hpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - - -#include - - -namespace FUSE::RMDIR -{ - class FuncBase - { - public: - typedef std::shared_ptr Ptr; - - public: - virtual int operator()(const char *fusepath) = 0; - }; -} diff --git a/src/fuse_rmdir_func_factory.cpp b/src/fuse_rmdir_func_factory.cpp deleted file mode 100644 index 51ff6513..00000000 --- a/src/fuse_rmdir_func_factory.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_rmdir_func_factory.hpp" -#include "fuse_rmdir_func_all.hpp" - -#include - - -namespace FUSE::RMDIR -{ - FuncBase::Ptr - FuncFactory(const toml::value &toml_) - { - std::string str; - - str = toml::find_or(toml_,"func","rmdir","policy","all"); - if(str == "all") - return std::make_shared(toml_); - - throw std::runtime_error(""); - } -} diff --git a/src/fuse_rmdir_func_factory.hpp b/src/fuse_rmdir_func_factory.hpp deleted file mode 100644 index 2d42a292..00000000 --- a/src/fuse_rmdir_func_factory.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_rmdir_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::RMDIR -{ - FuncBase::Ptr - FuncFactory(const toml::value &); -} diff --git a/src/fuse_setxattr_func.cpp b/src/fuse_setxattr_func.cpp deleted file mode 100644 index f7412794..00000000 --- a/src/fuse_setxattr_func.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_setxattr_func.hpp" -#include "fuse_setxattr_func_factory.hpp" - -#include "toml.hpp" - - -FUSE::SETXATTR::Func::Func(const toml::value &toml_) -{ - _setxattr = FuncFactory(toml_); -} - -int -FUSE::SETXATTR::Func::operator()(const char *fusepath_, - const char *attrname_, - const char *attrval_, - const size_t attrvalsize_, - const int flags_) -{ - return (*_setxattr)(fusepath_, - attrname_, - attrval_, - attrvalsize_, - flags_); -} diff --git a/src/fuse_setxattr_func.hpp b/src/fuse_setxattr_func.hpp deleted file mode 100644 index 54f6e48f..00000000 --- a/src/fuse_setxattr_func.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_setxattr_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::SETXATTR -{ - class Func - { - public: - Func(const toml::value &); - - public: - int operator()(const char *fusepath, - const char *attrname, - const char *attrval, - const size_t attrvalsize, - const int flags); - - private: - FuncBase::Ptr _setxattr; - }; -} diff --git a/src/fuse_setxattr_func_all.cpp b/src/fuse_setxattr_func_all.cpp deleted file mode 100644 index 8fb12055..00000000 --- a/src/fuse_setxattr_func_all.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_setxattr_func_all.hpp" -#include "fuse_setxattr_err.hpp" - -#include "fs_lsetxattr.hpp" - - -namespace gfs = ghc::filesystem; - - -FUSE::SETXATTR::FuncALL::FuncALL(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::SETXATTR::FuncALL::operator()(const char *fusepath_, - const char *attrname_, - const char *attrval_, - const size_t attrvalsize_, - const int flags_) -{ - 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; - - rv = fs::lsetxattr(fullpath, - attrname_, - attrval_, - attrvalsize_, - flags_); - } - } - - return rv; -} diff --git a/src/fuse_setxattr_func_all.hpp b/src/fuse_setxattr_func_all.hpp deleted file mode 100644 index e97a8822..00000000 --- a/src/fuse_setxattr_func_all.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_setxattr_func_base.hpp" - -#include "branches.hpp" - - -namespace FUSE::SETXATTR -{ - class FuncALL : public FuncBase - { - public: - FuncALL(const toml::value &); - - public: - int operator()(const char *fusepath, - const char *attrname, - const char *attrval, - const size_t attrvalsize, - const int flags) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_setxattr_func_base.hpp b/src/fuse_setxattr_func_base.hpp deleted file mode 100644 index 70a2b9bc..00000000 --- a/src/fuse_setxattr_func_base.hpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include - - -namespace FUSE::SETXATTR -{ - class FuncBase - { - public: - typedef std::shared_ptr Ptr; - - public: - virtual int operator()(const char *fusepath, - const char *attrname, - const char *attrval, - const size_t attrvalsize, - const int flags) = 0; - }; -} diff --git a/src/fuse_setxattr_func_factory.cpp b/src/fuse_setxattr_func_factory.cpp deleted file mode 100644 index cd16fdf4..00000000 --- a/src/fuse_setxattr_func_factory.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_setxattr_func_factory.hpp" -#include "fuse_setxattr_func_all.hpp" - -#include - - -namespace FUSE::SETXATTR -{ - FuncBase::Ptr - FuncFactory(const toml::value &toml_) - { - std::string str; - - str = toml::find_or(toml_,"func","setxattr","policy","all"); - if(str == "all") - return std::make_shared(toml_); - - throw std::runtime_error(""); - } -} diff --git a/src/fuse_setxattr_func_factory.hpp b/src/fuse_setxattr_func_factory.hpp deleted file mode 100644 index a5317836..00000000 --- a/src/fuse_setxattr_func_factory.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_setxattr_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::SETXATTR -{ - FuncBase::Ptr - FuncFactory(const toml::value &); -} diff --git a/src/fuse_symlink_func.cpp b/src/fuse_symlink_func.cpp deleted file mode 100644 index c0da6ace..00000000 --- a/src/fuse_symlink_func.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_symlink_func.hpp" -#include "fuse_symlink_func_factory.hpp" - -#include "toml.hpp" - - -FUSE::SYMLINK::Func::Func(const toml::value &toml_) -{ - _symlink = FuncFactory(toml_); -} - -int -FUSE::SYMLINK::Func::operator()(const char *target_, - const char *linkpath_) -{ - return (*_symlink)(target_,linkpath_); -} diff --git a/src/fuse_symlink_func.hpp b/src/fuse_symlink_func.hpp deleted file mode 100644 index 68766d26..00000000 --- a/src/fuse_symlink_func.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_symlink_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::SYMLINK -{ - class Func - { - public: - Func(const toml::value &); - - public: - int operator()(const char *target, - const char *linkpath); - - private: - FuncBase::Ptr _symlink; - }; -} diff --git a/src/fuse_symlink_func_base.hpp b/src/fuse_symlink_func_base.hpp deleted file mode 100644 index f82ea2d8..00000000 --- a/src/fuse_symlink_func_base.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse.h" - -#include - - -namespace FUSE::SYMLINK -{ - class FuncBase - { - public: - typedef std::shared_ptr Ptr; - - public: - virtual int operator()(const char *target, - const char *linkpath) = 0; - }; -} diff --git a/src/fuse_symlink_func_epff.cpp b/src/fuse_symlink_func_epff.cpp deleted file mode 100644 index 9f605e8a..00000000 --- a/src/fuse_symlink_func_epff.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_symlink_func_epff.hpp" - -#include "fs_symlink.hpp" - - -namespace gfs = ghc::filesystem; - - -FUSE::SYMLINK::FuncEPFF::FuncEPFF(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::SYMLINK::FuncEPFF::operator()(const char *target_, - const char *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; - - rv = fs::symlink(target_,fullpath); - if(rv == -ENOENT) - continue; - - return rv; - } - } - - return -ENOENT; -} diff --git a/src/fuse_symlink_func_epff.hpp b/src/fuse_symlink_func_epff.hpp deleted file mode 100644 index 0e06c89c..00000000 --- a/src/fuse_symlink_func_epff.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_symlink_func_base.hpp" - -#include "branches.hpp" - - -namespace FUSE::SYMLINK -{ - class FuncEPFF : public FuncBase - { - public: - FuncEPFF(const toml::value&); - - public: - int operator()(const char *target, - const char *linkpath) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_symlink_func_factory.cpp b/src/fuse_symlink_func_factory.cpp deleted file mode 100644 index da4057af..00000000 --- a/src/fuse_symlink_func_factory.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - 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 - -namespace FUSE::SYMLINK -{ - FuncBase::Ptr - FuncFactory(const toml::value &toml_) - { - std::string str; - - str = toml::find_or(toml_,"func","symlink","policy","ff"); - if(str == "ff") - return std::make_shared(toml_); - if(str == "epff") - return std::make_shared(toml_); - - throw std::runtime_error(""); - } -} diff --git a/src/fuse_symlink_func_factory.hpp b/src/fuse_symlink_func_factory.hpp deleted file mode 100644 index 903598e8..00000000 --- a/src/fuse_symlink_func_factory.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_symlink_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::SYMLINK -{ - FuncBase::Ptr - FuncFactory(const toml::value &); -} diff --git a/src/fuse_symlink_func_ff.cpp b/src/fuse_symlink_func_ff.cpp deleted file mode 100644 index b62c70f8..00000000 --- a/src/fuse_symlink_func_ff.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_symlink_func_ff.hpp" - -#include "fs_clonepath.hpp" -#include "fs_clonepath_branches.hpp" -#include "fs_symlink.hpp" -#include "ugid.hpp" - - -namespace gfs = ghc::filesystem; - - -FUSE::SYMLINK::FuncFF::FuncFF(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::SYMLINK::FuncFF::operator()(const char *target_, - const char *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; - - rv = fs::symlink(target_,fullpath); - if(rv == -ENOENT) - { - rv = fs::clonepath_as_root(_branches,branch.path,linkpath_); - if(rv >= 0) - rv = fs::symlink(target_,fullpath); - } - - return rv; - } - } - - return -ENOENT; -} diff --git a/src/fuse_symlink_func_ff.hpp b/src/fuse_symlink_func_ff.hpp deleted file mode 100644 index f33730a2..00000000 --- a/src/fuse_symlink_func_ff.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_symlink_func_base.hpp" - -#include "branches.hpp" - - -namespace FUSE::SYMLINK -{ - class FuncFF : public FuncBase - { - public: - FuncFF(const toml::value&); - - public: - int operator()(const char *target, - const char *linkpath) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_truncate_func.cpp b/src/fuse_truncate_func.cpp deleted file mode 100644 index 3bea6e0c..00000000 --- a/src/fuse_truncate_func.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_truncate_func.hpp" -#include "fuse_truncate_func_factory.hpp" - -#include "toml.hpp" - - -FUSE::TRUNCATE::Func::Func(const toml::value &toml_) -{ - _truncate = FuncFactory(toml_); -} - -int -FUSE::TRUNCATE::Func::operator()(const char *fusepath_, - const off_t length_) -{ - return (*_truncate)(fusepath_,length_); -} diff --git a/src/fuse_truncate_func.hpp b/src/fuse_truncate_func.hpp deleted file mode 100644 index 6410dcb1..00000000 --- a/src/fuse_truncate_func.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_truncate_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::TRUNCATE -{ - class Func - { - public: - Func(const toml::value &); - - public: - int operator()(const char *fusepath, - const off_t length); - - private: - FuncBase::Ptr _truncate; - }; -} diff --git a/src/fuse_truncate_func_all.cpp b/src/fuse_truncate_func_all.cpp deleted file mode 100644 index db60a0c6..00000000 --- a/src/fuse_truncate_func_all.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_truncate_func_all.hpp" -#include "fuse_truncate_err.hpp" - -#include "fs_truncate.hpp" - - -namespace gfs = ghc::filesystem; - - -FUSE::TRUNCATE::FuncALL::FuncALL(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::TRUNCATE::FuncALL::operator()(const char *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; - - rv = fs::truncate(fullpath,length_); - } - } - - return rv; -} diff --git a/src/fuse_truncate_func_all.hpp b/src/fuse_truncate_func_all.hpp deleted file mode 100644 index 82ee0814..00000000 --- a/src/fuse_truncate_func_all.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_truncate_func_base.hpp" - -#include "branches.hpp" - - -namespace FUSE::TRUNCATE -{ - class FuncALL : public FuncBase - { - public: - FuncALL(const toml::value &); - - public: - int operator()(const char *fusepath, - const off_t length) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_truncate_func_base.hpp b/src/fuse_truncate_func_base.hpp deleted file mode 100644 index 5f140452..00000000 --- a/src/fuse_truncate_func_base.hpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - - -#include - -#include - - -namespace FUSE::TRUNCATE -{ - class FuncBase - { - public: - typedef std::shared_ptr Ptr; - - public: - virtual int operator()(const char *fusepath, - const off_t length) = 0; - }; -} diff --git a/src/fuse_truncate_func_factory.cpp b/src/fuse_truncate_func_factory.cpp deleted file mode 100644 index b5704ae4..00000000 --- a/src/fuse_truncate_func_factory.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_truncate_func_factory.hpp" -#include "fuse_truncate_func_all.hpp" - -#include - - -namespace FUSE::TRUNCATE -{ - FuncBase::Ptr - FuncFactory(const toml::value &toml_) - { - std::string str; - - str = toml::find_or(toml_,"func","truncate","policy","all"); - if(str == "all") - return std::make_shared(toml_); - - throw std::runtime_error(""); - } -} diff --git a/src/fuse_truncate_func_factory.hpp b/src/fuse_truncate_func_factory.hpp deleted file mode 100644 index 056c625d..00000000 --- a/src/fuse_truncate_func_factory.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_truncate_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::TRUNCATE -{ - FuncBase::Ptr - FuncFactory(const toml::value &); -} diff --git a/src/fuse_unlink_func.cpp b/src/fuse_unlink_func.cpp deleted file mode 100644 index 2d28214e..00000000 --- a/src/fuse_unlink_func.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_unlink_func.hpp" -#include "fuse_unlink_func_factory.hpp" - -#include "toml.hpp" - - -FUSE::UNLINK::Func::Func(const toml::value &toml_) -{ - _unlink = FuncFactory(toml_); -} - -int -FUSE::UNLINK::Func::operator()(const char *fusepath_) -{ - return (*_unlink)(fusepath_); -} diff --git a/src/fuse_unlink_func.hpp b/src/fuse_unlink_func.hpp deleted file mode 100644 index 7951aba0..00000000 --- a/src/fuse_unlink_func.hpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_unlink_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::UNLINK -{ - class Func - { - public: - Func(const toml::value &); - - public: - int operator()(const char *fusepath); - - private: - FuncBase::Ptr _unlink; - }; -} diff --git a/src/fuse_unlink_func_all.cpp b/src/fuse_unlink_func_all.cpp deleted file mode 100644 index b053b260..00000000 --- a/src/fuse_unlink_func_all.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_unlink_func_all.hpp" -#include "fuse_unlink_err.hpp" - -#include "fs_unlink.hpp" - - -namespace gfs = ghc::filesystem; - - -FUSE::UNLINK::FuncALL::FuncALL(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::UNLINK::FuncALL::operator()(const char *fusepath_) -{ - 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; - - rv = fs::unlink(fullpath); - } - } - - return rv; -} diff --git a/src/fuse_unlink_func_all.hpp b/src/fuse_unlink_func_all.hpp deleted file mode 100644 index 2afce42b..00000000 --- a/src/fuse_unlink_func_all.hpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_unlink_func_base.hpp" - -#include "branches.hpp" - - -namespace FUSE::UNLINK -{ - class FuncALL : public FuncBase - { - public: - FuncALL(const toml::value &); - - public: - int operator()(const char *fusepath) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_unlink_func_base.hpp b/src/fuse_unlink_func_base.hpp deleted file mode 100644 index e8e1bd00..00000000 --- a/src/fuse_unlink_func_base.hpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - - -#include - - -namespace FUSE::UNLINK -{ - class FuncBase - { - public: - typedef std::shared_ptr Ptr; - - public: - virtual int operator()(const char *fusepath) = 0; - }; -} diff --git a/src/fuse_unlink_func_factory.cpp b/src/fuse_unlink_func_factory.cpp deleted file mode 100644 index 9a2e5083..00000000 --- a/src/fuse_unlink_func_factory.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_unlink_func_factory.hpp" -#include "fuse_unlink_func_all.hpp" - -#include - - -namespace FUSE::UNLINK -{ - FuncBase::Ptr - FuncFactory(const toml::value &toml_) - { - std::string str; - - str = toml::find_or(toml_,"func","unlink","policy","all"); - if(str == "all") - return std::make_shared(toml_); - - throw std::runtime_error(""); - } -} diff --git a/src/fuse_unlink_func_factory.hpp b/src/fuse_unlink_func_factory.hpp deleted file mode 100644 index 9f744b27..00000000 --- a/src/fuse_unlink_func_factory.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_unlink_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::UNLINK -{ - FuncBase::Ptr - FuncFactory(const toml::value &); -} diff --git a/src/fuse_utimens_func.cpp b/src/fuse_utimens_func.cpp deleted file mode 100644 index 88b8b1d3..00000000 --- a/src/fuse_utimens_func.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_utimens_func.hpp" -#include "fuse_utimens_func_factory.hpp" - -#include "toml.hpp" - -#include - - -FUSE::UTIMENS::Func::Func(const toml::value &toml_) -{ - _utimens = FuncFactory(toml_); -} - -int -FUSE::UTIMENS::Func::operator()(const char *fusepath_, - const timespec ts_[2]) -{ - return (*_utimens)(fusepath_,ts_); -} diff --git a/src/fuse_utimens_func.hpp b/src/fuse_utimens_func.hpp deleted file mode 100644 index c05651aa..00000000 --- a/src/fuse_utimens_func.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_utimens_func_base.hpp" - -#include "toml.hpp" - -#include - - -namespace FUSE::UTIMENS -{ - class Func - { - public: - Func(const toml::value &); - - public: - int operator()(const char *fusepath, - const timespec ts_[2]); - - private: - FuncBase::Ptr _utimens; - }; -} diff --git a/src/fuse_utimens_func_all.cpp b/src/fuse_utimens_func_all.cpp deleted file mode 100644 index e169c93d..00000000 --- a/src/fuse_utimens_func_all.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_utimens_func_all.hpp" -#include "fuse_utimens_err.hpp" - -#include "fs_lutimens.hpp" - - -namespace gfs = ghc::filesystem; - - -FUSE::UTIMENS::FuncALL::FuncALL(const toml::value &toml_) - : _branches(toml_) -{ - -} - -int -FUSE::UTIMENS::FuncALL::operator()(const char *fusepath_, - const timespec ts_[2]) -{ - 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; - - rv = fs::lutimens(fullpath,ts_); - } - } - - return rv; -} diff --git a/src/fuse_utimens_func_all.hpp b/src/fuse_utimens_func_all.hpp deleted file mode 100644 index 7707c349..00000000 --- a/src/fuse_utimens_func_all.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_utimens_func_base.hpp" - -#include "branches.hpp" - - -namespace FUSE::UTIMENS -{ - class FuncALL : public FuncBase - { - public: - FuncALL(const toml::value &); - - public: - int operator()(const char *fusepath, - const timespec ts[2]) final; - - private: - Branches2 _branches; - }; -} diff --git a/src/fuse_utimens_func_base.hpp b/src/fuse_utimens_func_base.hpp deleted file mode 100644 index 069be495..00000000 --- a/src/fuse_utimens_func_base.hpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - - -#include - - -namespace FUSE::UTIMENS -{ - class FuncBase - { - public: - typedef std::shared_ptr Ptr; - - public: - virtual int operator()(const char *fusepath, - const timespec ts[2]) = 0; - }; -} diff --git a/src/fuse_utimens_func_factory.cpp b/src/fuse_utimens_func_factory.cpp deleted file mode 100644 index f60cfde4..00000000 --- a/src/fuse_utimens_func_factory.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "fuse_utimens_func_factory.hpp" -#include "fuse_utimens_func_all.hpp" - -#include - - -namespace FUSE::UTIMENS -{ - FuncBase::Ptr - FuncFactory(const toml::value &toml_) - { - std::string str; - - str = toml::find_or(toml_,"func","utimens","policy","all"); - if(str == "all") - return std::make_shared(toml_); - - throw std::runtime_error(""); - } -} diff --git a/src/fuse_utimens_func_factory.hpp b/src/fuse_utimens_func_factory.hpp deleted file mode 100644 index 327ba7ce..00000000 --- a/src/fuse_utimens_func_factory.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - ISC License - - Copyright (c) 2022, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include "fuse_utimens_func_base.hpp" - -#include "toml.hpp" - - -namespace FUSE::UTIMENS -{ - FuncBase::Ptr - FuncFactory(const toml::value &); -} diff --git a/src/state.hpp b/src/state.hpp index 5e14c15b..923fb439 100644 --- a/src/state.hpp +++ b/src/state.hpp @@ -18,26 +18,26 @@ #pragma once -#include "fuse_access_func.hpp" -#include "fuse_chmod_func.hpp" -#include "fuse_chown_func.hpp" -#include "fuse_create_func.hpp" -#include "fuse_getattr_func.hpp" -#include "fuse_getxattr_func.hpp" -#include "fuse_ioctl_func.hpp" -#include "fuse_link_func.hpp" -#include "fuse_listxattr_func.hpp" -#include "fuse_mkdir_func.hpp" -#include "fuse_mknod_func.hpp" -#include "fuse_open_func.hpp" -#include "fuse_readlink_func.hpp" -#include "fuse_removexattr_func.hpp" -#include "fuse_rename_func.hpp" -#include "fuse_rmdir_func.hpp" -#include "fuse_setxattr_func.hpp" -#include "fuse_symlink_func.hpp" -#include "fuse_truncate_func.hpp" -#include "fuse_unlink_func.hpp" +#include "fuse_access_policy.hpp" +#include "fuse_chmod_policy.hpp" +#include "fuse_chown_policy.hpp" +#include "fuse_create_policy.hpp" +#include "fuse_getattr_policy.hpp" +#include "fuse_getxattr_policy.hpp" +#include "fuse_ioctl_policy.hpp" +#include "fuse_link_policy.hpp" +#include "fuse_listxattr_policy.hpp" +#include "fuse_mkdir_policy.hpp" +#include "fuse_mknod_policy.hpp" +#include "fuse_open_policy.hpp" +#include "fuse_readlink_policy.hpp" +#include "fuse_removexattr_policy.hpp" +#include "fuse_rename_policy.hpp" +#include "fuse_rmdir_policy.hpp" +#include "fuse_setxattr_policy.hpp" +#include "fuse_symlink_policy.hpp" +#include "fuse_truncate_policy.hpp" +#include "fuse_unlink_policy.hpp" #include "branches.hpp" @@ -86,26 +86,26 @@ public: RenameEXDEV rename_exdev; public: - FUSE::ACCESS::Func access; - FUSE::CHMOD::Func chmod; - FUSE::CHOWN::Func chown; - FUSE::CREATE::Func create; - FUSE::GETATTR::Func getattr; - FUSE::GETXATTR::Func getxattr; - FUSE::IOCTL::Func ioctl; - FUSE::LINK::Func link; - FUSE::LISTXATTR::Func listxattr; - FUSE::MKDIR::Func mkdir; - FUSE::MKNOD::Func mknod; - FUSE::OPEN::Func open; - FUSE::READLINK::Func readlink; - FUSE::REMOVEXATTR::Func removexattr; - FUSE::RENAME::Func rename; - FUSE::RMDIR::Func rmdir; - FUSE::SETXATTR::Func setxattr; - FUSE::SYMLINK::Func symlink; - FUSE::TRUNCATE::Func truncate; - FUSE::UNLINK::Func unlink; + FUSE::ACCESS::Policy access; + FUSE::CHMOD::Policy chmod; + FUSE::CHOWN::Policy chown; + FUSE::CREATE::Policy create; + FUSE::GETATTR::Policy getattr; + FUSE::GETXATTR::Policy getxattr; + FUSE::IOCTL::Policy ioctl; + FUSE::LINK::Policy link; + FUSE::LISTXATTR::Policy listxattr; + FUSE::MKDIR::Policy mkdir; + FUSE::MKNOD::Policy mknod; + FUSE::OPEN::Policy open; + FUSE::READLINK::Policy readlink; + FUSE::REMOVEXATTR::Policy removexattr; + FUSE::RENAME::Policy rename; + FUSE::RMDIR::Policy rmdir; + FUSE::SETXATTR::Policy setxattr; + FUSE::SYMLINK::Policy symlink; + FUSE::TRUNCATE::Policy truncate; + FUSE::UNLINK::Policy unlink; public: const toml::value _toml;