Add flushonclose feature

This commit is contained in:
Antonio SJ Musumeci 2023-10-23 22:32:42 -05:00
parent 7d6c8e9333
commit 6aa6452d3e
11 changed files with 196 additions and 3 deletions

View file

@ -114,6 +114,24 @@ namespace l
*flags_ &= ~O_APPEND;
}
static
bool
calculate_flush(FlushOnClose const flushonclose_,
int const flags_)
{
switch(flushonclose_)
{
case FlushOnCloseEnum::NEVER:
return false;
case FlushOnCloseEnum::OPENED_FOR_WRITE:
return !l::rdonly(flags_);
case FlushOnCloseEnum::ALWAYS:
return true;
}
return true;
}
static
void
config_to_ffi_flags(Config::Read &cfg_,
@ -236,6 +254,9 @@ namespace FUSE
if(cfg->writeback_cache)
l::tweak_flags_writeback_cache(&ffi_->flags);
ffi_->noflush = !l::calculate_flush(cfg->flushonclose,
ffi_->flags);
rv = l::open(cfg->func.open.policy,
cfg->branches,
fusepath_,