mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-02-21 07:03:54 +08:00
Merge pull request #237 from trapexit/renamefix
This commit is contained in:
commit
81b9918f6b
@ -142,6 +142,29 @@ _rename_create_path(Policy::Func::Search searchFunc,
|
||||
return -error;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
_clonepath(Policy::Func::Search searchFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const string &dstbasepath,
|
||||
const string &fusedirpath)
|
||||
{
|
||||
int rv;
|
||||
vector<const string*> srcbasepath;
|
||||
|
||||
rv = searchFunc(srcmounts,fusedirpath.c_str(),minfreespace,srcbasepath);
|
||||
if(POLICY_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
{
|
||||
const ugid::SetRootGuard ugidGuard;
|
||||
fs::clonepath(*srcbasepath[0],dstbasepath,fusedirpath.c_str());
|
||||
}
|
||||
|
||||
return POLICY_SUCCESS;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
_clonepath_if_would_create(Policy::Func::Search searchFunc,
|
||||
@ -163,18 +186,7 @@ _clonepath_if_would_create(Policy::Func::Search searchFunc,
|
||||
return rv;
|
||||
|
||||
if(oldbasepath == *newbasepath[0])
|
||||
{
|
||||
rv = searchFunc(srcmounts,newfusedirpath.c_str(),minfreespace,newbasepath);
|
||||
if(POLICY_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
{
|
||||
const ugid::SetRootGuard ugidGuard;
|
||||
fs::clonepath(*newbasepath[0],oldbasepath,newfusedirpath.c_str());
|
||||
}
|
||||
|
||||
return POLICY_SUCCESS;
|
||||
}
|
||||
return _clonepath(searchFunc,srcmounts,minfreespace,oldbasepath,newfusedirpath);
|
||||
|
||||
return POLICY_FAIL_ERRNO(EXDEV);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user