mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-26 09:56:28 -05:00
simplify policies
This commit is contained in:
parent
fc100006f9
commit
b3248a8f78
18 changed files with 167 additions and 269 deletions
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "fs_path.hpp"
|
||||
#include "policy.hpp"
|
||||
#include "success_fail.hpp"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
|
@ -74,16 +75,16 @@ _eplfs(const Category::Enum::Type type,
|
|||
fs::path::make(basepath,fusepath,fullpath);
|
||||
|
||||
rv = ::statvfs(fullpath.c_str(),&fsstats);
|
||||
if(rv == 0)
|
||||
if(STATVFS_SUCCEEDED(rv))
|
||||
_calc_lfs(fsstats,basepath,minfreespace,eplfs,eplfsbasepath);
|
||||
}
|
||||
|
||||
if(eplfsbasepath == NULL)
|
||||
return -ENOENT;
|
||||
return (errno=ENOENT,POLICY_FAIL);
|
||||
|
||||
paths.push_back(eplfsbasepath);
|
||||
|
||||
return 0;
|
||||
return POLICY_SUCCESS;
|
||||
}
|
||||
|
||||
namespace mergerfs
|
||||
|
|
@ -100,7 +101,7 @@ namespace mergerfs
|
|||
((type == Category::Enum::create) ? minfreespace : 0);
|
||||
|
||||
rv = _eplfs(type,basepaths,fusepath,minfs,paths);
|
||||
if(rv != 0)
|
||||
if(POLICY_FAILED(rv))
|
||||
rv = Policy::Func::lfs(type,basepaths,fusepath,minfreespace,paths);
|
||||
|
||||
return rv;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue