mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-25 17:36:25 -05:00
checkpoint
This commit is contained in:
parent
202f29286b
commit
c8e8865495
19 changed files with 76 additions and 80 deletions
|
|
@ -25,7 +25,7 @@
|
|||
namespace FUSE::ACCESS::POLICY
|
||||
{
|
||||
Base::Ptr
|
||||
Factory(const toml::value &toml_)
|
||||
factory(const toml::value &toml_)
|
||||
{
|
||||
std::string str;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,5 +26,5 @@
|
|||
namespace FUSE::ACCESS::POLICY
|
||||
{
|
||||
Base::Ptr
|
||||
Factory(const toml::value &);
|
||||
factory(const toml::value &);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
namespace FUSE::CHMOD::POLICY
|
||||
{
|
||||
Base::Ptr
|
||||
Factory(const toml::value &toml_)
|
||||
factory(const toml::value &toml_)
|
||||
{
|
||||
std::string str;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,5 +26,5 @@
|
|||
namespace FUSE::CHMOD::POLICY
|
||||
{
|
||||
Base::Ptr
|
||||
Factory(const toml::value &);
|
||||
factory(const toml::value &);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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("");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@
|
|||
*/
|
||||
|
||||
#include "fuse_link_policy_factory.hpp"
|
||||
#include "fuse_link_all_all.hpp"
|
||||
|
||||
#include "fuse_link_policy_all.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "fs_path.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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("");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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("");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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_);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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("");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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("");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 &);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue