mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
revert removal of 'all' policy and relevant behavior. closes #54
This commit is contained in:
parent
a359c88173
commit
c022741ffb
28 changed files with 454 additions and 225 deletions
|
|
@ -39,22 +39,33 @@ using std::vector;
|
|||
|
||||
static
|
||||
int
|
||||
_symlink(const vector<string> &srcmounts,
|
||||
const string &from,
|
||||
const string &to)
|
||||
_symlink(const fs::find::Func createFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const string &oldpath,
|
||||
const string &newpath)
|
||||
{
|
||||
int rv;
|
||||
fs::Path path;
|
||||
int error;
|
||||
string newpathdir;
|
||||
fs::Paths newpathdirs;
|
||||
|
||||
rv = fs::find::ff(srcmounts,fs::dirname(to),path);
|
||||
newpathdir = fs::dirname(newpath);
|
||||
rv = createFunc(srcmounts,newpathdir,newpathdirs,-1);
|
||||
if(rv == -1)
|
||||
return -errno;
|
||||
|
||||
path.full = fs::make_path(path.base,to);
|
||||
error = 0;
|
||||
for(fs::Paths::iterator
|
||||
i = newpathdirs.begin(), ei = newpathdirs.end(); i != ei; ++i)
|
||||
{
|
||||
i->full = fs::make_path(i->base,newpath);
|
||||
|
||||
rv = symlink(from.c_str(),path.full.c_str());
|
||||
rv = symlink(oldpath.c_str(),i->full.c_str());
|
||||
if(rv == -1)
|
||||
error = errno;
|
||||
}
|
||||
|
||||
return ((rv == -1) ? -errno : 0);
|
||||
return -error;
|
||||
}
|
||||
|
||||
namespace mergerfs
|
||||
|
|
@ -70,7 +81,8 @@ namespace mergerfs
|
|||
const ugid::SetResetGuard ugid(fc->uid,fc->gid);
|
||||
const rwlock::ReadGuard readlock(&config.srcmountslock);
|
||||
|
||||
return _symlink(config.srcmounts,
|
||||
return _symlink(*config.symlink,
|
||||
config.srcmounts,
|
||||
oldpath,
|
||||
newpath);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue