|
|
@ -17,6 +17,7 @@ |
|
|
|
#include "errno.hpp"
|
|
|
|
#include "fs.hpp"
|
|
|
|
#include "fs_exists.hpp"
|
|
|
|
#include "fs_info.hpp"
|
|
|
|
#include "fs_path.hpp"
|
|
|
|
#include "policy.hpp"
|
|
|
|
#include "policy_error.hpp"
|
|
|
@ -36,13 +37,14 @@ namespace newest |
|
|
|
int |
|
|
|
create(const Branches &branches_, |
|
|
|
const char *fusepath, |
|
|
|
const uint64_t minfreespace, |
|
|
|
vector<const string*> &paths) |
|
|
|
{ |
|
|
|
int rv; |
|
|
|
int error; |
|
|
|
bool readonly; |
|
|
|
time_t newest; |
|
|
|
struct stat st; |
|
|
|
fs::info_t info; |
|
|
|
const Branch *branch; |
|
|
|
const string *newestbasepath; |
|
|
|
|
|
|
@ -59,11 +61,13 @@ namespace newest |
|
|
|
error_and_continue(error,EROFS); |
|
|
|
if(st.st_mtime < newest) |
|
|
|
continue; |
|
|
|
rv = fs::readonly(&branch->path,&readonly); |
|
|
|
rv = fs::info(&branch->path,&info); |
|
|
|
if(rv == -1) |
|
|
|
error_and_continue(error,ENOENT); |
|
|
|
if(readonly) |
|
|
|
if(info.readonly) |
|
|
|
error_and_continue(error,EROFS); |
|
|
|
if(info.spaceavail < minfreespace) |
|
|
|
error_and_continue(error,ENOSPC); |
|
|
|
|
|
|
|
newest = st.st_mtime; |
|
|
|
newestbasepath = &branch->path; |
|
|
@ -169,7 +173,7 @@ namespace mergerfs |
|
|
|
switch(type) |
|
|
|
{ |
|
|
|
case Category::Enum::create: |
|
|
|
return newest::create(branches_,fusepath,paths); |
|
|
|
return newest::create(branches_,fusepath,minfreespace,paths); |
|
|
|
case Category::Enum::action: |
|
|
|
return newest::action(branches_,fusepath,paths); |
|
|
|
case Category::Enum::search: |
|
|
|