mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-26 09:56:28 -05:00
generate the controlfile data on the fly. closes #19
This commit is contained in:
parent
15a0416eed
commit
ccb0ac1463
11 changed files with 57 additions and 52 deletions
|
|
@ -41,6 +41,18 @@ using std::string;
|
|||
using std::vector;
|
||||
using mergerfs::Policy;
|
||||
|
||||
static
|
||||
int
|
||||
_getattr_controlfile(const struct stat &controlfilestat,
|
||||
const std::string cfdata,
|
||||
struct stat &st)
|
||||
{
|
||||
st = controlfilestat;
|
||||
st.st_size = cfdata.size();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
_getattr(const fs::SearchFunc searchFunc,
|
||||
|
|
@ -66,19 +78,21 @@ namespace mergerfs
|
|||
{
|
||||
int
|
||||
getattr(const char *fusepath,
|
||||
struct stat *buf)
|
||||
struct stat *st)
|
||||
{
|
||||
const struct fuse_context *fc = fuse_get_context();
|
||||
const config::Config &config = config::get();
|
||||
const ugid::SetResetGuard ugid(fc->uid,fc->gid);
|
||||
|
||||
if(fusepath == config.controlfile)
|
||||
return (*buf = config.controlfilestat,0);
|
||||
return _getattr_controlfile(config.controlfilestat,
|
||||
config.controlfiledata(),
|
||||
*st);
|
||||
|
||||
return _getattr(*config.search,
|
||||
config.srcmounts,
|
||||
fusepath,
|
||||
*buf);
|
||||
*st);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue