mirror of
https://github.com/trapexit/mergerfs.git
synced 2024-11-22 14:54:38 +08:00
checkpoint
This commit is contained in:
parent
469492800c
commit
5c41e39874
|
@ -34,7 +34,7 @@ Branches::Branches(const toml::value &toml_)
|
||||||
Branch::Mode default_mode;
|
Branch::Mode default_mode;
|
||||||
uint64_t default_minfreespace;
|
uint64_t default_minfreespace;
|
||||||
|
|
||||||
default_mode = toml::find_or(toml_,"branches","mode",Branch2::Mode::RW);
|
default_mode = toml::find_or(toml_,"branches","mode",Branch::Mode::RW);
|
||||||
default_minfreespace = toml::find_or(toml_,"branches","min-free-space",0);
|
default_minfreespace = toml::find_or(toml_,"branches","min-free-space",0);
|
||||||
|
|
||||||
branches = toml::find(toml_,"branches");
|
branches = toml::find(toml_,"branches");
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
/*
|
|
||||||
ISC License
|
|
||||||
|
|
||||||
Copyright (c) 2020, 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 "category.hpp"
|
|
||||||
#include "errno.hpp"
|
|
||||||
#include "str.hpp"
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
int
|
|
||||||
Category::Base::from_string(const std::string &s_)
|
|
||||||
{
|
|
||||||
int rv;
|
|
||||||
|
|
||||||
for(auto func : funcs)
|
|
||||||
{
|
|
||||||
rv = func->from_string(s_);
|
|
||||||
if(rv < 0)
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string
|
|
||||||
Category::Base::to_string(void) const
|
|
||||||
{
|
|
||||||
std::set<std::string> rv;
|
|
||||||
|
|
||||||
for(auto func : funcs)
|
|
||||||
rv.insert(func->to_string());
|
|
||||||
|
|
||||||
return str::join(rv,',');
|
|
||||||
}
|
|
107
src/category.hpp
107
src/category.hpp
|
@ -1,107 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (c) 2020, 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 "tofrom_string.hpp"
|
|
||||||
#include "funcs.hpp"
|
|
||||||
#include "func.hpp"
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace Category
|
|
||||||
{
|
|
||||||
class Base : public ToFromString
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
int from_string(const std::string &s) final;
|
|
||||||
std::string to_string() const final;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
std::vector<ToFromString*> funcs;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Action final : public Base
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
Action();
|
|
||||||
|
|
||||||
public:
|
|
||||||
Action(Funcs &funcs_)
|
|
||||||
{
|
|
||||||
funcs.push_back(&funcs_.chmod);
|
|
||||||
funcs.push_back(&funcs_.chown);
|
|
||||||
funcs.push_back(&funcs_.link);
|
|
||||||
funcs.push_back(&funcs_.removexattr);
|
|
||||||
funcs.push_back(&funcs_.rename);
|
|
||||||
funcs.push_back(&funcs_.rmdir);
|
|
||||||
funcs.push_back(&funcs_.setxattr);
|
|
||||||
funcs.push_back(&funcs_.truncate);
|
|
||||||
funcs.push_back(&funcs_.unlink);
|
|
||||||
funcs.push_back(&funcs_.utimens);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class Create final : public Base
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
Create();
|
|
||||||
|
|
||||||
public:
|
|
||||||
Create(Funcs &funcs_)
|
|
||||||
{
|
|
||||||
funcs.push_back(&funcs_.create);
|
|
||||||
funcs.push_back(&funcs_.mkdir);
|
|
||||||
funcs.push_back(&funcs_.mknod);
|
|
||||||
funcs.push_back(&funcs_.symlink);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class Search final : public Base
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
Search();
|
|
||||||
|
|
||||||
public:
|
|
||||||
Search(Funcs &funcs_)
|
|
||||||
{
|
|
||||||
funcs.push_back(&funcs_.access);
|
|
||||||
funcs.push_back(&funcs_.getattr);
|
|
||||||
funcs.push_back(&funcs_.getxattr);
|
|
||||||
funcs.push_back(&funcs_.listxattr);
|
|
||||||
funcs.push_back(&funcs_.open);
|
|
||||||
funcs.push_back(&funcs_.readlink);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
class Categories final
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
Categories();
|
|
||||||
|
|
||||||
public:
|
|
||||||
Categories(Funcs &funcs_)
|
|
||||||
: action(funcs_),
|
|
||||||
create(funcs_),
|
|
||||||
search(funcs_)
|
|
||||||
{}
|
|
||||||
|
|
||||||
public:
|
|
||||||
Category::Action action;
|
|
||||||
Category::Create create;
|
|
||||||
Category::Search search;
|
|
||||||
};
|
|
|
@ -26,7 +26,7 @@ namespace gfs = ghc::filesystem;
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
fs::clonepath_as_root(const Branches2 &branches_,
|
fs::clonepath_as_root(const Branches &branches_,
|
||||||
const gfs::path &to_,
|
const gfs::path &to_,
|
||||||
const gfs::path &relative_)
|
const gfs::path &relative_)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,15 +23,15 @@
|
||||||
|
|
||||||
namespace fs
|
namespace fs
|
||||||
{
|
{
|
||||||
int
|
// int
|
||||||
movefile(const Policy::Create &policy,
|
// movefile(const Policy::Create &policy,
|
||||||
const Branches::CPtr &branches,
|
// const Branches::CPtr &branches,
|
||||||
const std::string &fusepath,
|
// const std::string &fusepath,
|
||||||
int *origfd);
|
// int *origfd);
|
||||||
|
|
||||||
int
|
// int
|
||||||
movefile_as_root(const Policy::Create &policy,
|
// movefile_as_root(const Policy::Create &policy,
|
||||||
const Branches::CPtr &branches,
|
// const Branches::CPtr &branches,
|
||||||
const std::string &fusepath,
|
// const std::string &fusepath,
|
||||||
int *origfd);
|
// int *origfd);
|
||||||
}
|
}
|
||||||
|
|
62
src/func.cpp
62
src/func.cpp
|
@ -1,62 +0,0 @@
|
||||||
/*
|
|
||||||
ISC License
|
|
||||||
|
|
||||||
Copyright (c) 2019, 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 "func.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
Func::Base::Action::from_string(const std::string &policyname_)
|
|
||||||
{
|
|
||||||
policy = Policies::Action::find(policyname_);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string
|
|
||||||
Func::Base::Action::to_string(void) const
|
|
||||||
{
|
|
||||||
return policy.name();
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
Func::Base::Create::from_string(const std::string &policyname_)
|
|
||||||
{
|
|
||||||
policy = Policies::Create::find(policyname_);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string
|
|
||||||
Func::Base::Create::to_string(void) const
|
|
||||||
{
|
|
||||||
return policy.name();
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
Func::Base::Search::from_string(const std::string &policyname_)
|
|
||||||
{
|
|
||||||
policy = Policies::Search::find(policyname_);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string
|
|
||||||
Func::Base::Search::to_string(void) const
|
|
||||||
{
|
|
||||||
return policy.name();
|
|
||||||
}
|
|
185
src/func.hpp
185
src/func.hpp
|
@ -1,185 +0,0 @@
|
||||||
/*
|
|
||||||
ISC License
|
|
||||||
|
|
||||||
Copyright (c) 2019, 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 "policies.hpp"
|
|
||||||
#include "policy.hpp"
|
|
||||||
#include "tofrom_string.hpp"
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
|
|
||||||
namespace Func
|
|
||||||
{
|
|
||||||
namespace Base
|
|
||||||
{
|
|
||||||
class Action : public ToFromString
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Action(Policy::ActionImpl *policy_)
|
|
||||||
: policy(policy_)
|
|
||||||
{}
|
|
||||||
|
|
||||||
public:
|
|
||||||
int from_string(const std::string &s) final;
|
|
||||||
std::string to_string() const final;
|
|
||||||
|
|
||||||
public:
|
|
||||||
Policy::Action policy;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Create : public ToFromString
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Create(Policy::CreateImpl *policy_)
|
|
||||||
: policy(policy_)
|
|
||||||
{}
|
|
||||||
|
|
||||||
public:
|
|
||||||
int from_string(const std::string &s) final;
|
|
||||||
std::string to_string() const final;
|
|
||||||
|
|
||||||
public:
|
|
||||||
Policy::Create policy;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Search : public ToFromString
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Search(Policy::SearchImpl *policy_)
|
|
||||||
: policy(policy_)
|
|
||||||
{}
|
|
||||||
|
|
||||||
public:
|
|
||||||
int from_string(const std::string &s) final;
|
|
||||||
std::string to_string() const final;
|
|
||||||
|
|
||||||
public:
|
|
||||||
Policy::Search policy;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ActionDefault : public Action
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ActionDefault()
|
|
||||||
: Func::Base::Action(&Policies::Action::epall)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class CreateDefault : public Create
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CreateDefault()
|
|
||||||
: Func::Base::Create(&Policies::Create::epmfs)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class SearchDefault : public Search
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
SearchDefault()
|
|
||||||
: Func::Base::Search(&Policies::Search::ff)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
class Access final : public Base::SearchDefault
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
class Chmod final : public Base::ActionDefault
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
class Chown final : public Base::ActionDefault
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
class Create final : public Base::CreateDefault
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
class GetAttr final : public Base::SearchDefault
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
class GetXAttr final : public Base::SearchDefault
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
class Link final : public Base::ActionDefault
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListXAttr final : public Base::SearchDefault
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
class Mkdir final : public Base::CreateDefault
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
class Mknod final : public Base::CreateDefault
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
class Open final : public Base::SearchDefault
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
class Readlink final : public Base::SearchDefault
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
class RemoveXAttr final : public Base::ActionDefault
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
class Rename final : public Base::ActionDefault
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
class Rmdir final : public Base::ActionDefault
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
class SetXAttr final : public Base::ActionDefault
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
class Symlink final : public Base::CreateDefault
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
class Truncate final : public Base::ActionDefault
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
class Unlink final : public Base::ActionDefault
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
class Utimens final : public Base::ActionDefault
|
|
||||||
{
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,46 +0,0 @@
|
||||||
/*
|
|
||||||
ISC License
|
|
||||||
|
|
||||||
Copyright (c) 2019, 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 "func.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
struct Funcs
|
|
||||||
{
|
|
||||||
Func::Access access;
|
|
||||||
Func::Chmod chmod;
|
|
||||||
Func::Chown chown;
|
|
||||||
Func::Create create;
|
|
||||||
Func::GetAttr getattr;
|
|
||||||
Func::GetXAttr getxattr;
|
|
||||||
Func::Link link;
|
|
||||||
Func::ListXAttr listxattr;
|
|
||||||
Func::Mkdir mkdir;
|
|
||||||
Func::Mknod mknod;
|
|
||||||
Func::Open open;
|
|
||||||
Func::Readlink readlink;
|
|
||||||
Func::RemoveXAttr removexattr;
|
|
||||||
Func::Rename rename;
|
|
||||||
Func::Rmdir rmdir;
|
|
||||||
Func::SetXAttr setxattr;
|
|
||||||
Func::Symlink symlink;
|
|
||||||
Func::Truncate truncate;
|
|
||||||
Func::Unlink unlink;
|
|
||||||
Func::Utimens utimens;
|
|
||||||
};
|
|
|
@ -35,6 +35,6 @@ namespace FUSE::LINK::POLICY
|
||||||
const gfs::path &newpath) final;
|
const gfs::path &newpath) final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Branches2 _branches;
|
Branches _branches;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "category.hpp"
|
|
||||||
#include "errno.hpp"
|
#include "errno.hpp"
|
||||||
#include "fs_llistxattr.hpp"
|
#include "fs_llistxattr.hpp"
|
||||||
#include "fs_path.hpp"
|
#include "fs_path.hpp"
|
||||||
|
@ -33,28 +32,6 @@ using std::string;
|
||||||
|
|
||||||
namespace l
|
namespace l
|
||||||
{
|
{
|
||||||
static
|
|
||||||
int
|
|
||||||
listxattr(const Policy::Search &searchFunc_,
|
|
||||||
const Branches &branches_,
|
|
||||||
const char *fusepath_,
|
|
||||||
char *list_,
|
|
||||||
const size_t size_)
|
|
||||||
{
|
|
||||||
int rv;
|
|
||||||
string fullpath;
|
|
||||||
StrVec basepaths;
|
|
||||||
|
|
||||||
rv = searchFunc_(branches_,fusepath_,&basepaths);
|
|
||||||
if(rv == -1)
|
|
||||||
return -errno;
|
|
||||||
|
|
||||||
fullpath = fs::path::make(basepaths[0],fusepath_);
|
|
||||||
|
|
||||||
rv = fs::llistxattr(fullpath,list_,size_);
|
|
||||||
|
|
||||||
return ((rv == -1) ? -errno : rv);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace FUSE::LISTXATTR
|
namespace FUSE::LISTXATTR
|
||||||
|
|
|
@ -37,6 +37,6 @@ namespace FUSE::RENAME::POLICY
|
||||||
const gfs::path &newpath) final;
|
const gfs::path &newpath) final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Branches2 _branches;
|
Branches _branches;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,6 @@ namespace FUSE::STATFS::POLICY
|
||||||
struct statvfs *fsstat) final;
|
struct statvfs *fsstat) final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Branches2 _branches;
|
Branches _branches;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,6 @@ namespace FUSE::STATFS::POLICY
|
||||||
struct statvfs *fsstat) final;
|
struct statvfs *fsstat) final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Branches2 _branches;
|
Branches _branches;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
#include "errno.hpp"
|
#include "errno.hpp"
|
||||||
#include "fs_path.hpp"
|
#include "fs_path.hpp"
|
||||||
#include "fs_truncate.hpp"
|
#include "fs_truncate.hpp"
|
||||||
#include "policy_rv.hpp"
|
|
||||||
#include "ugid.hpp"
|
#include "ugid.hpp"
|
||||||
#include "state.hpp"
|
#include "state.hpp"
|
||||||
|
|
||||||
|
|
132
src/policies.cpp
132
src/policies.cpp
|
@ -1,132 +0,0 @@
|
||||||
/*
|
|
||||||
ISC License
|
|
||||||
|
|
||||||
Copyright (c) 2020, 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 "policies.hpp"
|
|
||||||
|
|
||||||
#define IFERTA(X) if(name_ == #X) return &Policies::Action::X;
|
|
||||||
#define IFERTC(X) if(name_ == #X) return &Policies::Create::X;
|
|
||||||
#define IFERTS(X) if(name_ == #X) return &Policies::Search::X;
|
|
||||||
|
|
||||||
#define IFERT(FUNC) \
|
|
||||||
FUNC(all) \
|
|
||||||
FUNC(epall) \
|
|
||||||
FUNC(epff) \
|
|
||||||
FUNC(eplfs) \
|
|
||||||
FUNC(eplus) \
|
|
||||||
FUNC(epmfs) \
|
|
||||||
FUNC(eppfrd) \
|
|
||||||
FUNC(eprand) \
|
|
||||||
FUNC(erofs) \
|
|
||||||
FUNC(ff) \
|
|
||||||
FUNC(lfs) \
|
|
||||||
FUNC(lus) \
|
|
||||||
FUNC(mfs) \
|
|
||||||
FUNC(msplfs) \
|
|
||||||
FUNC(msplus) \
|
|
||||||
FUNC(mspmfs) \
|
|
||||||
FUNC(msppfrd) \
|
|
||||||
FUNC(newest) \
|
|
||||||
FUNC(pfrd) \
|
|
||||||
FUNC(rand)
|
|
||||||
|
|
||||||
Policy::ActionImpl*
|
|
||||||
Policies::Action::find(const std::string &name_)
|
|
||||||
{
|
|
||||||
IFERT(IFERTA);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
Policy::CreateImpl*
|
|
||||||
Policies::Create::find(const std::string &name_)
|
|
||||||
{
|
|
||||||
IFERT(IFERTC);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
Policy::SearchImpl*
|
|
||||||
Policies::Search::find(const std::string &name_)
|
|
||||||
{
|
|
||||||
IFERT(IFERTS);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
Policy::All::Action Policies::Action::all;
|
|
||||||
Policy::EPAll::Action Policies::Action::epall;
|
|
||||||
Policy::EPFF::Action Policies::Action::epff;
|
|
||||||
Policy::EPLFS::Action Policies::Action::eplfs;
|
|
||||||
Policy::EPLUS::Action Policies::Action::eplus;
|
|
||||||
Policy::EPMFS::Action Policies::Action::epmfs;
|
|
||||||
Policy::EPPFRD::Action Policies::Action::eppfrd;
|
|
||||||
Policy::EPRand::Action Policies::Action::eprand;
|
|
||||||
Policy::ERoFS::Action Policies::Action::erofs;
|
|
||||||
Policy::FF::Action Policies::Action::ff;
|
|
||||||
Policy::LFS::Action Policies::Action::lfs;
|
|
||||||
Policy::LUS::Action Policies::Action::lus;
|
|
||||||
Policy::MFS::Action Policies::Action::mfs;
|
|
||||||
Policy::MSPLFS::Action Policies::Action::msplfs;
|
|
||||||
Policy::MSPLUS::Action Policies::Action::msplus;
|
|
||||||
Policy::MSPMFS::Action Policies::Action::mspmfs;
|
|
||||||
Policy::MSPPFRD::Action Policies::Action::msppfrd;
|
|
||||||
Policy::Newest::Action Policies::Action::newest;
|
|
||||||
Policy::PFRD::Action Policies::Action::pfrd;
|
|
||||||
Policy::Rand::Action Policies::Action::rand;
|
|
||||||
|
|
||||||
Policy::All::Create Policies::Create::all;
|
|
||||||
Policy::EPAll::Create Policies::Create::epall;
|
|
||||||
Policy::EPFF::Create Policies::Create::epff;
|
|
||||||
Policy::EPLFS::Create Policies::Create::eplfs;
|
|
||||||
Policy::EPLUS::Create Policies::Create::eplus;
|
|
||||||
Policy::EPMFS::Create Policies::Create::epmfs;
|
|
||||||
Policy::EPPFRD::Create Policies::Create::eppfrd;
|
|
||||||
Policy::EPRand::Create Policies::Create::eprand;
|
|
||||||
Policy::ERoFS::Create Policies::Create::erofs;
|
|
||||||
Policy::FF::Create Policies::Create::ff;
|
|
||||||
Policy::LFS::Create Policies::Create::lfs;
|
|
||||||
Policy::LUS::Create Policies::Create::lus;
|
|
||||||
Policy::MFS::Create Policies::Create::mfs;
|
|
||||||
Policy::MSPLFS::Create Policies::Create::msplfs;
|
|
||||||
Policy::MSPLUS::Create Policies::Create::msplus;
|
|
||||||
Policy::MSPMFS::Create Policies::Create::mspmfs;
|
|
||||||
Policy::MSPPFRD::Create Policies::Create::msppfrd;
|
|
||||||
Policy::Newest::Create Policies::Create::newest;
|
|
||||||
Policy::PFRD::Create Policies::Create::pfrd;
|
|
||||||
Policy::Rand::Create Policies::Create::rand;
|
|
||||||
|
|
||||||
Policy::All::Search Policies::Search::all;
|
|
||||||
Policy::EPAll::Search Policies::Search::epall;
|
|
||||||
Policy::EPFF::Search Policies::Search::epff;
|
|
||||||
Policy::EPLFS::Search Policies::Search::eplfs;
|
|
||||||
Policy::EPLUS::Search Policies::Search::eplus;
|
|
||||||
Policy::EPMFS::Search Policies::Search::epmfs;
|
|
||||||
Policy::EPPFRD::Search Policies::Search::eppfrd;
|
|
||||||
Policy::EPRand::Search Policies::Search::eprand;
|
|
||||||
Policy::ERoFS::Search Policies::Search::erofs;
|
|
||||||
Policy::FF::Search Policies::Search::ff;
|
|
||||||
Policy::LFS::Search Policies::Search::lfs;
|
|
||||||
Policy::LUS::Search Policies::Search::lus;
|
|
||||||
Policy::MFS::Search Policies::Search::mfs;
|
|
||||||
Policy::MSPLFS::Search Policies::Search::msplfs;
|
|
||||||
Policy::MSPLUS::Search Policies::Search::msplus;
|
|
||||||
Policy::MSPMFS::Search Policies::Search::mspmfs;
|
|
||||||
Policy::MSPPFRD::Search Policies::Search::msppfrd;
|
|
||||||
Policy::Newest::Search Policies::Search::newest;
|
|
||||||
Policy::PFRD::Search Policies::Search::pfrd;
|
|
||||||
Policy::Rand::Search Policies::Search::rand;
|
|
121
src/policies.hpp
121
src/policies.hpp
|
@ -1,121 +0,0 @@
|
||||||
/*
|
|
||||||
ISC License
|
|
||||||
|
|
||||||
Copyright (c) 2020, 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 "policy_all.hpp"
|
|
||||||
#include "policy_epall.hpp"
|
|
||||||
#include "policy_epff.hpp"
|
|
||||||
#include "policy_eplfs.hpp"
|
|
||||||
#include "policy_eplus.hpp"
|
|
||||||
#include "policy_epmfs.hpp"
|
|
||||||
#include "policy_eppfrd.hpp"
|
|
||||||
#include "policy_eprand.hpp"
|
|
||||||
#include "policy_erofs.hpp"
|
|
||||||
#include "policy_ff.hpp"
|
|
||||||
#include "policy_lfs.hpp"
|
|
||||||
#include "policy_lus.hpp"
|
|
||||||
#include "policy_mfs.hpp"
|
|
||||||
#include "policy_msplfs.hpp"
|
|
||||||
#include "policy_msplus.hpp"
|
|
||||||
#include "policy_mspmfs.hpp"
|
|
||||||
#include "policy_msppfrd.hpp"
|
|
||||||
#include "policy_newest.hpp"
|
|
||||||
#include "policy_pfrd.hpp"
|
|
||||||
#include "policy_rand.hpp"
|
|
||||||
|
|
||||||
struct Policies
|
|
||||||
{
|
|
||||||
struct Action
|
|
||||||
{
|
|
||||||
static Policy::ActionImpl *find(const std::string &name);
|
|
||||||
|
|
||||||
static Policy::All::Action all;
|
|
||||||
static Policy::EPAll::Action epall;
|
|
||||||
static Policy::EPFF::Action epff;
|
|
||||||
static Policy::EPLFS::Action eplfs;
|
|
||||||
static Policy::EPLUS::Action eplus;
|
|
||||||
static Policy::EPMFS::Action epmfs;
|
|
||||||
static Policy::EPPFRD::Action eppfrd;
|
|
||||||
static Policy::EPRand::Action eprand;
|
|
||||||
static Policy::ERoFS::Action erofs;
|
|
||||||
static Policy::FF::Action ff;
|
|
||||||
static Policy::LFS::Action lfs;
|
|
||||||
static Policy::LUS::Action lus;
|
|
||||||
static Policy::MFS::Action mfs;
|
|
||||||
static Policy::MSPLFS::Action msplfs;
|
|
||||||
static Policy::MSPLUS::Action msplus;
|
|
||||||
static Policy::MSPMFS::Action mspmfs;
|
|
||||||
static Policy::MSPPFRD::Action msppfrd;
|
|
||||||
static Policy::Newest::Action newest;
|
|
||||||
static Policy::PFRD::Action pfrd;
|
|
||||||
static Policy::Rand::Action rand;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Create
|
|
||||||
{
|
|
||||||
static Policy::CreateImpl *find(const std::string &name);
|
|
||||||
|
|
||||||
static Policy::All::Create all;
|
|
||||||
static Policy::EPAll::Create epall;
|
|
||||||
static Policy::EPFF::Create epff;
|
|
||||||
static Policy::EPLFS::Create eplfs;
|
|
||||||
static Policy::EPLUS::Create eplus;
|
|
||||||
static Policy::EPMFS::Create epmfs;
|
|
||||||
static Policy::EPPFRD::Create eppfrd;
|
|
||||||
static Policy::EPRand::Create eprand;
|
|
||||||
static Policy::ERoFS::Create erofs;
|
|
||||||
static Policy::FF::Create ff;
|
|
||||||
static Policy::LFS::Create lfs;
|
|
||||||
static Policy::LUS::Create lus;
|
|
||||||
static Policy::MFS::Create mfs;
|
|
||||||
static Policy::MSPLFS::Create msplfs;
|
|
||||||
static Policy::MSPLUS::Create msplus;
|
|
||||||
static Policy::MSPMFS::Create mspmfs;
|
|
||||||
static Policy::MSPPFRD::Create msppfrd;
|
|
||||||
static Policy::Newest::Create newest;
|
|
||||||
static Policy::PFRD::Create pfrd;
|
|
||||||
static Policy::Rand::Create rand;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Search
|
|
||||||
{
|
|
||||||
static Policy::SearchImpl *find(const std::string &name);
|
|
||||||
|
|
||||||
static Policy::All::Search all;
|
|
||||||
static Policy::EPAll::Search epall;
|
|
||||||
static Policy::EPFF::Search epff;
|
|
||||||
static Policy::EPLFS::Search eplfs;
|
|
||||||
static Policy::EPLUS::Search eplus;
|
|
||||||
static Policy::EPMFS::Search epmfs;
|
|
||||||
static Policy::EPPFRD::Search eppfrd;
|
|
||||||
static Policy::EPRand::Search eprand;
|
|
||||||
static Policy::ERoFS::Search erofs;
|
|
||||||
static Policy::FF::Search ff;
|
|
||||||
static Policy::LFS::Search lfs;
|
|
||||||
static Policy::LUS::Search lus;
|
|
||||||
static Policy::MFS::Search mfs;
|
|
||||||
static Policy::MSPLFS::Search msplfs;
|
|
||||||
static Policy::MSPLUS::Search msplus;
|
|
||||||
static Policy::MSPMFS::Search mspmfs;
|
|
||||||
static Policy::MSPPFRD::Search msppfrd;
|
|
||||||
static Policy::Newest::Search newest;
|
|
||||||
static Policy::PFRD::Search pfrd;
|
|
||||||
static Policy::Rand::Search rand;
|
|
||||||
};
|
|
||||||
};
|
|
Loading…
Reference in New Issue
Block a user