cleanup function signatures and definitions

This commit is contained in:
Antonio SJ Musumeci 2020-08-16 18:22:25 -04:00
parent 6cc6524997
commit ec15872a1f
112 changed files with 743 additions and 820 deletions

View File

@ -91,8 +91,8 @@ parse(const string &str_,
else else
branch.mode = Branch::RW; branch.mode = Branch::RW;
fs::glob(str,globbed); fs::glob(str,&globbed);
fs::realpathize(globbed); fs::realpathize(&globbed);
for(size_t i = 0; i < globbed.size(); i++) for(size_t i = 0; i < globbed.size(); i++)
{ {
branch.path = globbed[i]; branch.path = globbed[i];
@ -109,7 +109,7 @@ set(Branches &branches_,
branches_.clear(); branches_.clear();
str::split(paths,str_,':'); str::split(str_,':',&paths);
for(size_t i = 0; i < paths.size(); i++) for(size_t i = 0; i < paths.size(); i++)
{ {
@ -130,7 +130,7 @@ add_begin(Branches &branches_,
{ {
vector<string> paths; vector<string> paths;
str::split(paths,str_,':'); str::split(str_,':',&paths);
for(size_t i = 0; i < paths.size(); i++) for(size_t i = 0; i < paths.size(); i++)
{ {
@ -151,7 +151,7 @@ add_end(Branches &branches_,
{ {
vector<string> paths; vector<string> paths;
str::split(paths,str_,':'); str::split(str_,':',&paths);
for(size_t i = 0; i < paths.size(); i++) for(size_t i = 0; i < paths.size(); i++)
{ {
@ -186,7 +186,7 @@ erase_fnmatch(Branches &branches_,
{ {
vector<string> patterns; vector<string> patterns;
str::split(patterns,str_,':'); str::split(str_,':',&patterns);
for(Branches::iterator i = branches_.begin(); for(Branches::iterator i = branches_.begin();
i != branches_.end();) i != branches_.end();)

View File

@ -23,16 +23,16 @@ template<typename K,typename V>
class buildmap class buildmap
{ {
public: public:
buildmap(const K &key, buildmap(const K &key_,
const V &val) const V &val_)
{ {
_map.insert(std::make_pair(key,val)); _map.insert(std::make_pair(key_,val_));
} }
buildmap<K,V> &operator()(const K &key, buildmap<K,V> &operator()(const K &key_,
const V &val) const V &val_)
{ {
_map.insert(std::make_pair(key,val)); _map.insert(std::make_pair(key_,val_));
return *this; return *this;
} }

View File

@ -23,14 +23,14 @@ template<typename V, bool SORT = false>
class buildvector class buildvector
{ {
public: public:
buildvector(const V &val) buildvector(const V &val_)
{ {
_vector.push_back(val); _vector.push_back(val_);
} }
buildvector<V,SORT> &operator()(const V &val) buildvector<V,SORT> &operator()(const V &val_)
{ {
_vector.push_back(val); _vector.push_back(val_);
return *this; return *this;
} }

View File

@ -26,4 +26,5 @@ enum class StatFSIgnoreEnum
RO, RO,
NC NC
}; };
typedef Enum<StatFSIgnoreEnum> StatFSIgnore; typedef Enum<StatFSIgnoreEnum> StatFSIgnore;

View File

@ -38,20 +38,20 @@ using std::vector;
namespace fs namespace fs
{ {
void void
findallfiles(const vector<string> &basepaths, findallfiles(const vector<string> &basepaths_,
const char *fusepath, const char *fusepath_,
vector<string> &paths) vector<string> *paths_)
{ {
string fullpath; string fullpath;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++) for(size_t i = 0, ei = basepaths_.size(); i != ei; i++)
{ {
fullpath = fs::path::make(basepaths[i],fusepath); fullpath = fs::path::make(basepaths_[i],fusepath_);
if(!fs::exists(fullpath)) if(!fs::exists(fullpath))
continue; continue;
paths.push_back(fullpath); paths_->push_back(fullpath);
} }
} }
@ -91,17 +91,17 @@ namespace fs
} }
void void
realpathize(vector<string> &strs) realpathize(vector<string> *strs_)
{ {
char *rv; char *rv;
for(size_t i = 0; i < strs.size(); i++) for(size_t i = 0; i < strs_->size(); i++)
{ {
rv = fs::realpath(strs[i]); rv = fs::realpath((*strs_)[i]);
if(rv == NULL) if(rv == NULL)
continue; continue;
strs[i] = rv; (*strs_)[i] = rv;
::free(rv); ::free(rv);
} }
@ -119,38 +119,4 @@ namespace fs
{ {
return ::fcntl(fd,F_SETFL,mode); return ::fcntl(fd,F_SETFL,mode);
} }
int
mfs(const vector<string> &basepaths,
const uint64_t minfreespace,
string &path)
{
int rv;
uint64_t mfs;
uint64_t spaceavail;
const string *mfsbasepath;
mfs = 0;
mfsbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
rv = fs::statvfs_cache_spaceavail(basepaths[i],&spaceavail);
if(rv == -1)
continue;
if(spaceavail < minfreespace)
continue;
if(spaceavail <= mfs)
continue;
mfs = spaceavail;
mfsbasepath = &basepaths[i];
}
if(mfsbasepath == NULL)
return (errno=ENOENT,-1);
path = *mfsbasepath;
return 0;
}
}; };

View File

@ -24,20 +24,13 @@
namespace fs namespace fs
{ {
using std::string; void findallfiles(const std::vector<std::string> &basepaths,
using std::vector; const char *fusepath,
std::vector<std::string> *paths);
void findallfiles(const vector<string> &basepaths_, void realpathize(std::vector<std::string> *strs);
const char *fusepath_,
vector<string> &paths_);
void realpathize(vector<string> &strs_); int getfl(const int fd);
int setfl(const int fd,
int getfl(const int fd_); const mode_t mode);
int setfl(const int fd_,
const mode_t mode_);
int mfs(const vector<string> &srcs_,
const uint64_t minfreespace_,
string &path_);
} }

View File

@ -25,6 +25,6 @@ namespace fs
namespace acl namespace acl
{ {
bool bool
dir_has_defaults(const std::string &fullpath_); dir_has_defaults(const std::string &fullpath);
} }
} }

View File

@ -22,9 +22,9 @@ namespace fs
{ {
namespace attr namespace attr
{ {
int copy(const int fdin_, int copy(const int fdin,
const int fdout_); const int fdout);
int copy(const std::string &from_, int copy(const std::string &from,
const std::string &to_); const std::string &to);
} }
} }

View File

@ -19,17 +19,17 @@
namespace fs namespace fs
{ {
int int
fadvise_dontneed(const int fd_, fadvise_dontneed(const int fd,
const off_t offset_ = 0, const off_t offset = 0,
const off_t len_ = 0); const off_t len = 0);
int int
fadvise_willneed(const int fd_, fadvise_willneed(const int fd,
const off_t offset_ = 0, const off_t offset = 0,
const off_t len_ = 0); const off_t len = 0);
int int
fadvise_sequential(const int fd_, fadvise_sequential(const int fd,
const off_t offset_ = 0, const off_t offset = 0,
const off_t len_ = 0); const off_t len = 0);
} }

View File

@ -21,8 +21,8 @@
namespace fs namespace fs
{ {
int int
fallocate(const int fd_, fallocate(const int fd,
const int mode_, const int mode,
const off_t offset_, const off_t offset,
const off_t len_); const off_t len);
} }

View File

@ -28,27 +28,27 @@ namespace fs
static static
inline inline
int int
fstatat(const int dirfd, fstatat(const int dirfd_,
const char *pathname, const char *pathname_,
struct stat *statbuf, struct stat *statbuf_,
const int flags) const int flags_)
{ {
return ::fstatat(dirfd, return ::fstatat(dirfd_,
pathname, pathname_,
statbuf, statbuf_,
flags); flags_);
} }
static static
inline inline
int int
fstatat_nofollow(const int dirfd, fstatat_nofollow(const int dirfd_,
const char *pathname, const char *pathname_,
struct stat *statbuf) struct stat *statbuf_)
{ {
return fs::fstatat(dirfd, return fs::fstatat(dirfd_,
pathname, pathname_,
statbuf, statbuf_,
AT_SYMLINK_NOFOLLOW); AT_SYMLINK_NOFOLLOW);
} }
} }

View File

@ -23,7 +23,7 @@
namespace fs namespace fs
{ {
int int
futimesat(const int dirfd_, futimesat(const int dirfd,
const char *pathname_, const char *pathname,
const struct timeval times_[2]); const struct timeval times[2]);
} }

View File

@ -26,9 +26,9 @@
namespace fs namespace fs
{ {
int int
getdents(unsigned int fd_, getdents64(unsigned int fd_,
void *dirp_, void *dirp_,
unsigned int count_) unsigned int count_)
{ {
#if defined SYS_getdents64 #if defined SYS_getdents64
return ::syscall(SYS_getdents64,fd_,dirp_,count_); return ::syscall(SYS_getdents64,fd_,dirp_,count_);

View File

@ -21,7 +21,7 @@
namespace fs namespace fs
{ {
int int
getdents(unsigned int fd, getdents64(unsigned int fd,
void *dirp, void *dirp,
unsigned int count); unsigned int count);
} }

View File

@ -28,12 +28,12 @@ namespace fs
static static
inline inline
int int
utime(const int dirfd, utime(const int dirfd_,
const std::string &path, const std::string &path_,
const struct timespec times[2], const struct timespec times_[2],
const int flags) const int flags_)
{ {
return ::utimensat(dirfd,path.c_str(),times,flags); return ::utimensat(dirfd_,path_.c_str(),times_,flags_);
} }
static static

View File

@ -25,21 +25,21 @@ namespace fs
static static
inline inline
ssize_t ssize_t
write(const int fd, write(const int fd_,
const void *buf, const void *buf_,
const size_t count) const size_t count_)
{ {
return ::write(fd,buf,count); return ::write(fd_,buf_,count_);
} }
static static
inline inline
ssize_t ssize_t
pwrite(const int fd, pwrite(const int fd_,
const void *buf, const void *buf_,
const size_t count, const size_t count_,
const off_t offset) const off_t offset_)
{ {
return ::pwrite(fd,buf,count,offset); return ::pwrite(fd_,buf_,count_,offset_);
} }
} }

View File

@ -19,6 +19,6 @@
namespace fs namespace fs
{ {
int int
clonefile(const int src_fd_, clonefile(const int src_fd,
const int dst_fd_); const int dst_fd);
} }

View File

@ -115,7 +115,7 @@ namespace fs
dst_fullpath = src_fullpath_; dst_fullpath = src_fullpath_;
dst_fd = fs::mktemp(dst_fullpath,O_WRONLY); dst_fd = fs::mktemp(&dst_fullpath,O_WRONLY);
if(dst_fd == -1) if(dst_fd == -1)
return cleanup_on_error(src_fd); return cleanup_on_error(src_fd);

View File

@ -25,12 +25,12 @@ namespace fs
{ {
namespace cow namespace cow
{ {
bool is_eligible(const int flags_); bool is_eligible(const int flags);
bool is_eligible(const struct stat &st_); bool is_eligible(const struct stat &st);
bool is_eligible(const int flags_, const struct stat &st_); bool is_eligible(const int flags, const struct stat &st);
bool is_eligible(const char *fullpath_, const int flags_); bool is_eligible(const char *fullpath, const int flags);
int break_link(const char *fullpath_); int break_link(const char *fullpath);
} }
} }

View File

@ -70,7 +70,7 @@ namespace fs
{ {
std::string fullpath; std::string fullpath;
fullpath = fs::path::make(&basepath_,relpath_); fullpath = fs::path::make(basepath_,relpath_);
return fs::exists(fullpath,st_); return fs::exists(fullpath,st_);
} }

View File

@ -21,6 +21,6 @@
namespace fs namespace fs
{ {
int int
ficlone(const int src_fd_, ficlone(const int src_fd,
const int dst_fd_); const int dst_fd);
} }

View File

@ -28,7 +28,7 @@ namespace fs
{ {
void void
glob(const string &pattern_, glob(const string &pattern_,
vector<string> &strs_) vector<string> *strs_)
{ {
int flags; int flags;
glob_t gbuf = {0}; glob_t gbuf = {0};
@ -37,7 +37,7 @@ namespace fs
::glob(pattern_.c_str(),flags,NULL,&gbuf); ::glob(pattern_.c_str(),flags,NULL,&gbuf);
for(size_t i = 0; i < gbuf.gl_pathc; i++) for(size_t i = 0; i < gbuf.gl_pathc; i++)
strs_.push_back(gbuf.gl_pathv[i]); strs_->push_back(gbuf.gl_pathv[i]);
::globfree(&gbuf); ::globfree(&gbuf);
} }

View File

@ -22,6 +22,6 @@
namespace fs namespace fs
{ {
void void
glob(const std::string &pattern_, glob(const std::string &pattern,
std::vector<std::string> &strs_); std::vector<std::string> *strs);
} }

View File

@ -32,13 +32,13 @@ using std::string;
namespace fs namespace fs
{ {
int int
info(const string *path_, info(const string &path_,
fs::info_t *info_) fs::info_t *info_)
{ {
int rv; int rv;
struct statvfs st; struct statvfs st;
rv = fs::statvfs_cache(path_->c_str(),&st); rv = fs::statvfs_cache(path_.c_str(),&st);
if(rv == 0) if(rv == 0)
{ {
info_->readonly = StatVFS::readonly(st); info_->readonly = StatVFS::readonly(st);

View File

@ -25,6 +25,6 @@
namespace fs namespace fs
{ {
int int
info(const std::string *path_, info(const std::string &path,
fs::info_t *info_); fs::info_t *info);
} }

View File

@ -48,7 +48,7 @@ generate_tmp_path(const string &base_)
namespace fs namespace fs
{ {
int int
mktemp(string &base_, mktemp(string *base_,
const int flags_) const int flags_)
{ {
int fd; int fd;
@ -61,13 +61,13 @@ namespace fs
flags = (flags_ | O_EXCL | O_CREAT); flags = (flags_ | O_EXCL | O_CREAT);
while(count-- > 0) while(count-- > 0)
{ {
tmppath = generate_tmp_path(base_); tmppath = generate_tmp_path(*base_);
fd = fs::open(tmppath,flags,S_IWUSR); fd = fs::open(tmppath,flags,S_IWUSR);
if((fd == -1) && (errno == EEXIST)) if((fd == -1) && (errno == EEXIST))
continue; continue;
else if(fd != -1) else if(fd != -1)
base_ = tmppath; *base_ = tmppath;
return fd; return fd;
} }

View File

@ -23,6 +23,6 @@
namespace fs namespace fs
{ {
int int
mktemp(std::string &base_, mktemp(std::string *base,
const int flags_); const int flags);
} }

View File

@ -97,7 +97,7 @@ namespace l
fs::path::append(fdout_path[0],fusepath_); fs::path::append(fdout_path[0],fusepath_);
fdout_temp = fdout_path[0]; fdout_temp = fdout_path[0];
fdout = fs::mktemp(fdout_temp,fdin_flags); fdout = fs::mktemp(&fdout_temp,fdin_flags);
if(fdout == -1) if(fdout == -1)
return -1; return -1;

View File

@ -23,39 +23,37 @@ namespace fs
{ {
namespace path namespace path
{ {
using std::string; std::string dirname(const char *path);
std::string dirname(const std::string &path);
string dirname(const char *path); std::string basename(const std::string &path);
string dirname(const string &path);
string basename(const string &path);
static static
inline inline
void void
append(string &base, append(std::string &base_,
const char *suffix) const char *suffix_)
{ {
base += suffix; base_ += suffix_;
} }
static static
inline inline
void void
append(string &base, append(std::string &base_,
const string &suffix) const std::string &suffix_)
{ {
base += suffix; base_ += suffix_;
} }
static static
inline inline
string std::string
make(const char *base_, make(const char *base_,
const char *suffix_) const char *suffix_)
{ {
char back; char back;
string path(base_); std::string path(base_);
back = *path.rbegin(); back = *path.rbegin();
if((back != '/') && (suffix_[0] != '/')) if((back != '/') && (suffix_[0] != '/'))
@ -67,36 +65,18 @@ namespace fs
static static
inline inline
string std::string
make(const string &base_, make(const std::string &base_,
const char *suffix_) const char *suffix_)
{ {
return (base_ + suffix_); return (base_ + suffix_);
} }
static static
inline inline
string std::string
make(const string *base_, make(const std::string &base_,
const char *suffix_) const std::string &suffix_)
{
return (*base_ + suffix_);
}
static
inline
string
make(const string *base_,
const string *suffix_)
{
return (*base_ + *suffix_);
}
static
inline
string
make(const string &base_,
const string &suffix_)
{ {
return (base_ + suffix_); return (base_ + suffix_);
} }

View File

@ -26,21 +26,21 @@ namespace fs
uint64_t uint64_t
statvfs_cache_timeout(void); statvfs_cache_timeout(void);
void void
statvfs_cache_timeout(const uint64_t timeout_); statvfs_cache_timeout(const uint64_t timeout);
int int
statvfs_cache(const char *path_, statvfs_cache(const char *path,
struct statvfs *st_); struct statvfs *st);
int int
statvfs_cache_readonly(const std::string &path_, statvfs_cache_readonly(const std::string &path,
bool *readonly_); bool *readonly);
int int
statvfs_cache_spaceavail(const std::string &path_, statvfs_cache_spaceavail(const std::string &path,
uint64_t *spaceavail_); uint64_t *spaceavail);
int int
statvfs_cache_spaceused(const std::string &path_, statvfs_cache_spaceused(const std::string &path,
uint64_t *spaceused_); uint64_t *spaceused);
} }

View File

@ -39,8 +39,8 @@ namespace fs
namespace xattr namespace xattr
{ {
int int
list(const int fd, list(const int fd_,
vector<char> &attrs) vector<char> *attrs_)
{ {
ssize_t rv; ssize_t rv;
@ -48,21 +48,21 @@ namespace fs
errno = ERANGE; errno = ERANGE;
while((rv == -1) && (errno == ERANGE)) while((rv == -1) && (errno == ERANGE))
{ {
rv = fs::flistxattr(fd,NULL,0); rv = fs::flistxattr(fd_,NULL,0);
if(rv <= 0) if(rv <= 0)
return rv; return rv;
attrs.resize(rv); attrs_->resize(rv);
rv = fs::flistxattr(fd,&attrs[0],rv); rv = fs::flistxattr(fd_,&(*attrs_)[0],rv);
} }
return rv; return rv;
} }
int int
list(const string &path, list(const string &path_,
vector<char> &attrs) vector<char> *attrs_)
{ {
ssize_t rv; ssize_t rv;
@ -70,84 +70,84 @@ namespace fs
errno = ERANGE; errno = ERANGE;
while((rv == -1) && (errno == ERANGE)) while((rv == -1) && (errno == ERANGE))
{ {
rv = fs::llistxattr(path,NULL,0); rv = fs::llistxattr(path_,NULL,0);
if(rv <= 0) if(rv <= 0)
return rv; return rv;
attrs.resize(rv); attrs_->resize(rv);
rv = fs::llistxattr(path,&attrs[0],rv); rv = fs::llistxattr(path_,&(*attrs_)[0],rv);
} }
return rv; return rv;
} }
int int
list(const int fd, list(const int fd_,
vector<string> &attrvector) vector<string> *attrvector_)
{ {
int rv; int rv;
vector<char> attrs; vector<char> attrs;
rv = list(fd,attrs); rv = fs::xattr::list(fd_,&attrs);
if(rv != -1) if(rv != -1)
{ {
string tmp(attrs.begin(),attrs.end()); string tmp(attrs.begin(),attrs.end());
str::split(attrvector,tmp,'\0'); str::split(tmp,'\0',attrvector_);
} }
return rv; return rv;
} }
int int
list(const string &path, list(const string &path_,
vector<string> &attrvector) vector<string> *attrvector_)
{ {
int rv; int rv;
vector<char> attrs; vector<char> attrs;
rv = list(path,attrs); rv = fs::xattr::list(path_,&attrs);
if(rv != -1) if(rv != -1)
{ {
string tmp(attrs.begin(),attrs.end()); string tmp(attrs.begin(),attrs.end());
str::split(attrvector,tmp,'\0'); str::split(tmp,'\0',attrvector_);
} }
return rv; return rv;
} }
int int
list(const int fd, list(const int fd_,
string &attrstr) string *attrstr_)
{ {
int rv; int rv;
vector<char> attrs; vector<char> attrs;
rv = list(fd,attrs); rv = fs::xattr::list(fd_,&attrs);
if(rv != -1) if(rv != -1)
attrstr = string(attrs.begin(),attrs.end()); *attrstr_ = string(attrs.begin(),attrs.end());
return rv; return rv;
} }
int int
list(const string &path, list(const string &path_,
string &attrstr) string *attrstr_)
{ {
int rv; int rv;
vector<char> attrs; vector<char> attrs;
rv = list(path,attrs); rv = fs::xattr::list(path_,&attrs);
if(rv != -1) if(rv != -1)
attrstr = string(attrs.begin(),attrs.end()); *attrstr_ = string(attrs.begin(),attrs.end());
return rv; return rv;
} }
int int
get(const int fd, get(const int fd_,
const string &attr, const string &attr_,
vector<char> &value) vector<char> *value_)
{ {
ssize_t rv; ssize_t rv;
@ -155,22 +155,22 @@ namespace fs
errno = ERANGE; errno = ERANGE;
while((rv == -1) && (errno == ERANGE)) while((rv == -1) && (errno == ERANGE))
{ {
rv = fs::fgetxattr(fd,attr,NULL,0); rv = fs::fgetxattr(fd_,attr_,NULL,0);
if(rv <= 0) if(rv <= 0)
return rv; return rv;
value.resize(rv); value_->resize(rv);
rv = fs::fgetxattr(fd,attr,&value[0],rv); rv = fs::fgetxattr(fd_,attr_,&(*value_)[0],rv);
} }
return rv; return rv;
} }
int int
get(const string &path, get(const string &path_,
const string &attr, const string &attr_,
vector<char> &value) vector<char> *value_)
{ {
ssize_t rv; ssize_t rv;
@ -178,56 +178,56 @@ namespace fs
errno = ERANGE; errno = ERANGE;
while((rv == -1) && (errno == ERANGE)) while((rv == -1) && (errno == ERANGE))
{ {
rv = fs::lgetxattr(path,attr,NULL,0); rv = fs::lgetxattr(path_,attr_,NULL,0);
if(rv <= 0) if(rv <= 0)
return rv; return rv;
value.resize(rv); value_->resize(rv);
rv = fs::lgetxattr(path,attr,&value[0],rv); rv = fs::lgetxattr(path_,attr_,&(*value_)[0],rv);
} }
return rv; return rv;
} }
int int
get(const int fd, get(const int fd_,
const string &attr, const string &attr_,
string &value) string *value_)
{ {
int rv; int rv;
vector<char> tmpvalue; vector<char> tmpvalue;
rv = get(fd,attr,tmpvalue); rv = get(fd_,attr_,&tmpvalue);
if(rv != -1) if(rv != -1)
value = string(tmpvalue.begin(),tmpvalue.end()); *value_ = string(tmpvalue.begin(),tmpvalue.end());
return rv; return rv;
} }
int int
get(const string &path, get(const string &path_,
const string &attr, const string &attr_,
string &value) string *value_)
{ {
int rv; int rv;
vector<char> tmpvalue; vector<char> tmpvalue;
rv = get(path,attr,tmpvalue); rv = fs::xattr::get(path_,attr_,&tmpvalue);
if(rv != -1) if(rv != -1)
value = string(tmpvalue.begin(),tmpvalue.end()); *value_ = string(tmpvalue.begin(),tmpvalue.end());
return rv; return rv;
} }
int int
get(const int fd, get(const int fd_,
map<string,string> &attrs) map<string,string> *attrs_)
{ {
int rv; int rv;
string attrstr; string attrstr;
rv = list(fd,attrstr); rv = fs::xattr::list(fd_,&attrstr);
if(rv == -1) if(rv == -1)
return -1; return -1;
@ -239,9 +239,9 @@ namespace fs
{ {
string value; string value;
rv = get(fd,key,value); rv = fs::xattr::get(fd_,key,&value);
if(rv != -1) if(rv != -1)
attrs[key] = value; (*attrs_)[key] = value;
} }
} }
@ -249,13 +249,13 @@ namespace fs
} }
int int
get(const string &path, get(const string &path_,
map<string,string> &attrs) map<string,string> *attrs_)
{ {
int rv; int rv;
string attrstr; string attrstr;
rv = list(path,attrstr); rv = fs::xattr::list(path_,&attrstr);
if(rv == -1) if(rv == -1)
return -1; return -1;
@ -267,9 +267,9 @@ namespace fs
{ {
string value; string value;
rv = get(path,key,value); rv = fs::xattr::get(path_,key,&value);
if(rv != -1) if(rv != -1)
attrs[key] = value; (*attrs_)[key] = value;
} }
} }
@ -277,41 +277,41 @@ namespace fs
} }
int int
set(const int fd, set(const int fd_,
const string &key, const string &key_,
const string &value, const string &value_,
const int flags) const int flags_)
{ {
return fs::fsetxattr(fd, return fs::fsetxattr(fd_,
key.c_str(), key_.c_str(),
value.data(), value_.data(),
value.size(), value_.size(),
flags); flags_);
} }
int int
set(const string &path, set(const string &path_,
const string &key, const string &key_,
const string &value, const string &value_,
const int flags) const int flags_)
{ {
return fs::lsetxattr(path, return fs::lsetxattr(path_,
key, key_,
value.data(), value_.data(),
value.size(), value_.size(),
flags); flags_);
} }
int int
set(const int fd, set(const int fd_,
const map<string,string> &attrs) const map<string,string> &attrs_)
{ {
int rv; int rv;
for(map<string,string>::const_iterator for(map<string,string>::const_iterator
i = attrs.begin(), ei = attrs.end(); i != ei; ++i) i = attrs_.begin(), ei = attrs_.end(); i != ei; ++i)
{ {
rv = set(fd,i->first,i->second,0); rv = fs::xattr::set(fd_,i->first,i->second,0);
if(rv == -1) if(rv == -1)
return -1; return -1;
} }
@ -320,46 +320,46 @@ namespace fs
} }
int int
set(const string &path, set(const string &path_,
const map<string,string> &attrs) const map<string,string> &attrs_)
{ {
int fd; int fd;
fd = fs::open(path,O_RDONLY|O_NONBLOCK); fd = fs::open(path_,O_RDONLY|O_NONBLOCK);
if(fd == -1) if(fd == -1)
return -1; return -1;
set(fd,attrs); fs::xattr::set(fd,attrs_);
return fs::close(fd); return fs::close(fd);
} }
int int
copy(const int fdin, copy(const int fdin_,
const int fdout) const int fdout_)
{ {
int rv; int rv;
map<string,string> attrs; map<string,string> attrs;
rv = get(fdin,attrs); rv = fs::xattr::get(fdin_,&attrs);
if(rv == -1) if(rv == -1)
return -1; return -1;
return set(fdout,attrs); return fs::xattr::set(fdout_,attrs);
} }
int int
copy(const string &from, copy(const string &from_,
const string &to) const string &to_)
{ {
int rv; int rv;
map<string,string> attrs; map<string,string> attrs;
rv = get(from,attrs); rv = fs::xattr::get(from_,&attrs);
if(rv == -1) if(rv == -1)
return -1; return -1;
return set(to,attrs); return fs::xattr::set(to_,attrs);
} }
} }
} }

View File

@ -30,21 +30,21 @@ namespace fs
int list(const string &path, int list(const string &path,
vector<char> &attrs); vector<char> *attrs);
int list(const string &path, int list(const string &path,
string &attrs); string *attrs);
int list(const string &path, int list(const string &path,
vector<string> &attrs); vector<string> *attrs);
int get(const string &path, int get(const string &path,
const string &attr, const string &attr,
vector<char> &value); vector<char> *value);
int get(const string &path, int get(const string &path,
const string &attr, const string &attr,
string &value); string *value);
int get(const string &path, int get(const string &path,
map<string,string> &attrs); map<string,string> *attrs);
int set(const string &path, int set(const string &path,
const string &key, const string &key,

View File

@ -19,6 +19,6 @@
namespace FUSE namespace FUSE
{ {
int int
access(const char *fusepath_, access(const char *fusepath,
int mask_); int mask);
} }

View File

@ -19,6 +19,6 @@
namespace FUSE namespace FUSE
{ {
int int
chmod(const char *fusepath_, chmod(const char *fusepath,
mode_t mode_); mode_t mode);
} }

View File

@ -19,7 +19,7 @@
namespace FUSE namespace FUSE
{ {
int int
chown(const char *fusepath_, chown(const char *fusepath,
uid_t uid_, uid_t uid,
gid_t gid_); gid_t gid);
} }

View File

@ -23,7 +23,7 @@
namespace FUSE namespace FUSE
{ {
int int
create(const char *fusepath_, create(const char *fusepath,
mode_t mode_, mode_t mode,
fuse_file_info *ffi_); fuse_file_info *ffi);
} }

View File

@ -16,11 +16,13 @@
#pragma once #pragma once
#include "fuse.h"
namespace FUSE namespace FUSE
{ {
int int
fallocate(int mode_, fallocate(int mode,
off_t offset_, off_t offset,
off_t len_, off_t len,
fuse_file_info *ffi_); fuse_file_info *ffi);
} }

View File

@ -23,6 +23,6 @@
namespace FUSE namespace FUSE
{ {
int int
fchmod(const struct fuse_file_info *ffi_, fchmod(const fuse_file_info *ffi,
const mode_t mode_); const mode_t mode);
} }

View File

@ -21,7 +21,7 @@
namespace FUSE namespace FUSE
{ {
int int
fchown(const struct fuse_file_info *ffi_, fchown(const fuse_file_info *ffi,
uid_t uid_, uid_t uid,
gid_t gid_); gid_t gid);
} }

View File

@ -21,7 +21,7 @@
namespace FUSE namespace FUSE
{ {
int int
flock(const char *fusepath_, flock(const char *fusepath,
fuse_file_info *ffi_, fuse_file_info *ffi,
int op_); int op);
} }

View File

@ -21,5 +21,5 @@
namespace FUSE namespace FUSE
{ {
int int
flush(fuse_file_info *ffi_); flush(fuse_file_info *ffi);
} }

View File

@ -23,5 +23,5 @@
namespace FUSE namespace FUSE
{ {
int int
free_hide(const uint64_t fh_); free_hide(const uint64_t fh);
} }

View File

@ -21,6 +21,6 @@
namespace FUSE namespace FUSE
{ {
int int
fsync(int isdatasync_, fsync(int isdatasync,
fuse_file_info *ffi_); fuse_file_info *ffi);
} }

View File

@ -21,6 +21,6 @@
namespace FUSE namespace FUSE
{ {
int int
fsyncdir(int isdatasync_, fsyncdir(int isdatasync,
fuse_file_info *ffi_); fuse_file_info *ffi);
} }

View File

@ -24,6 +24,6 @@
namespace FUSE namespace FUSE
{ {
int int
ftruncate(off_t size_, ftruncate(off_t size,
fuse_file_info *ffi_); fuse_file_info *ffi);
} }

View File

@ -23,6 +23,6 @@
namespace FUSE namespace FUSE
{ {
int int
futimens(const struct fuse_file_info *ffi_, futimens(const fuse_file_info *ffi,
const timespec ts_[2]); const timespec ts[2]);
} }

View File

@ -63,10 +63,10 @@ namespace l
static static
int int
getxattr_controlfile(const Config &config, getxattr_controlfile(const Config &config_,
const char *attrname, const char *attrname_,
char *buf, char *buf_,
const size_t count) const size_t count_)
{ {
int rv; int rv;
size_t len; size_t len;
@ -74,42 +74,42 @@ namespace l
string val; string val;
vector<string> attr; vector<string> attr;
if(!str::startswith(attrname,"user.mergerfs.")) if(!str::startswith(attrname_,"user.mergerfs."))
return -ENOATTR; return -ENOATTR;
key = &attrname[14]; key = &attrname_[14];
rv = config.get(key,&val); rv = config_.get(key,&val);
if(rv < 0) if(rv < 0)
return rv; return rv;
len = val.size(); len = val.size();
if(count == 0) if(count_ == 0)
return len; return len;
if(count < len) if(count_ < len)
return -ERANGE; return -ERANGE;
memcpy(buf,val.c_str(),len); memcpy(buf_,val.c_str(),len);
return (int)len; return (int)len;
} }
static static
int int
getxattr_from_string(char *destbuf, getxattr_from_string(char *destbuf_,
const size_t destbufsize, const size_t destbufsize_,
const string &src) const string &src_)
{ {
const size_t srcbufsize = src.size(); const size_t srcbufsize = src_.size();
if(destbufsize == 0) if(destbufsize_ == 0)
return srcbufsize; return srcbufsize;
if(srcbufsize > destbufsize) if(srcbufsize > destbufsize_)
return -ERANGE; return -ERANGE;
memcpy(destbuf,src.data(),srcbufsize); memcpy(destbuf_,src_.data(),srcbufsize);
return srcbufsize; return srcbufsize;
} }
@ -117,9 +117,9 @@ namespace l
static static
int int
getxattr_user_mergerfs_allpaths(const Branches &branches_, getxattr_user_mergerfs_allpaths(const Branches &branches_,
const char *fusepath, const char *fusepath_,
char *buf, char *buf_,
const size_t count) const size_t count_)
{ {
string concated; string concated;
vector<string> paths; vector<string> paths;
@ -127,90 +127,90 @@ namespace l
branches_.to_paths(branches); branches_.to_paths(branches);
fs::findallfiles(branches,fusepath,paths); fs::findallfiles(branches,fusepath_,&paths);
concated = str::join(paths,'\0'); concated = str::join(paths,'\0');
return l::getxattr_from_string(buf,count,concated); return l::getxattr_from_string(buf_,count_,concated);
} }
static static
int int
getxattr_user_mergerfs(const string &basepath, getxattr_user_mergerfs(const string &basepath_,
const char *fusepath, const char *fusepath_,
const string &fullpath, const string &fullpath_,
const Branches &branches_, const Branches &branches_,
const char *attrname, const char *attrname_,
char *buf, char *buf_,
const size_t count) const size_t count_)
{ {
vector<string> attr; vector<string> attr;
str::split(attr,attrname,'.'); str::split(attrname_,'.',&attr);
if(attr[2] == "basepath") if(attr[2] == "basepath")
return l::getxattr_from_string(buf,count,basepath); return l::getxattr_from_string(buf_,count_,basepath_);
else if(attr[2] == "relpath") else if(attr[2] == "relpath")
return l::getxattr_from_string(buf,count,fusepath); return l::getxattr_from_string(buf_,count_,fusepath_);
else if(attr[2] == "fullpath") else if(attr[2] == "fullpath")
return l::getxattr_from_string(buf,count,fullpath); return l::getxattr_from_string(buf_,count_,fullpath_);
else if(attr[2] == "allpaths") else if(attr[2] == "allpaths")
return l::getxattr_user_mergerfs_allpaths(branches_,fusepath,buf,count); return l::getxattr_user_mergerfs_allpaths(branches_,fusepath_,buf_,count_);
return -ENOATTR; return -ENOATTR;
} }
static static
int int
getxattr(Policy::Func::Search searchFunc, getxattr(Policy::Func::Search searchFunc_,
const Branches &branches_, const Branches &branches_,
const size_t minfreespace, const size_t minfreespace_,
const char *fusepath, const char *fusepath_,
const char *attrname, const char *attrname_,
char *buf, char *buf_,
const size_t count) const size_t count_)
{ {
int rv; int rv;
string fullpath; string fullpath;
vector<string> basepaths; vector<string> basepaths;
rv = searchFunc(branches_,fusepath,minfreespace,&basepaths); rv = searchFunc_(branches_,fusepath_,minfreespace_,&basepaths);
if(rv == -1) if(rv == -1)
return -errno; return -errno;
fullpath = fs::path::make(basepaths[0],fusepath); fullpath = fs::path::make(basepaths[0],fusepath_);
if(str::startswith(attrname,"user.mergerfs.")) if(str::startswith(attrname_,"user.mergerfs."))
return l::getxattr_user_mergerfs(basepaths[0], return l::getxattr_user_mergerfs(basepaths[0],
fusepath, fusepath_,
fullpath, fullpath,
branches_, branches_,
attrname, attrname_,
buf, buf_,
count); count_);
return l::lgetxattr(fullpath,attrname,buf,count); return l::lgetxattr(fullpath,attrname_,buf_,count_);
} }
} }
namespace FUSE namespace FUSE
{ {
int int
getxattr(const char *fusepath, getxattr(const char *fusepath_,
const char *attrname, const char *attrname_,
char *buf, char *buf_,
size_t count) size_t count_)
{ {
const Config &config = Config::ro(); const Config &config = Config::ro();
if(fusepath == config.controlfile) if(fusepath_ == config.controlfile)
return l::getxattr_controlfile(config, return l::getxattr_controlfile(config,
attrname, attrname_,
buf, buf_,
count); count_);
if((config.security_capability == false) && if((config.security_capability == false) &&
l::is_attrname_security_capability(attrname)) l::is_attrname_security_capability(attrname_))
return -ENOATTR; return -ENOATTR;
if(config.xattr.to_int()) if(config.xattr.to_int())
@ -222,9 +222,9 @@ namespace FUSE
return l::getxattr(config.func.getxattr.policy, return l::getxattr(config.func.getxattr.policy,
config.branches, config.branches,
config.minfreespace, config.minfreespace,
fusepath, fusepath_,
attrname, attrname_,
buf, buf_,
count); count_);
} }
} }

View File

@ -19,8 +19,8 @@
namespace FUSE namespace FUSE
{ {
int int
getxattr(const char *fusepath_, getxattr(const char *fusepath,
const char *attrname_, const char *attrname,
char *buf_, char *buf,
size_t count_); size_t count);
} }

View File

@ -21,5 +21,5 @@
namespace FUSE namespace FUSE
{ {
void * void *
init(fuse_conn_info *conn_); init(fuse_conn_info *conn);
} }

View File

@ -344,7 +344,7 @@ namespace l
config.branches.to_paths(branches); config.branches.to_paths(branches);
fs::findallfiles(branches,fusepath.c_str(),paths); fs::findallfiles(branches,fusepath.c_str(),&paths);
concated = str::join(paths,'\0'); concated = str::join(paths,'\0');

View File

@ -21,10 +21,10 @@
namespace FUSE namespace FUSE
{ {
int int
ioctl(unsigned long cmd_, ioctl(unsigned long cmd,
void *arg_, void *arg,
fuse_file_info *ffi_, fuse_file_info *ffi,
unsigned int flags_, unsigned int flags,
void *data_, void *data,
uint32_t *out_bufsz_); uint32_t *out_bufsz);
} }

View File

@ -44,8 +44,8 @@ namespace l
string oldfullpath; string oldfullpath;
string newfullpath; string newfullpath;
oldfullpath = fs::path::make(&oldbasepath_,oldfusepath_); oldfullpath = fs::path::make(oldbasepath_,oldfusepath_);
newfullpath = fs::path::make(&oldbasepath_,newfusepath_); newfullpath = fs::path::make(oldbasepath_,newfusepath_);
rv = fs::link(oldfullpath,newfullpath); rv = fs::link(oldfullpath,newfullpath);
@ -152,8 +152,8 @@ namespace l
string oldfullpath; string oldfullpath;
string newfullpath; string newfullpath;
oldfullpath = fs::path::make(&oldbasepath_,oldfusepath_); oldfullpath = fs::path::make(oldbasepath_,oldfusepath_);
newfullpath = fs::path::make(&oldbasepath_,newfusepath_); newfullpath = fs::path::make(oldbasepath_,newfusepath_);
rv = fs::link(oldfullpath,newfullpath); rv = fs::link(oldfullpath,newfullpath);
if((rv == -1) && (errno == ENOENT)) if((rv == -1) && (errno == ENOENT))

View File

@ -19,6 +19,6 @@
namespace FUSE namespace FUSE
{ {
int int
link(const char *from_, link(const char *from,
const char *to_); const char *to);
} }

View File

@ -19,7 +19,7 @@
namespace FUSE namespace FUSE
{ {
int int
listxattr(const char *fusepath_, listxattr(const char *fusepath,
char *buf_, char *buf,
size_t count_); size_t count);
} }

View File

@ -19,6 +19,6 @@
namespace FUSE namespace FUSE
{ {
int int
mkdir(const char *fusepath_, mkdir(const char *fusepath,
mode_t mode_); mode_t mode);
} }

View File

@ -59,7 +59,7 @@ namespace l
int rv; int rv;
string fullpath; string fullpath;
fullpath = fs::path::make(&createpath_,fusepath_); fullpath = fs::path::make(createpath_,fusepath_);
rv = l::mknod_core(fullpath,mode_,umask_,dev_); rv = l::mknod_core(fullpath,mode_,umask_,dev_);

View File

@ -20,7 +20,7 @@
namespace FUSE namespace FUSE
{ {
int int
mknod(const char *fusepath_, mknod(const char *fusepath,
mode_t mode_, mode_t mode,
dev_t rdev_); dev_t rdev);
} }

View File

@ -21,6 +21,6 @@
namespace FUSE namespace FUSE
{ {
int int
open(const char *fusepath_, open(const char *fusepath,
fuse_file_info *ffi_); fuse_file_info *ffi);
} }

View File

@ -21,6 +21,6 @@
namespace FUSE namespace FUSE
{ {
int int
opendir(const char *fusepath_, opendir(const char *fusepath,
fuse_file_info *ffi_); fuse_file_info *ffi);
} }

View File

@ -23,6 +23,6 @@
namespace FUSE namespace FUSE
{ {
int int
prepare_hide(const char *name_, prepare_hide(const char *name,
uint64_t *fh_); uint64_t *fh);
} }

View File

@ -21,14 +21,14 @@
namespace FUSE namespace FUSE
{ {
int int
read(char *buf_, read(char *buf,
size_t count_, size_t count,
off_t offset_, off_t offset,
fuse_file_info *ffi_); fuse_file_info *ffi);
int int
read_null(char *buf_, read_null(char *buf,
size_t count_, size_t count,
off_t offset_, off_t offset,
fuse_file_info *ffi_); fuse_file_info *ffi);
} }

View File

@ -23,8 +23,8 @@
namespace FUSE namespace FUSE
{ {
int int
read_buf(struct fuse_bufvec **buf_, read_buf(struct fuse_bufvec **buf,
size_t size_, size_t size,
off_t offset_, off_t offset,
fuse_file_info *ffi_); fuse_file_info *ffi);
} }

View File

@ -21,6 +21,6 @@
namespace FUSE namespace FUSE
{ {
int int
readdir(fuse_file_info *ffi_, readdir(fuse_file_info *ffi,
fuse_dirents_t *buf_); fuse_dirents_t *buf);
} }

View File

@ -74,7 +74,7 @@ namespace l
int dirfd; int dirfd;
int64_t nread; int64_t nread;
basepath = fs::path::make(&branches_[i].path,dirname_); basepath = fs::path::make(branches_[i].path,dirname_);
dirfd = fs::open_dir_ro(basepath); dirfd = fs::open_dir_ro(basepath);
if(dirfd == -1) if(dirfd == -1)
@ -86,7 +86,7 @@ namespace l
for(;;) for(;;)
{ {
nread = fs::getdents(dirfd,buf,g_DENTS_BUF_POOL.size()); nread = fs::getdents64(dirfd,buf,g_DENTS_BUF_POOL.size());
if(nread == -1) if(nread == -1)
break; break;
if(nread == 0) if(nread == 0)

View File

@ -21,6 +21,6 @@
namespace FUSE namespace FUSE
{ {
int int
readdir_plus(fuse_file_info *ffi_, readdir_plus(fuse_file_info *ffi,
fuse_dirents_t *buf_); fuse_dirents_t *buf);
} }

View File

@ -83,7 +83,7 @@ namespace l
int dirfd; int dirfd;
int64_t nread; int64_t nread;
basepath = fs::path::make(&branches_[i].path,dirname_); basepath = fs::path::make(branches_[i].path,dirname_);
dirfd = fs::open_dir_ro(basepath); dirfd = fs::open_dir_ro(basepath);
if(dirfd == -1) if(dirfd == -1)
@ -95,7 +95,7 @@ namespace l
for(;;) for(;;)
{ {
nread = fs::getdents(dirfd,buf,g_DENTS_BUF_POOL.size()); nread = fs::getdents64(dirfd,buf,g_DENTS_BUF_POOL.size());
if(nread == -1) if(nread == -1)
break; break;
if(nread == 0) if(nread == 0)

View File

@ -27,9 +27,9 @@
namespace FUSE namespace FUSE
{ {
int int
readdir_plus_linux(const Branches &branches_, readdir_plus_linux(const Branches &branches,
const char *dirname_, const char *dirname,
const uint64_t entry_timeout_, const uint64_t entry_timeout,
const uint64_t attr_timeout_, const uint64_t attr_timeout,
fuse_dirents_t *buf_); fuse_dirents_t *buf);
} }

View File

@ -83,7 +83,7 @@ namespace l
int dirfd; int dirfd;
DIR *dh; DIR *dh;
basepath = fs::path::make(&branches_[i].path,dirname_); basepath = fs::path::make(branches_[i].path,dirname_);
dh = fs::opendir(basepath); dh = fs::opendir(basepath);
if(!dh) if(!dh)

View File

@ -27,9 +27,9 @@
namespace FUSE namespace FUSE
{ {
int int
readdir_plus_posix(const Branches &branches_, readdir_plus_posix(const Branches &branches,
const char *dirname_, const char *dirname,
const uint64_t entry_timeout_, const uint64_t entry_timeout,
const uint64_t attr_timeout_, const uint64_t attr_timeout,
fuse_dirents_t *buf_); fuse_dirents_t *buf);
} }

View File

@ -72,7 +72,7 @@ namespace l
int dirfd; int dirfd;
DIR *dh; DIR *dh;
basepath = fs::path::make(&branches_[i].path,dirname_); basepath = fs::path::make(branches_[i].path,dirname_);
dh = fs::opendir(basepath); dh = fs::opendir(basepath);
if(!dh) if(!dh)

View File

@ -19,7 +19,7 @@
namespace FUSE namespace FUSE
{ {
int int
readlink(const char *fusepath_, readlink(const char *fusepath,
char *buf_, char *buf,
size_t size_); size_t size);
} }

View File

@ -21,5 +21,5 @@
namespace FUSE namespace FUSE
{ {
int int
release(fuse_file_info *ffi_); release(fuse_file_info *ffi);
} }

View File

@ -21,5 +21,5 @@
namespace FUSE namespace FUSE
{ {
int int
releasedir(fuse_file_info *ffi_); releasedir(fuse_file_info *ffi);
} }

View File

@ -19,6 +19,6 @@
namespace FUSE namespace FUSE
{ {
int int
removexattr(const char *fusepath_, removexattr(const char *fusepath,
const char *attrname_); const char *attrname);
} }

View File

@ -19,6 +19,6 @@
namespace FUSE namespace FUSE
{ {
int int
rename(const char *from_, rename(const char *from,
const char *to_); const char *to);
} }

View File

@ -19,5 +19,5 @@
namespace FUSE namespace FUSE
{ {
int int
rmdir(const char *fusepath_); rmdir(const char *fusepath);
} }

View File

@ -19,9 +19,9 @@
namespace FUSE namespace FUSE
{ {
int int
setxattr(const char *fusepath_, setxattr(const char *fusepath,
const char *attrname_, const char *attrname,
const char *attrval_, const char *attrval,
size_t attrvalsize_, size_t attrvalize,
int flags_); int flags);
} }

View File

@ -99,7 +99,7 @@ namespace l
for(size_t i = 0, ei = branches_.size(); i < ei; i++) for(size_t i = 0, ei = branches_.size(); i < ei; i++)
{ {
fullpath = ((mode_ == StatFS::ENUM::FULL) ? fullpath = ((mode_ == StatFS::ENUM::FULL) ?
fs::path::make(&branches_[i].path,fusepath_) : fs::path::make(branches_[i].path,fusepath_) :
branches_[i].path); branches_[i].path);
rv = fs::lstat(fullpath,&st); rv = fs::lstat(fullpath,&st);

View File

@ -21,6 +21,6 @@
namespace FUSE namespace FUSE
{ {
int int
statfs(const char *fusepath_, statfs(const char *fusepath,
struct statvfs *fsstat_); struct statvfs *fsstat);
} }

View File

@ -44,7 +44,7 @@ namespace l
int rv; int rv;
string fullnewpath; string fullnewpath;
fullnewpath = fs::path::make(&newbasepath_,newpath_); fullnewpath = fs::path::make(newbasepath_,newpath_);
rv = fs::symlink(oldpath_,fullnewpath); rv = fs::symlink(oldpath_,fullnewpath);

View File

@ -19,6 +19,6 @@
namespace FUSE namespace FUSE
{ {
int int
symlink(const char *oldpath_, symlink(const char *oldpath,
const char *newpath_); const char *newpath);
} }

View File

@ -21,6 +21,6 @@
namespace FUSE namespace FUSE
{ {
int int
truncate(const char *fusepath_, truncate(const char *fusepath,
off_t size_); off_t size);
} }

View File

@ -19,5 +19,5 @@
namespace FUSE namespace FUSE
{ {
int int
unlink(const char *fusepath_); unlink(const char *fusepath);
} }

View File

@ -21,6 +21,6 @@
namespace FUSE namespace FUSE
{ {
int int
utimens(const char *fusepath_, utimens(const char *fusepath,
const timespec ts_[2]); const timespec ts[2]);
} }

View File

@ -21,14 +21,14 @@
namespace FUSE namespace FUSE
{ {
int int
write(const char *buf_, write(const char *buf,
size_t count_, size_t count,
off_t offset_, off_t offset,
fuse_file_info *ffi_); fuse_file_info *ffi);
int int
write_null(const char *buf_, write_null(const char *buf,
size_t count_, size_t count,
off_t offset_, off_t offset,
fuse_file_info *ffi_); fuse_file_info *ffi);
} }

View File

@ -23,12 +23,12 @@
namespace FUSE namespace FUSE
{ {
int int
write_buf(struct fuse_bufvec *buf_, write_buf(struct fuse_bufvec *buf,
off_t offset_, off_t offset,
fuse_file_info *ffi_); fuse_file_info *ffi);
int int
write_buf_null(struct fuse_bufvec *buf_, write_buf_null(struct fuse_bufvec *buf,
off_t offset_, off_t offset,
fuse_file_info *ffi_); fuse_file_info *ffi);
} }

View File

@ -77,59 +77,59 @@ namespace l
{ {
static static
void void
get_fuse_operations(struct fuse_operations &ops, get_fuse_operations(struct fuse_operations &ops_,
const bool nullrw) const bool nullrw_)
{ {
ops.access = FUSE::access; ops_.access = FUSE::access;
ops.bmap = NULL; ops_.bmap = NULL;
ops.chmod = FUSE::chmod; ops_.chmod = FUSE::chmod;
ops.chown = FUSE::chown; ops_.chown = FUSE::chown;
ops.copy_file_range = FUSE::copy_file_range; ops_.copy_file_range = FUSE::copy_file_range;
ops.create = FUSE::create; ops_.create = FUSE::create;
ops.destroy = FUSE::destroy; ops_.destroy = FUSE::destroy;
ops.fallocate = FUSE::fallocate; ops_.fallocate = FUSE::fallocate;
ops.fchmod = FUSE::fchmod; ops_.fchmod = FUSE::fchmod;
ops.fchown = FUSE::fchown; ops_.fchown = FUSE::fchown;
ops.fgetattr = FUSE::fgetattr; ops_.fgetattr = FUSE::fgetattr;
ops.flock = NULL; // FUSE::flock; ops_.flock = NULL; // FUSE::flock;
ops.flush = FUSE::flush; ops_.flush = FUSE::flush;
ops.free_hide = FUSE::free_hide; ops_.free_hide = FUSE::free_hide;
ops.fsync = FUSE::fsync; ops_.fsync = FUSE::fsync;
ops.fsyncdir = FUSE::fsyncdir; ops_.fsyncdir = FUSE::fsyncdir;
ops.ftruncate = FUSE::ftruncate; ops_.ftruncate = FUSE::ftruncate;
ops.futimens = FUSE::futimens; ops_.futimens = FUSE::futimens;
ops.getattr = FUSE::getattr; ops_.getattr = FUSE::getattr;
ops.getxattr = FUSE::getxattr; ops_.getxattr = FUSE::getxattr;
ops.init = FUSE::init; ops_.init = FUSE::init;
ops.ioctl = FUSE::ioctl; ops_.ioctl = FUSE::ioctl;
ops.link = FUSE::link; ops_.link = FUSE::link;
ops.listxattr = FUSE::listxattr; ops_.listxattr = FUSE::listxattr;
ops.lock = NULL; ops_.lock = NULL;
ops.mkdir = FUSE::mkdir; ops_.mkdir = FUSE::mkdir;
ops.mknod = FUSE::mknod; ops_.mknod = FUSE::mknod;
ops.open = FUSE::open; ops_.open = FUSE::open;
ops.opendir = FUSE::opendir; ops_.opendir = FUSE::opendir;
ops.poll = NULL; ops_.poll = NULL;
ops.prepare_hide = FUSE::prepare_hide; ops_.prepare_hide = FUSE::prepare_hide;
ops.read = (nullrw ? FUSE::read_null : FUSE::read); ops_.read = (nullrw_ ? FUSE::read_null : FUSE::read);
ops.read_buf = (nullrw ? NULL : FUSE::read_buf); ops_.read_buf = (nullrw_ ? NULL : FUSE::read_buf);
ops.readdir = FUSE::readdir; ops_.readdir = FUSE::readdir;
ops.readdir_plus = FUSE::readdir_plus; ops_.readdir_plus = FUSE::readdir_plus;
ops.readlink = FUSE::readlink; ops_.readlink = FUSE::readlink;
ops.release = FUSE::release; ops_.release = FUSE::release;
ops.releasedir = FUSE::releasedir; ops_.releasedir = FUSE::releasedir;
ops.removexattr = FUSE::removexattr; ops_.removexattr = FUSE::removexattr;
ops.rename = FUSE::rename; ops_.rename = FUSE::rename;
ops.rmdir = FUSE::rmdir; ops_.rmdir = FUSE::rmdir;
ops.setxattr = FUSE::setxattr; ops_.setxattr = FUSE::setxattr;
ops.statfs = FUSE::statfs; ops_.statfs = FUSE::statfs;
ops.symlink = FUSE::symlink; ops_.symlink = FUSE::symlink;
ops.truncate = FUSE::truncate; ops_.truncate = FUSE::truncate;
ops.unlink = FUSE::unlink; ops_.unlink = FUSE::unlink;
ops.utime = NULL; /* deprecated; use utimens() */ ops_.utime = NULL; /* deprecated; use utimens() */
ops.utimens = FUSE::utimens; ops_.utimens = FUSE::utimens;
ops.write = (nullrw ? FUSE::write_null : FUSE::write); ops_.write = (nullrw_ ? FUSE::write_null : FUSE::write);
ops.write_buf = (nullrw ? FUSE::write_buf_null : FUSE::write_buf); ops_.write_buf = (nullrw_ ? FUSE::write_buf_null : FUSE::write_buf);
return; return;
} }
@ -182,8 +182,8 @@ namespace l
} }
int int
main(int argc, main(int argc_,
char **argv) char **argv_)
{ {
return l::main(argc,argv); return l::main(argc_,argv_);
} }

View File

@ -22,7 +22,7 @@
namespace num namespace num
{ {
int to_uint64_t(const std::string &str_, uint64_t &value_); int to_uint64_t(const std::string &str, uint64_t *value);
int to_double(const std::string &str_, double *value_); int to_double(const std::string &str, double *value);
int to_time_t(const std::string &str_, time_t &value_); int to_time_t(const std::string &str, time_t *value);
} }

View File

@ -50,7 +50,7 @@ namespace all
if(branch->ro_or_nc()) if(branch->ro_or_nc())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(branch->path,&info);
if(rv == -1) if(rv == -1)
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(info.readonly) if(info.readonly)

View File

@ -41,16 +41,16 @@ public:
PolicyCache(void); PolicyCache(void);
public: public:
void erase(const char *fusepath_); void erase(const char *fusepath);
void cleanup(const int prob_ = 1); void cleanup(const int prob = 1);
void clear(void); void clear(void);
public: public:
int operator()(Policy::Func::Search &func_, int operator()(Policy::Func::Search &func,
const Branches &branches_, const Branches &branches,
const char *fusepath_, const char *fusepath,
const uint64_t minfreespace_, const uint64_t minfreespace,
std::string *branch_); std::string *branch);
public: public:
uint64_t timeout; uint64_t timeout;

View File

@ -35,9 +35,9 @@ namespace epall
static static
int int
create(const Branches &branches_, create(const Branches &branches_,
const char *fusepath, const char *fusepath_,
const uint64_t minfreespace, const uint64_t minfreespace_,
vector<string> *paths) vector<string> *paths_)
{ {
rwlock::ReadGuard guard(&branches_.lock); rwlock::ReadGuard guard(&branches_.lock);
@ -51,22 +51,22 @@ namespace epall
{ {
branch = &branches_[i]; branch = &branches_[i];
if(!fs::exists(branch->path,fusepath)) if(!fs::exists(branch->path,fusepath_))
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(branch->ro_or_nc()) if(branch->ro_or_nc())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(branch->path,&info);
if(rv == -1) if(rv == -1)
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(info.readonly) if(info.readonly)
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
if(info.spaceavail < minfreespace) if(info.spaceavail < minfreespace_)
error_and_continue(error,ENOSPC); error_and_continue(error,ENOSPC);
paths->push_back(branch->path); paths_->push_back(branch->path);
} }
if(paths->empty()) if(paths_->empty())
return (errno=error,-1); return (errno=error,-1);
return 0; return 0;
@ -75,8 +75,8 @@ namespace epall
static static
int int
action(const Branches &branches_, action(const Branches &branches_,
const char *fusepath, const char *fusepath_,
vector<string> *paths) vector<string> *paths_)
{ {
rwlock::ReadGuard guard(&branches_.lock); rwlock::ReadGuard guard(&branches_.lock);
@ -90,7 +90,7 @@ namespace epall
{ {
branch = &branches_[i]; branch = &branches_[i];
if(!fs::exists(branch->path,fusepath)) if(!fs::exists(branch->path,fusepath_))
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(branch->ro()) if(branch->ro())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
@ -100,10 +100,10 @@ namespace epall
if(readonly) if(readonly)
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
paths->push_back(branch->path); paths_->push_back(branch->path);
} }
if(paths->empty()) if(paths_->empty())
return (errno=error,-1); return (errno=error,-1);
return 0; return 0;
@ -112,8 +112,8 @@ namespace epall
static static
int int
search(const Branches &branches_, search(const Branches &branches_,
const char *fusepath, const char *fusepath_,
vector<string> *paths) vector<string> *paths_)
{ {
rwlock::ReadGuard guard(&branches_.lock); rwlock::ReadGuard guard(&branches_.lock);
@ -123,13 +123,13 @@ namespace epall
{ {
branch = &branches_[i]; branch = &branches_[i];
if(!fs::exists(branch->path,fusepath)) if(!fs::exists(branch->path,fusepath_))
continue; continue;
paths->push_back(branch->path); paths_->push_back(branch->path);
} }
if(paths->empty()) if(paths_->empty())
return (errno=ENOENT,-1); return (errno=ENOENT,-1);
return 0; return 0;
@ -137,20 +137,20 @@ namespace epall
} }
int int
Policy::Func::epall(const Category type, Policy::Func::epall(const Category type_,
const Branches &branches_, const Branches &branches_,
const char *fusepath, const char *fusepath_,
const uint64_t minfreespace, const uint64_t minfreespace_,
vector<string> *paths) vector<string> *paths_)
{ {
switch(type) switch(type_)
{ {
case Category::CREATE: case Category::CREATE:
return epall::create(branches_,fusepath,minfreespace,paths); return epall::create(branches_,fusepath_,minfreespace_,paths_);
case Category::ACTION: case Category::ACTION:
return epall::action(branches_,fusepath,paths); return epall::action(branches_,fusepath_,paths_);
case Category::SEARCH: case Category::SEARCH:
default: default:
return epall::search(branches_,fusepath,paths); return epall::search(branches_,fusepath_,paths_);
} }
} }

View File

@ -55,7 +55,7 @@ namespace epff
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(branch->ro_or_nc()) if(branch->ro_or_nc())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(branch->path,&info);
if(rv == -1) if(rv == -1)
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(info.readonly) if(info.readonly)

View File

@ -36,9 +36,9 @@ namespace eplfs
static static
int int
create(const Branches &branches_, create(const Branches &branches_,
const char *fusepath, const char *fusepath_,
const uint64_t minfreespace, const uint64_t minfreespace_,
vector<string> *paths) vector<string> *paths_)
{ {
rwlock::ReadGuard guard(&branches_.lock); rwlock::ReadGuard guard(&branches_.lock);
@ -56,16 +56,16 @@ namespace eplfs
{ {
branch = &branches_[i]; branch = &branches_[i];
if(!fs::exists(branch->path,fusepath)) if(!fs::exists(branch->path,fusepath_))
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(branch->ro_or_nc()) if(branch->ro_or_nc())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(branch->path,&info);
if(rv == -1) if(rv == -1)
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(info.readonly) if(info.readonly)
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
if(info.spaceavail < minfreespace) if(info.spaceavail < minfreespace_)
error_and_continue(error,ENOSPC); error_and_continue(error,ENOSPC);
if(info.spaceavail > eplfs) if(info.spaceavail > eplfs)
continue; continue;
@ -77,7 +77,7 @@ namespace eplfs
if(eplfsbasepath == NULL) if(eplfsbasepath == NULL)
return (errno=error,-1); return (errno=error,-1);
paths->push_back(*eplfsbasepath); paths_->push_back(*eplfsbasepath);
return 0; return 0;
} }
@ -85,8 +85,8 @@ namespace eplfs
static static
int int
action(const Branches &branches_, action(const Branches &branches_,
const char *fusepath, const char *fusepath_,
vector<string> *paths) vector<string> *paths_)
{ {
rwlock::ReadGuard guard(&branches_.lock); rwlock::ReadGuard guard(&branches_.lock);
@ -104,11 +104,11 @@ namespace eplfs
{ {
branch = &branches_[i]; branch = &branches_[i];
if(!fs::exists(branch->path,fusepath)) if(!fs::exists(branch->path,fusepath_))
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(branch->ro()) if(branch->ro())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(branch->path,&info);
if(rv == -1) if(rv == -1)
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(info.readonly) if(info.readonly)
@ -123,7 +123,7 @@ namespace eplfs
if(eplfsbasepath == NULL) if(eplfsbasepath == NULL)
return (errno=error,-1); return (errno=error,-1);
paths->push_back(*eplfsbasepath); paths_->push_back(*eplfsbasepath);
return 0; return 0;
} }
@ -131,8 +131,8 @@ namespace eplfs
static static
int int
search(const Branches &branches_, search(const Branches &branches_,
const char *fusepath, const char *fusepath_,
vector<string> *paths) vector<string> *paths_)
{ {
rwlock::ReadGuard guard(&branches_.lock); rwlock::ReadGuard guard(&branches_.lock);
@ -148,7 +148,7 @@ namespace eplfs
{ {
branch = &branches_[i]; branch = &branches_[i];
if(!fs::exists(branch->path,fusepath)) if(!fs::exists(branch->path,fusepath_))
continue; continue;
rv = fs::statvfs_cache_spaceavail(branch->path,&spaceavail); rv = fs::statvfs_cache_spaceavail(branch->path,&spaceavail);
if(rv == -1) if(rv == -1)
@ -163,27 +163,27 @@ namespace eplfs
if(eplfsbasepath == NULL) if(eplfsbasepath == NULL)
return (errno=ENOENT,-1); return (errno=ENOENT,-1);
paths->push_back(*eplfsbasepath); paths_->push_back(*eplfsbasepath);
return 0; return 0;
} }
} }
int int
Policy::Func::eplfs(const Category type, Policy::Func::eplfs(const Category type_,
const Branches &branches_, const Branches &branches_,
const char *fusepath, const char *fusepath_,
const uint64_t minfreespace, const uint64_t minfreespace_,
vector<string> *paths) vector<string> *paths_)
{ {
switch(type) switch(type_)
{ {
case Category::CREATE: case Category::CREATE:
return eplfs::create(branches_,fusepath,minfreespace,paths); return eplfs::create(branches_,fusepath_,minfreespace_,paths_);
case Category::ACTION: case Category::ACTION:
return eplfs::action(branches_,fusepath,paths); return eplfs::action(branches_,fusepath_,paths_);
case Category::SEARCH: case Category::SEARCH:
default: default:
return eplfs::search(branches_,fusepath,paths); return eplfs::search(branches_,fusepath_,paths_);
} }
} }

View File

@ -36,9 +36,9 @@ namespace eplus
static static
int int
create(const Branches &branches_, create(const Branches &branches_,
const char *fusepath, const char *fusepath_,
const uint64_t minfreespace, const uint64_t minfreespace_,
vector<string> *paths) vector<string> *paths_)
{ {
rwlock::ReadGuard guard(&branches_.lock); rwlock::ReadGuard guard(&branches_.lock);
@ -56,16 +56,16 @@ namespace eplus
{ {
branch = &branches_[i]; branch = &branches_[i];
if(!fs::exists(branch->path,fusepath)) if(!fs::exists(branch->path,fusepath_))
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(branch->ro_or_nc()) if(branch->ro_or_nc())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(branch->path,&info);
if(rv == -1) if(rv == -1)
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(info.readonly) if(info.readonly)
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
if(info.spaceavail < minfreespace) if(info.spaceavail < minfreespace_)
error_and_continue(error,ENOSPC); error_and_continue(error,ENOSPC);
if(info.spaceused >= eplus) if(info.spaceused >= eplus)
continue; continue;
@ -77,7 +77,7 @@ namespace eplus
if(eplusbasepath == NULL) if(eplusbasepath == NULL)
return (errno=error,-1); return (errno=error,-1);
paths->push_back(*eplusbasepath); paths_->push_back(*eplusbasepath);
return 0; return 0;
} }
@ -85,8 +85,8 @@ namespace eplus
static static
int int
action(const Branches &branches_, action(const Branches &branches_,
const char *fusepath, const char *fusepath_,
vector<string> *paths) vector<string> *paths_)
{ {
rwlock::ReadGuard guard(&branches_.lock); rwlock::ReadGuard guard(&branches_.lock);
@ -104,11 +104,11 @@ namespace eplus
{ {
branch = &branches_[i]; branch = &branches_[i];
if(!fs::exists(branch->path,fusepath)) if(!fs::exists(branch->path,fusepath_))
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(branch->ro()) if(branch->ro())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(branch->path,&info);
if(rv == -1) if(rv == -1)
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(info.readonly) if(info.readonly)
@ -123,7 +123,7 @@ namespace eplus
if(eplusbasepath == NULL) if(eplusbasepath == NULL)
return (errno=error,-1); return (errno=error,-1);
paths->push_back(*eplusbasepath); paths_->push_back(*eplusbasepath);
return 0; return 0;
} }
@ -131,8 +131,8 @@ namespace eplus
static static
int int
search(const Branches &branches_, search(const Branches &branches_,
const char *fusepath, const char *fusepath_,
vector<string> *paths) vector<string> *paths_)
{ {
rwlock::ReadGuard guard(&branches_.lock); rwlock::ReadGuard guard(&branches_.lock);
@ -148,7 +148,7 @@ namespace eplus
{ {
branch = &branches_[i]; branch = &branches_[i];
if(!fs::exists(branch->path,fusepath)) if(!fs::exists(branch->path,fusepath_))
continue; continue;
rv = fs::statvfs_cache_spaceused(branch->path,&spaceused); rv = fs::statvfs_cache_spaceused(branch->path,&spaceused);
if(rv == -1) if(rv == -1)
@ -163,27 +163,27 @@ namespace eplus
if(eplusbasepath == NULL) if(eplusbasepath == NULL)
return (errno=ENOENT,-1); return (errno=ENOENT,-1);
paths->push_back(*eplusbasepath); paths_->push_back(*eplusbasepath);
return 0; return 0;
} }
} }
int int
Policy::Func::eplus(const Category type, Policy::Func::eplus(const Category type_,
const Branches &branches_, const Branches &branches_,
const char *fusepath, const char *fusepath_,
const uint64_t minfreespace, const uint64_t minfreespace_,
vector<string> *paths) vector<string> *paths_)
{ {
switch(type) switch(type_)
{ {
case Category::CREATE: case Category::CREATE:
return eplus::create(branches_,fusepath,minfreespace,paths); return eplus::create(branches_,fusepath_,minfreespace_,paths_);
case Category::ACTION: case Category::ACTION:
return eplus::action(branches_,fusepath,paths); return eplus::action(branches_,fusepath_,paths_);
case Category::SEARCH: case Category::SEARCH:
default: default:
return eplus::search(branches_,fusepath,paths); return eplus::search(branches_,fusepath_,paths_);
} }
} }

View File

@ -60,7 +60,7 @@ namespace epmfs
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(branch->ro_or_nc()) if(branch->ro_or_nc())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(branch->path,&info);
if(rv == -1) if(rv == -1)
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(info.readonly) if(info.readonly)
@ -108,7 +108,7 @@ namespace epmfs
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(branch->ro()) if(branch->ro())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(branch->path,&info);
if(rv == -1) if(rv == -1)
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(info.readonly) if(info.readonly)

View File

@ -34,8 +34,8 @@ namespace ff
static static
int int
create(const Branches &branches_, create(const Branches &branches_,
const uint64_t minfreespace, const uint64_t minfreespace_,
vector<string> *paths) vector<string> *paths_)
{ {
rwlock::ReadGuard guard(&branches_.lock); rwlock::ReadGuard guard(&branches_.lock);
@ -51,15 +51,15 @@ namespace ff
if(branch->ro_or_nc()) if(branch->ro_or_nc())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(branch->path,&info);
if(rv == -1) if(rv == -1)
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(info.readonly) if(info.readonly)
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
if(info.spaceavail < minfreespace) if(info.spaceavail < minfreespace_)
error_and_continue(error,ENOSPC); error_and_continue(error,ENOSPC);
paths->push_back(branch->path); paths_->push_back(branch->path);
return 0; return 0;
} }
@ -69,14 +69,14 @@ namespace ff
} }
int int
Policy::Func::ff(const Category type, Policy::Func::ff(const Category type_,
const Branches &branches_, const Branches &branches_,
const char *fusepath, const char *fusepath_,
const uint64_t minfreespace, const uint64_t minfreespace_,
vector<string> *paths) vector<string> *paths_)
{ {
if(type == Category::CREATE) if(type_ == Category::CREATE)
return ff::create(branches_,minfreespace,paths); return ff::create(branches_,minfreespace_,paths_);
return Policy::Func::epff(type,branches_,fusepath,minfreespace,paths); return Policy::Func::epff(type_,branches_,fusepath_,minfreespace_,paths_);
} }

View File

@ -56,7 +56,7 @@ namespace lfs
if(branch->ro_or_nc()) if(branch->ro_or_nc())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(branch->path,&info);
if(rv == -1) if(rv == -1)
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(info.readonly) if(info.readonly)
@ -80,14 +80,14 @@ namespace lfs
} }
int int
Policy::Func::lfs(const Category type, Policy::Func::lfs(const Category type_,
const Branches &branches_, const Branches &branches_,
const char *fusepath, const char *fusepath_,
const uint64_t minfreespace, const uint64_t minfreespace_,
vector<string> *paths) vector<string> *paths_)
{ {
if(type == Category::CREATE) if(type_ == Category::CREATE)
return lfs::create(branches_,minfreespace,paths); return lfs::create(branches_,minfreespace_,paths_);
return Policy::Func::eplfs(type,branches_,fusepath,minfreespace,paths); return Policy::Func::eplfs(type_,branches_,fusepath_,minfreespace_,paths_);
} }

View File

@ -35,8 +35,8 @@ namespace lus
static static
int int
create(const Branches &branches_, create(const Branches &branches_,
const uint64_t minfreespace, const uint64_t minfreespace_,
vector<string> *paths) vector<string> *paths_)
{ {
rwlock::ReadGuard guard(&branches_.lock); rwlock::ReadGuard guard(&branches_.lock);
@ -56,12 +56,12 @@ namespace lus
if(branch->ro_or_nc()) if(branch->ro_or_nc())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(branch->path,&info);
if(rv == -1) if(rv == -1)
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(info.readonly) if(info.readonly)
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
if(info.spaceavail < minfreespace) if(info.spaceavail < minfreespace_)
error_and_continue(error,ENOSPC); error_and_continue(error,ENOSPC);
if(info.spaceused >= lus) if(info.spaceused >= lus)
continue; continue;
@ -73,21 +73,21 @@ namespace lus
if(lusbasepath == NULL) if(lusbasepath == NULL)
return (errno=error,-1); return (errno=error,-1);
paths->push_back(*lusbasepath); paths_->push_back(*lusbasepath);
return 0; return 0;
} }
} }
int int
Policy::Func::lus(const Category type, Policy::Func::lus(const Category type_,
const Branches &branches_, const Branches &branches_,
const char *fusepath, const char *fusepath_,
const uint64_t minfreespace, const uint64_t minfreespace_,
vector<string> *paths) vector<string> *paths_)
{ {
if(type == Category::CREATE) if(type_ == Category::CREATE)
return lus::create(branches_,minfreespace,paths); return lus::create(branches_,minfreespace_,paths_);
return Policy::Func::eplus(type,branches_,fusepath,minfreespace,paths); return Policy::Func::eplus(type_,branches_,fusepath_,minfreespace_,paths_);
} }

View File

@ -55,7 +55,7 @@ namespace mfs
if(branch->ro_or_nc()) if(branch->ro_or_nc())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(branch->path,&info);
if(rv == -1) if(rv == -1)
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(info.readonly) if(info.readonly)
@ -79,14 +79,14 @@ namespace mfs
} }
int int
Policy::Func::mfs(const Category type, Policy::Func::mfs(const Category type_,
const Branches &branches_, const Branches &branches_,
const char *fusepath, const char *fusepath_,
const uint64_t minfreespace, const uint64_t minfreespace_,
vector<string> *paths) vector<string> *paths_)
{ {
if(type == Category::CREATE) if(type_ == Category::CREATE)
return mfs::create(branches_,minfreespace,paths); return mfs::create(branches_,minfreespace_,paths_);
return Policy::Func::epmfs(type,branches_,fusepath,minfreespace,paths); return Policy::Func::epmfs(type_,branches_,fusepath_,minfreespace_,paths_);
} }

View File

@ -59,7 +59,7 @@ namespace msplfs
error_and_continue(*err_,ENOENT); error_and_continue(*err_,ENOENT);
if(branch->ro_or_nc()) if(branch->ro_or_nc())
error_and_continue(*err_,EROFS); error_and_continue(*err_,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(branch->path,&info);
if(rv == -1) if(rv == -1)
error_and_continue(*err_,ENOENT); error_and_continue(*err_,ENOENT);
if(info.readonly) if(info.readonly)

Some files were not shown because too many files have changed in this diff Show More