|
@ -21,6 +21,7 @@ |
|
|
|
|
|
|
|
|
#include "config.hpp"
|
|
|
#include "config.hpp"
|
|
|
#include "errno.hpp"
|
|
|
#include "errno.hpp"
|
|
|
|
|
|
#include "fs_base_remove.hpp"
|
|
|
#include "fs_base_rename.hpp"
|
|
|
#include "fs_base_rename.hpp"
|
|
|
#include "fs_clonepath.hpp"
|
|
|
#include "fs_clonepath.hpp"
|
|
|
#include "fs_path.hpp"
|
|
|
#include "fs_path.hpp"
|
|
@ -32,7 +33,6 @@ |
|
|
using std::string; |
|
|
using std::string; |
|
|
using std::vector; |
|
|
using std::vector; |
|
|
using std::set; |
|
|
using std::set; |
|
|
using mergerfs::Policy; |
|
|
|
|
|
using namespace mergerfs; |
|
|
using namespace mergerfs; |
|
|
|
|
|
|
|
|
static |
|
|
static |
|
@ -54,7 +54,7 @@ void |
|
|
_remove(const vector<string> &toremove) |
|
|
_remove(const vector<string> &toremove) |
|
|
{ |
|
|
{ |
|
|
for(size_t i = 0, ei = toremove.size(); i != ei; i++) |
|
|
for(size_t i = 0, ei = toremove.size(); i != ei; i++) |
|
|
::remove(toremove[i].c_str()); |
|
|
|
|
|
|
|
|
fs::remove(toremove[i]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static |
|
|
static |
|
@ -70,7 +70,7 @@ _rename(const std::string &oldbasepath, |
|
|
if(oldbasepath != newbasepath) |
|
|
if(oldbasepath != newbasepath) |
|
|
{ |
|
|
{ |
|
|
const ugid::SetRootGuard guard; |
|
|
const ugid::SetRootGuard guard; |
|
|
rv = fs::clonepath(newbasepath,oldbasepath,newfusedirpath.c_str()); |
|
|
|
|
|
|
|
|
rv = fs::clonepath(newbasepath,oldbasepath,newfusedirpath); |
|
|
if(rv == -1) |
|
|
if(rv == -1) |
|
|
return -1; |
|
|
return -1; |
|
|
} |
|
|
} |
|
@ -103,7 +103,7 @@ _rename_create_path_core(const vector<const string*> &oldbasepaths, |
|
|
|
|
|
|
|
|
rv = _rename(oldbasepath,oldfullpath, |
|
|
rv = _rename(oldbasepath,oldfullpath, |
|
|
newbasepath,newfusedirpath,newfullpath); |
|
|
newbasepath,newfusedirpath,newfullpath); |
|
|
error = calc_error(rv,error,errno); |
|
|
|
|
|
|
|
|
error = error::calc(rv,error,errno); |
|
|
if(RENAME_FAILED(rv)) |
|
|
if(RENAME_FAILED(rv)) |
|
|
tounlink.push_back(oldfullpath); |
|
|
tounlink.push_back(oldfullpath); |
|
|
} |
|
|
} |
|
@ -173,7 +173,7 @@ _clonepath(Policy::Func::Search searchFunc, |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
const ugid::SetRootGuard ugidGuard; |
|
|
const ugid::SetRootGuard ugidGuard; |
|
|
fs::clonepath(*srcbasepath[0],dstbasepath,fusedirpath.c_str()); |
|
|
|
|
|
|
|
|
fs::clonepath(*srcbasepath[0],dstbasepath,fusedirpath); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return POLICY_SUCCESS; |
|
|
return POLICY_SUCCESS; |
|
@ -241,7 +241,7 @@ _rename_preserve_path_core(Policy::Func::Search searchFunc, |
|
|
rv = fs::rename(oldfullpath,newfullpath); |
|
|
rv = fs::rename(oldfullpath,newfullpath); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
error = calc_error(rv,error,errno); |
|
|
|
|
|
|
|
|
error = error::calc(rv,error,errno); |
|
|
if(RENAME_FAILED(rv)) |
|
|
if(RENAME_FAILED(rv)) |
|
|
toremove.push_back(oldfullpath); |
|
|
toremove.push_back(oldfullpath); |
|
|
} |
|
|
} |
|
|