mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
symlinkify: file -> symlink-to-original-file after timeout
This commit is contained in:
parent
25ce9938c6
commit
6a7675f2bf
13 changed files with 290 additions and 47 deletions
|
|
@ -25,6 +25,7 @@
|
|||
#include "fs_inode.hpp"
|
||||
#include "fs_path.hpp"
|
||||
#include "rwlock.hpp"
|
||||
#include "symlinkify.hpp"
|
||||
#include "ugid.hpp"
|
||||
|
||||
using std::string;
|
||||
|
|
@ -62,7 +63,9 @@ _getattr(Policy::Func::Search searchFunc,
|
|||
const vector<string> &srcmounts,
|
||||
const uint64_t minfreespace,
|
||||
const char *fusepath,
|
||||
struct stat &st)
|
||||
struct stat &st,
|
||||
const bool symlinkify,
|
||||
const time_t symlinkify_timeout)
|
||||
{
|
||||
int rv;
|
||||
string fullpath;
|
||||
|
|
@ -78,6 +81,9 @@ _getattr(Policy::Func::Search searchFunc,
|
|||
if(rv == -1)
|
||||
return -errno;
|
||||
|
||||
if(symlinkify && symlinkify::can_be_symlink(st,symlinkify_timeout))
|
||||
st.st_mode = symlinkify::convert(st.st_mode);
|
||||
|
||||
fs::inode::recompute(st);
|
||||
|
||||
return 0;
|
||||
|
|
@ -104,7 +110,9 @@ namespace mergerfs
|
|||
config.srcmounts,
|
||||
config.minfreespace,
|
||||
fusepath,
|
||||
*st);
|
||||
*st,
|
||||
config.symlinkify,
|
||||
config.symlinkify_timeout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue