generate the controlfile data on the fly. closes #19

This commit is contained in:
Antonio SJ Musumeci 2014-06-25 15:17:26 -04:00
parent 15a0416eed
commit ccb0ac1463
11 changed files with 57 additions and 52 deletions

View file

@ -32,6 +32,18 @@
#include "config.hpp"
#include "fileinfo.hpp"
static
int
_fgetattr_controlfile(const struct stat &controlfilestat,
const std::string cfdata,
struct stat &st)
{
st = controlfilestat;
st.st_size = cfdata.size();
return 0;
}
static
int
_fgetattr(const int fd,
@ -57,7 +69,9 @@ namespace mergerfs
const FileInfo *fileinfo = (FileInfo*)ffi->fh;
if(fusepath == config.controlfile)
return (*st = config.controlfilestat,0);
return _fgetattr_controlfile(config.controlfilestat,
config.controlfiledata(),
*st);
return _fgetattr(fileinfo->fd,
*st);