add user.mergerfs.policies xattr

This commit is contained in:
Antonio SJ Musumeci 2015-09-05 19:49:08 -04:00
parent 7bee6230ba
commit e377d54c93
3 changed files with 19 additions and 1 deletions

View File

@ -122,6 +122,18 @@ _getxattr_controlfile_minfreespace(const Config &config,
attrvalue = buf;
}
static
void
_getxattr_controlfile_policies(const Config &config,
string &attrvalue)
{
size_t i = Policy::Enum::begin();
attrvalue = (string)Policy::policies[i];
for(i++; i < Policy::Enum::end(); i++)
attrvalue += ',' + (string)Policy::policies[i];
}
static
int
_getxattr_controlfile(const Config &config,
@ -144,6 +156,8 @@ _getxattr_controlfile(const Config &config,
_getxattr_controlfile_srcmounts(config,attrvalue);
else if(attr[2] == "minfreespace")
_getxattr_controlfile_minfreespace(config,attrvalue);
else if(attr[2] == "policies")
_getxattr_controlfile_policies(config,attrvalue);
break;
case 4:

View File

@ -52,7 +52,8 @@ _listxattr_controlfile(char *list,
const vector<string> strs =
buildvector<string>
("user.mergerfs.srcmounts")
("user.mergerfs.minfreespace");
("user.mergerfs.minfreespace")
("user.mergerfs.policies");
xattrs.reserve(512);
for(size_t i = 0; i < strs.size(); i++)

View File

@ -60,6 +60,9 @@ namespace mergerfs
rand,
END
};
static size_t begin() { return BEGIN; }
static size_t end() { return END; }
};
struct Func