mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-21 17:25:50 +00:00
checkpoint
This commit is contained in:
@@ -22,15 +22,15 @@
|
||||
#include "fs_lchmod.hpp"
|
||||
|
||||
|
||||
FUSE::CHMOD::POLICY::ALL(const toml::value &toml_)
|
||||
FUSE::CHMOD::POLICY::ALL::ALL(const toml::value &toml_)
|
||||
: _branches(toml_)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
FUSE::CHMOD::POLICYALL::operator()(const gfs::path &fusepath_,
|
||||
const mode_t mode_)
|
||||
FUSE::CHMOD::POLICY::ALL::operator()(const gfs::path &fusepath_,
|
||||
const mode_t mode_)
|
||||
{
|
||||
Err rv;
|
||||
gfs::path fullpath;
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
|
||||
namespace FUSE::CHOWN::POLICY
|
||||
{
|
||||
class all : public base
|
||||
class ALL : public Base
|
||||
{
|
||||
public:
|
||||
all(const toml::value &);
|
||||
ALL(const toml::value &);
|
||||
|
||||
public:
|
||||
int operator()(const gfs::path &fusepath,
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
ISC License
|
||||
|
||||
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
|
||||
|
||||
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.hpp"
|
||||
#include "fuse_getattr_func_factory.hpp"
|
||||
|
||||
#include "state.hpp"
|
||||
|
||||
|
||||
FUSE::GETATTR::Func::Func(const toml::value &toml_)
|
||||
{
|
||||
_getattr = FuncFactory(toml_);
|
||||
}
|
||||
|
||||
int
|
||||
FUSE::GETATTR::Func::operator()(const gfs::path &fusepath_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
{
|
||||
return (*_getattr)(fusepath_,st_,timeout_);
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
ISC License
|
||||
|
||||
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
|
||||
|
||||
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_getattr_func_base.hpp"
|
||||
|
||||
#include "fuse_timeouts.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
namespace FUSE::GETATTR
|
||||
{
|
||||
class Func
|
||||
{
|
||||
public:
|
||||
Func(const toml::value &);
|
||||
|
||||
public:
|
||||
int operator()(const gfs::path &fusepath,
|
||||
struct stat *st,
|
||||
fuse_timeouts_t *timeout);
|
||||
|
||||
private:
|
||||
FuncBase::Ptr _getattr;
|
||||
};
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
ISC License
|
||||
|
||||
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
|
||||
|
||||
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_timeouts.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
namespace FUSE::GETATTR
|
||||
{
|
||||
class FuncBase
|
||||
{
|
||||
public:
|
||||
typedef std::shared_ptr<FuncBase> Ptr;
|
||||
|
||||
public:
|
||||
virtual int operator()(const gfs::path &fusepath,
|
||||
struct stat *st,
|
||||
fuse_timeouts_t *timeout) = 0;
|
||||
};
|
||||
}
|
||||
@@ -19,8 +19,12 @@
|
||||
#include "fuse_ioctl_policy_all.hpp"
|
||||
#include "fuse_ioctl_err.hpp"
|
||||
|
||||
#include "fs_path.hpp"
|
||||
|
||||
#include "fs_ioctl.hpp"
|
||||
|
||||
#include "fh.hpp"
|
||||
|
||||
|
||||
FUSE::IOCTL::POLICY::ALL::ALL(const toml::value &toml_)
|
||||
: _branches(toml_)
|
||||
@@ -39,6 +43,7 @@ FUSE::IOCTL::POLICY::ALL::operator()(const fuse_file_info_t *ffi_,
|
||||
gfs::path fusepath;
|
||||
gfs::path fullpath;
|
||||
|
||||
fusepath = reinterpret_cast<FH*>(ffi_->fh)->fusepath;
|
||||
for(const auto &branch_group : _branches)
|
||||
{
|
||||
for(const auto &branch : branch_group)
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace FUSE::LISTXATTR
|
||||
char *buf_,
|
||||
size_t count_)
|
||||
{
|
||||
return (*_listxattr)(fusepath_,list_,size_);
|
||||
return (*_listxattr)(fusepath_,buf_,count_);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_mkdir_func_base.hpp"
|
||||
#include "fuse_mkdir_policy_base.hpp"
|
||||
#include "fuse_mkdir_policy_factory.hpp"
|
||||
|
||||
#include "toml.hpp"
|
||||
|
||||
@@ -42,6 +43,6 @@ namespace FUSE::MKDIR
|
||||
}
|
||||
|
||||
private:
|
||||
FuncBase::Ptr _mkdir;
|
||||
POLICY::Base::Ptr _mkdir;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -31,15 +31,15 @@ namespace FUSE::MKNOD
|
||||
public:
|
||||
Policy(const toml::value &toml_)
|
||||
{
|
||||
_mknod = FuncFactory(toml_);
|
||||
_mknod = POLICY::factory(toml_);
|
||||
}
|
||||
|
||||
public:
|
||||
int
|
||||
operator()(const gfs::path &fusepath,
|
||||
const mode_t mode,
|
||||
const mode_t umask,
|
||||
const dev_t dev)
|
||||
operator()(const gfs::path &fusepath_,
|
||||
const mode_t mode_,
|
||||
const mode_t umask_,
|
||||
const dev_t dev_)
|
||||
{
|
||||
return (*_mknod)(fusepath_,mode_,umask_,dev_);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace FUSE::MKNOD::POLICY
|
||||
class Base
|
||||
{
|
||||
public:
|
||||
typedef std::shared_ptr<FuncBase> Ptr;
|
||||
typedef std::shared_ptr<Base> Ptr;
|
||||
|
||||
public:
|
||||
virtual int operator()(const gfs::path &fusepath,
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "fuse_readlink_policy_base.hpp"
|
||||
#include "fuse_readlink_policy_factory.hpp"
|
||||
|
||||
#include "fuse_timeouts.h"
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fs_path.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_readlink_func_base.hpp"
|
||||
#include "fuse_readlink_policy_base.hpp"
|
||||
|
||||
#include "toml.hpp"
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace FUSE::READLINK::POLICY
|
||||
FF(const toml::value &);
|
||||
|
||||
public:
|
||||
int operator()(const gfs::path &fusepath,,
|
||||
int operator()(const gfs::path &fusepath,
|
||||
char *buf,
|
||||
const size_t bufsiz) final;
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "fuse_removexattr_policy_base.hpp"
|
||||
#include "fuse_removexattr_policy_factory.hpp"
|
||||
|
||||
#include "toml.hpp"
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "fuse_rename_policy_base.hpp"
|
||||
#include "fuse_rename_policy_factory.hpp"
|
||||
|
||||
#include "toml.hpp"
|
||||
|
||||
|
||||
@@ -16,34 +16,29 @@
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "fuse_rmdir_func_all.hpp"
|
||||
#include "fuse_rmdir_policy_all.hpp"
|
||||
#include "fuse_rmdir_err.hpp"
|
||||
|
||||
#include "fs_rmdir.hpp"
|
||||
|
||||
|
||||
namespace gfs = ghc::filesystem;
|
||||
|
||||
|
||||
FUSE::RMDIR::FuncALL::FuncALL(const toml::value &toml_)
|
||||
FUSE::RMDIR::POLICY::ALL::ALL(const toml::value &toml_)
|
||||
: _branches(toml_)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
FUSE::RMDIR::FuncALL::operator()(const char *fusepath_)
|
||||
FUSE::RMDIR::POLICY::ALL::operator()(const gfs::path &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;
|
||||
fullpath = branch.path / fusepath_;
|
||||
|
||||
rv = fs::rmdir(fullpath);
|
||||
}
|
||||
|
||||
@@ -18,20 +18,20 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_rmdir_func_base.hpp"
|
||||
#include "fuse_rmdir_policy_base.hpp"
|
||||
|
||||
#include "branches.hpp"
|
||||
|
||||
|
||||
namespace FUSE::RMDIR
|
||||
namespace FUSE::RMDIR::POLICY
|
||||
{
|
||||
class FuncALL : public FuncBase
|
||||
class ALL : public Base
|
||||
{
|
||||
public:
|
||||
FuncALL(const toml::value &);
|
||||
ALL(const toml::value &);
|
||||
|
||||
public:
|
||||
int operator()(const char *fusepath) final;
|
||||
int operator()(const gfs::path &fusepath) final;
|
||||
|
||||
private:
|
||||
Branches2 _branches;
|
||||
|
||||
@@ -18,18 +18,19 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fs_path.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace FUSE::RMDIR
|
||||
namespace FUSE::RMDIR::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) = 0;
|
||||
virtual int operator()(const gfs::path &fusepath) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -16,22 +16,23 @@
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "fuse_rmdir_func_factory.hpp"
|
||||
#include "fuse_rmdir_func_all.hpp"
|
||||
#include "fuse_rmdir_policy_factory.hpp"
|
||||
|
||||
#include "fuse_rmdir_policy_all.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
|
||||
namespace FUSE::RMDIR
|
||||
namespace FUSE::RMDIR::POLICY
|
||||
{
|
||||
FuncBase::Ptr
|
||||
FuncFactory(const toml::value &toml_)
|
||||
Base::Ptr
|
||||
factory(const toml::value &toml_)
|
||||
{
|
||||
std::string str;
|
||||
|
||||
str = toml::find_or(toml_,"func","rmdir","policy","all");
|
||||
if(str == "all")
|
||||
return std::make_shared<FuncALL>(toml_);
|
||||
return std::make_shared<ALL>(toml_);
|
||||
|
||||
throw std::runtime_error("");
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_rmdir_func_base.hpp"
|
||||
#include "fuse_rmdir_policy_base.hpp"
|
||||
|
||||
#include "toml.hpp"
|
||||
|
||||
|
||||
namespace FUSE::RMDIR
|
||||
namespace FUSE::RMDIR::POLICY
|
||||
{
|
||||
FuncBase::Ptr
|
||||
FuncFactory(const toml::value &);
|
||||
Base::Ptr
|
||||
factory(const toml::value &);
|
||||
}
|
||||
|
||||
@@ -18,26 +18,34 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_setxattr_func_base.hpp"
|
||||
#include "fuse_setxattr_policy_base.hpp"
|
||||
#include "fuse_setxattr_policy_factory.hpp"
|
||||
|
||||
#include "toml.hpp"
|
||||
|
||||
|
||||
namespace FUSE::SETXATTR
|
||||
{
|
||||
class Func
|
||||
class Policy
|
||||
{
|
||||
public:
|
||||
Func(const toml::value &);
|
||||
Policy(const toml::value &toml_)
|
||||
{
|
||||
_setxattr = POLICY::factory(toml_);
|
||||
}
|
||||
|
||||
public:
|
||||
int operator()(const char *fusepath,
|
||||
const char *attrname,
|
||||
const char *attrval,
|
||||
const size_t attrvalsize,
|
||||
const int flags);
|
||||
int
|
||||
operator()(const gfs::path &fusepath_,
|
||||
const char *attrname_,
|
||||
const char *attrval_,
|
||||
const size_t attrvalsize_,
|
||||
const int flags_)
|
||||
{
|
||||
return (*_setxattr)(fusepath_,attrname_,attrval_,attrvalsize_,flags_);
|
||||
}
|
||||
|
||||
private:
|
||||
FuncBase::Ptr _setxattr;
|
||||
POLICY::Base::Ptr _setxattr;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -18,21 +18,23 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fs_path.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace FUSE::SETXATTR
|
||||
namespace FUSE::SETXATTR::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 char *attrname,
|
||||
const char *attrval,
|
||||
const size_t attrvalsize,
|
||||
const int flags) = 0;
|
||||
virtual int operator()(const gfs::path &fusepath,
|
||||
const char *attrname,
|
||||
const char *attrval,
|
||||
const size_t attrvalsize,
|
||||
const int flags) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_setxattr_func_base.hpp"
|
||||
#include "fuse_setxattr_policy_base.hpp"
|
||||
|
||||
#include "toml.hpp"
|
||||
|
||||
|
||||
namespace FUSE::SETXATTR
|
||||
namespace FUSE::SETXATTR::POLICY
|
||||
{
|
||||
FuncBase::Ptr
|
||||
FuncFactory(const toml::value &);
|
||||
Base::Ptr
|
||||
factory(const toml::value &);
|
||||
}
|
||||
|
||||
@@ -18,23 +18,31 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_symlink_func_base.hpp"
|
||||
#include "fuse_symlink_policy_base.hpp"
|
||||
#include "fuse_symlink_policy_factory.hpp"
|
||||
|
||||
#include "toml.hpp"
|
||||
|
||||
|
||||
namespace FUSE::SYMLINK
|
||||
{
|
||||
class Func
|
||||
class Policy
|
||||
{
|
||||
public:
|
||||
Func(const toml::value &);
|
||||
Policy(const toml::value &toml_)
|
||||
{
|
||||
_symlink = POLICY::factory(toml_);
|
||||
}
|
||||
|
||||
public:
|
||||
int operator()(const char *target,
|
||||
const char *linkpath);
|
||||
int
|
||||
operator()(const gfs::path &target_,
|
||||
const char *linkpath_)
|
||||
{
|
||||
return (*_symlink)(target_,linkpath_);
|
||||
}
|
||||
|
||||
private:
|
||||
FuncBase::Ptr _symlink;
|
||||
POLICY::Base::Ptr _symlink;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -18,20 +18,20 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fuse.h"
|
||||
#include "fs_path.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace FUSE::SYMLINK
|
||||
namespace FUSE::SYMLINK::POLICY
|
||||
{
|
||||
class FuncBase
|
||||
class Base
|
||||
{
|
||||
public:
|
||||
typedef std::shared_ptr<FuncBase> Ptr;
|
||||
typedef std::shared_ptr<Base> Ptr;
|
||||
|
||||
public:
|
||||
virtual int operator()(const char *target,
|
||||
const char *linkpath) = 0;
|
||||
virtual int operator()(const gfs::path &target,
|
||||
const char *linkpath) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_symlink_func_base.hpp"
|
||||
#include "fuse_symlink_policy_base.hpp"
|
||||
|
||||
#include "toml.hpp"
|
||||
|
||||
|
||||
namespace FUSE::SYMLINK
|
||||
namespace FUSE::SYMLINK::POLICY
|
||||
{
|
||||
FuncBase::Ptr
|
||||
FuncFactory(const toml::value &);
|
||||
Base::Ptr
|
||||
factory(const toml::value &);
|
||||
}
|
||||
|
||||
@@ -18,23 +18,31 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_truncate_func_base.hpp"
|
||||
#include "fuse_truncate_policy_base.hpp"
|
||||
#include "fuse_truncate_policy_factory.hpp"
|
||||
|
||||
#include "toml.hpp"
|
||||
|
||||
|
||||
namespace FUSE::TRUNCATE
|
||||
{
|
||||
class Func
|
||||
class Policy
|
||||
{
|
||||
public:
|
||||
Func(const toml::value &);
|
||||
Policy(const toml::value &toml_)
|
||||
{
|
||||
_truncate = POLICY::factory(toml_);
|
||||
}
|
||||
|
||||
public:
|
||||
int operator()(const char *fusepath,
|
||||
const off_t length);
|
||||
int
|
||||
operator()(const gfs::path &fusepath_,
|
||||
const off_t length_)
|
||||
{
|
||||
return (*_truncate)(fusepath_,length_);
|
||||
}
|
||||
|
||||
private:
|
||||
FuncBase::Ptr _truncate;
|
||||
POLICY::Base::Ptr _truncate;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -18,21 +18,21 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_truncate_func_base.hpp"
|
||||
#include "fuse_truncate_policy_base.hpp"
|
||||
|
||||
#include "branches.hpp"
|
||||
|
||||
|
||||
namespace FUSE::TRUNCATE
|
||||
namespace FUSE::TRUNCATE::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 off_t length) final;
|
||||
int operator()(const gfs::path &fusepath,
|
||||
const off_t length) final;
|
||||
|
||||
private:
|
||||
Branches2 _branches;
|
||||
|
||||
@@ -18,21 +18,22 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fs_path.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
namespace FUSE::TRUNCATE
|
||||
namespace FUSE::TRUNCATE::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 off_t length) = 0;
|
||||
virtual int operator()(const gfs::path &fusepath,
|
||||
const off_t length) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -16,22 +16,22 @@
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "fuse_truncate_func_factory.hpp"
|
||||
#include "fuse_truncate_func_all.hpp"
|
||||
#include "fuse_truncate_policy_factory.hpp"
|
||||
#include "fuse_truncate_policy_all.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
|
||||
namespace FUSE::TRUNCATE
|
||||
namespace FUSE::TRUNCATE::POLICY
|
||||
{
|
||||
FuncBase::Ptr
|
||||
FuncFactory(const toml::value &toml_)
|
||||
Base::Ptr
|
||||
factory(const toml::value &toml_)
|
||||
{
|
||||
std::string str;
|
||||
|
||||
str = toml::find_or(toml_,"func","truncate","policy","all");
|
||||
if(str == "all")
|
||||
return std::make_shared<FuncALL>(toml_);
|
||||
return std::make_shared<ALL>(toml_);
|
||||
|
||||
throw std::runtime_error("");
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_truncate_func_base.hpp"
|
||||
#include "fuse_truncate_policy_base.hpp"
|
||||
|
||||
#include "toml.hpp"
|
||||
|
||||
|
||||
namespace FUSE::TRUNCATE
|
||||
namespace FUSE::TRUNCATE::POLICY
|
||||
{
|
||||
FuncBase::Ptr
|
||||
FuncFactory(const toml::value &);
|
||||
Base::Ptr
|
||||
factory(const toml::value &);
|
||||
}
|
||||
|
||||
@@ -18,22 +18,30 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_unlink_func_base.hpp"
|
||||
#include "fuse_unlink_policy_base.hpp"
|
||||
#include "fuse_unlink_policy_factory.hpp"
|
||||
|
||||
#include "toml.hpp"
|
||||
|
||||
|
||||
namespace FUSE::UNLINK
|
||||
{
|
||||
class Func
|
||||
class Policy
|
||||
{
|
||||
public:
|
||||
Func(const toml::value &);
|
||||
Policy(const toml::value &toml_)
|
||||
{
|
||||
_unlink = POLICY::factory(toml_);
|
||||
}
|
||||
|
||||
public:
|
||||
int operator()(const char *fusepath);
|
||||
int
|
||||
operator()(const gfs::path &fusepath_)
|
||||
{
|
||||
return (*_unlink)(fusepath_);
|
||||
}
|
||||
|
||||
private:
|
||||
FuncBase::Ptr _unlink;
|
||||
POLICY::Base::Ptr _unlink;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -18,18 +18,19 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fs_path.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace FUSE::UNLINK
|
||||
namespace FUSE::UNLINK::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) = 0;
|
||||
virtual int operator()(const gfs::path &fusepath) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_unlink_func_base.hpp"
|
||||
#include "fuse_unlink_policy_base.hpp"
|
||||
|
||||
#include "toml.hpp"
|
||||
|
||||
|
||||
namespace FUSE::UNLINK
|
||||
namespace FUSE::UNLINK::POLICY
|
||||
{
|
||||
FuncBase::Ptr
|
||||
FuncFactory(const toml::value &);
|
||||
Base::Ptr
|
||||
factory(const toml::value &);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user