merge action and search category

This commit is contained in:
Antonio SJ Musumeci 2015-02-05 18:23:01 -05:00
parent 58ec83dcd8
commit 2e95c6e78e
17 changed files with 26 additions and 36 deletions

View file

@ -35,14 +35,12 @@ namespace mergerfs
const std::vector<Category> Category::_categories_ =
buildvector<Category,true>
(CATEGORY(invalid))
(CATEGORY(action))
(CATEGORY(create))
(CATEGORY(search));
const Category * const Category::categories = &_categories_[1];
const Category &Category::invalid = Category::categories[Category::Enum::invalid];
const Category &Category::action = Category::categories[Category::Enum::action];
const Category &Category::create = Category::categories[Category::Enum::create];
const Category &Category::search = Category::categories[Category::Enum::search];

View file

@ -39,8 +39,7 @@ namespace mergerfs
{
invalid = -1,
BEGIN = 0,
action = BEGIN,
create,
create = BEGIN,
search,
END
};
@ -89,7 +88,6 @@ namespace mergerfs
static const std::vector<Category> _categories_;
static const Category * const categories;
static const Category &invalid;
static const Category &action;
static const Category &create;
static const Category &search;
};

View file

@ -69,7 +69,7 @@ namespace mergerfs
const config::Config &config = config::get();
const rwlock::ReadGuard readlock(&config.srcmountslock);
return _chmod(*config.action,
return _chmod(*config.search,
config.srcmounts,
fusepath,
mode);

View file

@ -72,7 +72,7 @@ namespace mergerfs
const ugid::SetResetGuard ugid(fc->uid,fc->gid);
const rwlock::ReadGuard readlock(&config.srcmountslock);
return _chown(*config.action,
return _chown(*config.search,
config.srcmounts,
fusepath,
uid,

View file

@ -43,14 +43,12 @@ namespace mergerfs
: destmount(),
srcmounts(),
srcmountslock(),
action(policies[Category::Enum::action]),
create(policies[Category::Enum::create]),
search(policies[Category::Enum::search]),
controlfile("/.mergerfs")
{
pthread_rwlock_init(&srcmountslock,NULL);
action = &Policy::ff;
create = &Policy::epmfs;
search = &Policy::ff;
}

View file

@ -50,7 +50,6 @@ namespace mergerfs
mutable pthread_rwlock_t srcmountslock;
const Policy *policies[Category::Enum::END];
const Policy *&action;
const Policy *&create;
const Policy *&search;

View file

@ -52,9 +52,7 @@ _getxattr_controlfile(const Config &config,
size_t len;
string attrvalue;
if(attrname == "user.mergerfs.action")
attrvalue = (std::string)*config.action;
else if(attrname == "user.mergerfs.create")
if(attrname == "user.mergerfs.create")
attrvalue = (std::string)*config.create;
else if(attrname == "user.mergerfs.search")
attrvalue = (std::string)*config.search;

View file

@ -91,7 +91,7 @@ namespace mergerfs
const ugid::SetResetGuard ugid(fc->uid,fc->gid);
const rwlock::ReadGuard readlock(&config.srcmountslock);
return _link(*config.action,
return _link(*config.search,
config.srcmounts,
from,
to);

View file

@ -49,7 +49,6 @@ _listxattr_controlfile(char *list,
{
const char xattrs[] =
"user.mergerfs.srcmounts\0"
"user.mergerfs.action\0"
"user.mergerfs.create\0"
"user.mergerfs.search"
;

View file

@ -57,8 +57,6 @@ process_opt(config::Config &config,
config.create = Policy::find(argvalue[1]);
else if(argvalue[0] == "search")
config.search = Policy::find(argvalue[1]);
else if(argvalue[0] == "action")
config.action = Policy::find(argvalue[1]);
else
rv = 1;
break;

View file

@ -79,7 +79,7 @@ namespace mergerfs
const ugid::SetResetGuard ugid(fc->uid,fc->gid);
const rwlock::ReadGuard readlock(&config.srcmountslock);
return _removexattr(*config.action,
return _removexattr(*config.search,
config.srcmounts,
fusepath,
attrname);

View file

@ -68,7 +68,7 @@ namespace mergerfs
const ugid::SetResetGuard ugid(fc->uid,fc->gid);
const rwlock::ReadGuard readguard(&config.srcmountslock);
return _rmdir(*config.action,
return _rmdir(*config.search,
config.srcmounts,
fusepath);
}

View file

@ -271,7 +271,7 @@ namespace mergerfs
const ugid::SetResetGuard ugid(fc->uid,fc->gid);
const rwlock::ReadGuard readlock(&config.srcmountslock);
return _setxattr(*config.action,
return _setxattr(*config.search,
config.srcmounts,
fusepath,
attrname,

View file

@ -71,7 +71,7 @@ namespace mergerfs
const ugid::SetResetGuard ugid(fc->uid,fc->gid);
const rwlock::ReadGuard readlock(&config.srcmountslock);
return _truncate(*config.action,
return _truncate(*config.search,
config.srcmounts,
fusepath,
size);

View file

@ -68,7 +68,7 @@ namespace mergerfs
const ugid::SetResetGuard ugid(fc->uid,fc->gid);
const rwlock::ReadGuard readlock(&config.srcmountslock);
return _unlink(*config.action,
return _unlink(*config.search,
config.srcmounts,
fusepath);
}

View file

@ -71,7 +71,7 @@ namespace mergerfs
const ugid::SetResetGuard ugid(fc->uid,fc->gid);
const rwlock::ReadGuard readlock(&config.srcmountslock);
return _utimens(*config.action,
return _utimens(*config.search,
config.srcmounts,
fusepath,
ts);