|
@ -126,11 +126,11 @@ _split_attrval(const string &attrval, |
|
|
|
|
|
|
|
|
static |
|
|
static |
|
|
int |
|
|
int |
|
|
_setxattr_srcmounts(vector<string> &srcmounts, |
|
|
|
|
|
|
|
|
_setxattr_srcmounts(const string &attrval, |
|
|
|
|
|
const int flags, |
|
|
|
|
|
vector<string> &srcmounts, |
|
|
pthread_rwlock_t &srcmountslock, |
|
|
pthread_rwlock_t &srcmountslock, |
|
|
const string &destmount, |
|
|
|
|
|
const string &attrval, |
|
|
|
|
|
const int flags) |
|
|
|
|
|
|
|
|
const string &destmount) |
|
|
{ |
|
|
{ |
|
|
string instruction; |
|
|
string instruction; |
|
|
string values; |
|
|
string values; |
|
@ -162,16 +162,16 @@ _setxattr_srcmounts(vector<string> &srcmounts, |
|
|
|
|
|
|
|
|
static |
|
|
static |
|
|
int |
|
|
int |
|
|
_setxattr_minfreespace(Config &config, |
|
|
|
|
|
const string &attrval, |
|
|
|
|
|
const int flags) |
|
|
|
|
|
|
|
|
_setxattr_uint64_t(const string &attrval, |
|
|
|
|
|
const int flags, |
|
|
|
|
|
uint64_t &uint) |
|
|
{ |
|
|
{ |
|
|
int rv; |
|
|
int rv; |
|
|
|
|
|
|
|
|
if((flags & XATTR_CREATE) == XATTR_CREATE) |
|
|
if((flags & XATTR_CREATE) == XATTR_CREATE) |
|
|
return -EEXIST; |
|
|
return -EEXIST; |
|
|
|
|
|
|
|
|
rv = num::to_uint64_t(attrval,config.minfreespace); |
|
|
|
|
|
|
|
|
rv = num::to_uint64_t(attrval,uint); |
|
|
if(rv == -1) |
|
|
if(rv == -1) |
|
|
return -EINVAL; |
|
|
return -EINVAL; |
|
|
|
|
|
|
|
@ -180,24 +180,23 @@ _setxattr_minfreespace(Config &config, |
|
|
|
|
|
|
|
|
static |
|
|
static |
|
|
int |
|
|
int |
|
|
_setxattr_moveonenospc(Config &config, |
|
|
|
|
|
const string &attrval, |
|
|
|
|
|
const int flags) |
|
|
|
|
|
|
|
|
_setxattr_bool(const string &attrval, |
|
|
|
|
|
const int flags, |
|
|
|
|
|
bool &value) |
|
|
{ |
|
|
{ |
|
|
if((flags & XATTR_CREATE) == XATTR_CREATE) |
|
|
if((flags & XATTR_CREATE) == XATTR_CREATE) |
|
|
return -EEXIST; |
|
|
return -EEXIST; |
|
|
|
|
|
|
|
|
if(attrval == "false") |
|
|
if(attrval == "false") |
|
|
config.moveonenospc = false; |
|
|
|
|
|
|
|
|
value = false; |
|
|
else if(attrval == "true") |
|
|
else if(attrval == "true") |
|
|
config.moveonenospc = true; |
|
|
|
|
|
|
|
|
value = true; |
|
|
else |
|
|
else |
|
|
return -EINVAL; |
|
|
return -EINVAL; |
|
|
|
|
|
|
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static |
|
|
static |
|
|
int |
|
|
int |
|
|
_setxattr_controlfile_func_policy(Config &config, |
|
|
_setxattr_controlfile_func_policy(Config &config, |
|
@ -251,19 +250,23 @@ _setxattr_controlfile(Config &config, |
|
|
{ |
|
|
{ |
|
|
case 3: |
|
|
case 3: |
|
|
if(attr[2] == "srcmounts") |
|
|
if(attr[2] == "srcmounts") |
|
|
return _setxattr_srcmounts(config.srcmounts, |
|
|
|
|
|
|
|
|
return _setxattr_srcmounts(attrval, |
|
|
|
|
|
flags, |
|
|
|
|
|
config.srcmounts, |
|
|
config.srcmountslock, |
|
|
config.srcmountslock, |
|
|
config.destmount, |
|
|
|
|
|
attrval, |
|
|
|
|
|
flags); |
|
|
|
|
|
|
|
|
config.destmount); |
|
|
else if(attr[2] == "minfreespace") |
|
|
else if(attr[2] == "minfreespace") |
|
|
return _setxattr_minfreespace(config, |
|
|
|
|
|
attrval, |
|
|
|
|
|
flags); |
|
|
|
|
|
|
|
|
return _setxattr_uint64_t(attrval, |
|
|
|
|
|
flags, |
|
|
|
|
|
config.minfreespace); |
|
|
else if(attr[2] == "moveonenospc") |
|
|
else if(attr[2] == "moveonenospc") |
|
|
return _setxattr_moveonenospc(config, |
|
|
|
|
|
attrval, |
|
|
|
|
|
flags); |
|
|
|
|
|
|
|
|
return _setxattr_bool(attrval, |
|
|
|
|
|
flags, |
|
|
|
|
|
config.moveonenospc); |
|
|
|
|
|
else if(attr[2] == "dropcacheonclose") |
|
|
|
|
|
return _setxattr_bool(attrval, |
|
|
|
|
|
flags, |
|
|
|
|
|
config.dropcacheonclose); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case 4: |
|
|
case 4: |
|
|