mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
use references to srcmounts rather than copies
This commit is contained in:
parent
f7c37d2974
commit
6086620e23
49 changed files with 1050 additions and 717 deletions
|
|
@ -34,32 +34,53 @@ using mergerfs::Policy;
|
|||
|
||||
static
|
||||
int
|
||||
_unlink(Policy::Func::Action actionFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const string &fusepath)
|
||||
_unlink_loop_core(const string *basepath,
|
||||
const char *fusepath,
|
||||
const int error)
|
||||
{
|
||||
int rv;
|
||||
int error;
|
||||
vector<string> paths;
|
||||
string fullpath;
|
||||
|
||||
rv = actionFunc(srcmounts,fusepath,minfreespace,paths);
|
||||
if(rv == -1)
|
||||
return -errno;
|
||||
fs::path::make(basepath,fusepath,fullpath);
|
||||
|
||||
rv = ::unlink(fullpath.c_str());
|
||||
|
||||
return calc_error(rv,error,errno);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
_unlink_loop(const vector<const string*> &basepaths,
|
||||
const char *fusepath)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = -1;
|
||||
for(size_t i = 0, ei = paths.size(); i != ei; i++)
|
||||
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
|
||||
{
|
||||
fs::path::append(paths[i],fusepath);
|
||||
|
||||
rv = ::unlink(paths[i].c_str());
|
||||
|
||||
error = calc_error(rv,error,errno);
|
||||
error = _unlink_loop_core(basepaths[i],fusepath,error);
|
||||
}
|
||||
|
||||
return -error;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
_unlink(Policy::Func::Action actionFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const char *fusepath)
|
||||
{
|
||||
int rv;
|
||||
vector<const string*> basepaths;
|
||||
|
||||
rv = actionFunc(srcmounts,fusepath,minfreespace,basepaths);
|
||||
if(rv == -1)
|
||||
return -errno;
|
||||
|
||||
return _unlink_loop(basepaths,fusepath);
|
||||
}
|
||||
|
||||
namespace mergerfs
|
||||
{
|
||||
namespace fuse
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue