mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-22 16:06:27 -05:00
config: rework global config, remove rwlock, make branches RCU like
Also added unit tests. Should have done separately but found a number of bugs.
This commit is contained in:
parent
2e4c6c5fd1
commit
538467b86d
327 changed files with 6691 additions and 3036 deletions
43
src/func.cpp
43
src/func.cpp
|
|
@ -18,22 +18,45 @@
|
|||
|
||||
#include "func.hpp"
|
||||
|
||||
|
||||
int
|
||||
Func::from_string(const std::string &s_)
|
||||
Func::Base::Action::from_string(const std::string &policyname_)
|
||||
{
|
||||
const Policy *tmp;
|
||||
|
||||
tmp = &Policy::find(s_);
|
||||
if(tmp == Policy::invalid)
|
||||
return -EINVAL;
|
||||
|
||||
policy = tmp;
|
||||
policy = Policies::Action::find(policyname_);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string
|
||||
Func::to_string(void) const
|
||||
Func::Base::Action::to_string(void) const
|
||||
{
|
||||
return policy->to_string();
|
||||
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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue