checkpoint

This commit is contained in:
Antonio SJ Musumeci 2022-05-16 23:54:48 -04:00
parent 202f29286b
commit c8e8865495
19 changed files with 76 additions and 80 deletions

View file

@ -25,7 +25,7 @@
namespace FUSE::ACCESS::POLICY
{
Base::Ptr
Factory(const toml::value &toml_)
factory(const toml::value &toml_)
{
std::string str;

View file

@ -26,5 +26,5 @@
namespace FUSE::ACCESS::POLICY
{
Base::Ptr
Factory(const toml::value &);
factory(const toml::value &);
}

View file

@ -25,7 +25,7 @@
namespace FUSE::CHMOD::POLICY
{
Base::Ptr
Factory(const toml::value &toml_)
factory(const toml::value &toml_)
{
std::string str;

View file

@ -26,5 +26,5 @@
namespace FUSE::CHMOD::POLICY
{
Base::Ptr
Factory(const toml::value &);
factory(const toml::value &);
}

View file

@ -35,13 +35,13 @@ namespace FUSE::GETATTR::POLICY
str = toml::find_or(toml_,"func","getattr","policy","ff");
if(str == "ff")
return std::make_shared<FuncFF>(toml_);
return std::make_shared<FF>(toml_);
if(str == "newest")
return std::make_shared<FuncNewest>(toml_);
return std::make_shared<Newest>(toml_);
if(str == "aggregate")
return std::make_shared<FuncAggregate>(toml_);
return std::make_shared<Aggregate>(toml_);
if(str == "check-ff")
return std::make_shared<FuncCheckFF>(toml_);
return std::make_shared<CheckFF>(toml_);
throw std::runtime_error("");
}

View file

@ -26,12 +26,12 @@
#include "toml.hpp"
namespace FUSE::GETATTR
namespace FUSE::GETATTR::POLICY
{
class FF : public Base
{
public:
FF(const toml::value&);
FF(const toml::value &);
public:
int operator()(const gfs::path &fusepath,

View file

@ -17,7 +17,8 @@
*/
#include "fuse_link_policy_factory.hpp"
#include "fuse_link_all_all.hpp"
#include "fuse_link_policy_all.hpp"
#include <stdexcept>

View file

@ -18,6 +18,8 @@
#pragma once
#include "fs_path.hpp"
#include <memory>

View file

@ -25,13 +25,13 @@
namespace FUSE::SETXATTR
{
FuncBase::Ptr
FuncFactory(const toml::value &toml_)
factory(const toml::value &toml_)
{
std::string str;
str = toml::find_or(toml_,"func","setxattr","policy","all");
if(str == "all")
return std::make_shared<FuncALL>(toml_);
return std::make_shared<ALL>(toml_);
throw std::runtime_error("");
}

View file

@ -18,21 +18,21 @@
#pragma once
#include "fuse_symlink_func_base.hpp"
#include "fuse_symlink_policy_base.hpp"
#include "branches.hpp"
namespace FUSE::SYMLINK
namespace FUSE::SYMLINK::POLICY
{
class FuncEPFF : public FuncBase
class EPFF : public Base
{
public:
FuncEPFF(const toml::value&);
EPFF(const toml::value &);
public:
int operator()(const char *target,
const char *linkpath) final;
int operator()(const gfs::path &target,
const char *linkpath) final;
private:
Branches2 _branches;

View file

@ -16,24 +16,26 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_symlink_func_factory.hpp"
#include "fuse_symlink_func_ff.hpp"
#include "fuse_symlink_func_epff.hpp"
#include "fuse_symlink_policy_factory.hpp"
#include "fuse_symlink_policy_ff.hpp"
#include "fuse_symlink_policy_epff.hpp"
#include <stdexcept>
namespace FUSE::SYMLINK
namespace FUSE::SYMLINK::POLICY
{
FuncBase::Ptr
FuncFactory(const toml::value &toml_)
Base::Ptr
factory(const toml::value &toml_)
{
std::string str;
str = toml::find_or(toml_,"func","symlink","policy","ff");
if(str == "ff")
return std::make_shared<FuncFF>(toml_);
return std::make_shared<FF>(toml_);
if(str == "epff")
return std::make_shared<FuncEPFF>(toml_);
return std::make_shared<EPFF>(toml_);
throw std::runtime_error("");
}

View file

@ -16,7 +16,7 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_symlink_func_ff.hpp"
#include "fuse_symlink_policy_ff.hpp"
#include "fs_clonepath.hpp"
#include "fs_clonepath_branches.hpp"
@ -24,29 +24,24 @@
#include "ugid.hpp"
namespace gfs = ghc::filesystem;
FUSE::SYMLINK::FuncFF::FuncFF(const toml::value &toml_)
FUSE::SYMLINK::POLICY::FF::FF(const toml::value &toml_)
: _branches(toml_)
{
}
int
FUSE::SYMLINK::FuncFF::operator()(const char *target_,
const char *linkpath_)
FUSE::SYMLINK::POLICY::FF::operator()(const char *target_,
const gfs::path &linkpath_)
{
int rv;
gfs::path linkpath;
gfs::path fullpath;
linkpath = &linkpath_[1];
for(const auto &branch_group : _branches)
{
for(const auto &branch : branch_group)
{
fullpath = branch.path / linkpath;
fullpath = branch.path / linkpath_;
rv = fs::symlink(target_,fullpath);
if(rv == -ENOENT)

View file

@ -18,21 +18,21 @@
#pragma once
#include "fuse_symlink_func_base.hpp"
#include "fuse_symlink_policy_base.hpp"
#include "branches.hpp"
namespace FUSE::SYMLINK
namespace FUSE::SYMLINK::POLICY
{
class FuncFF : public FuncBase
class FF : public Base
{
public:
FuncFF(const toml::value&);
FF(const toml::value &);
public:
int operator()(const char *target,
const char *linkpath) final;
int operator()(const gfs::path &target,
const char *linkpath) final;
private:
Branches2 _branches;

View file

@ -16,35 +16,30 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_truncate_func_all.hpp"
#include "fuse_truncate_policy_all.hpp"
#include "fuse_truncate_err.hpp"
#include "fs_truncate.hpp"
namespace gfs = ghc::filesystem;
FUSE::TRUNCATE::FuncALL::FuncALL(const toml::value &toml_)
FUSE::TRUNCATE::POLICY::ALL::ALL(const toml::value &toml_)
: _branches(toml_)
{
}
int
FUSE::TRUNCATE::FuncALL::operator()(const char *fusepath_,
const off_t length_)
FUSE::TRUNCATE::POLICY::ALL::operator()(const gfs::path &fusepath_,
const off_t length_)
{
Err rv;
gfs::path fusepath;
gfs::path fullpath;
fusepath = &fusepath_[1];
for(const auto &branch_group : _branches)
{
for(const auto &branch : branch_group)
{
fullpath = branch.path / fusepath;
fullpath = branch.path / fusepath_;
rv = fs::truncate(fullpath,length_);
}

View file

@ -16,22 +16,22 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_unlink_func_factory.hpp"
#include "fuse_unlink_func_all.hpp"
#include "fuse_unlink_policy_factory.hpp"
#include "fuse_unlink_policy_all.hpp"
#include <stdexcept>
namespace FUSE::UNLINK
namespace FUSE::UNLINK::POLICY
{
FuncBase::Ptr
FuncFactory(const toml::value &toml_)
Base::Ptr
factory(const toml::value &toml_)
{
std::string str;
str = toml::find_or(toml_,"func","unlink","policy","all");
if(str == "all")
return std::make_shared<FuncALL>(toml_);
return std::make_shared<ALL>(toml_);
throw std::runtime_error("");
}

View file

@ -18,21 +18,21 @@
#pragma once
#include "fuse_utimens_func_base.hpp"
#include "fuse_utimens_policy_base.hpp"
#include "branches.hpp"
namespace FUSE::UTIMENS
namespace FUSE::UTIMENS::POLICY
{
class FuncALL : public FuncBase
class ALL : public Base
{
public:
FuncALL(const toml::value &);
ALL(const toml::value &);
public:
int operator()(const char *fusepath,
const timespec ts[2]) final;
int operator()(const gfs::path &fusepath,
const timespec ts[2]) final;
private:
Branches2 _branches;

View file

@ -18,19 +18,20 @@
#pragma once
#include "fs_path.hpp"
#include <memory>
namespace FUSE::UTIMENS
namespace FUSE::UTIMENS::POLICY
{
class FuncBase
class Base
{
public:
typedef std::shared_ptr<FuncBase> Ptr;
typedef std::shared_ptr<Base> Ptr;
public:
virtual int operator()(const char *fusepath,
const timespec ts[2]) = 0;
virtual int operator()(const gfs::path &fusepath,
const timespec ts[2]) = 0;
};
}

View file

@ -16,22 +16,22 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_utimens_func_factory.hpp"
#include "fuse_utimens_func_all.hpp"
#include "fuse_utimens_policy_factory.hpp"
#include "fuse_utimens_policy_all.hpp"
#include <stdexcept>
namespace FUSE::UTIMENS
namespace FUSE::UTIMENS::POLICY
{
FuncBase::Ptr
FuncFactory(const toml::value &toml_)
Base::Ptr
factory(const toml::value &toml_)
{
std::string str;
str = toml::find_or(toml_,"func","utimens","policy","all");
if(str == "all")
return std::make_shared<FuncALL>(toml_);
return std::make_shared<ALL>(toml_);
throw std::runtime_error("");
}

View file

@ -18,13 +18,13 @@
#pragma once
#include "fuse_utimens_func_base.hpp"
#include "fuse_utimens_policy_base.hpp"
#include "toml.hpp"
namespace FUSE::UTIMENS
namespace FUSE::UTIMENS::POLICY
{
FuncBase::Ptr
FuncFactory(const toml::value &);
Base::Ptr
factory(const toml::value &);
}