Rework config, centralize fuse config (#1547)
Some checks are pending
CodeQL / Analyze (push) Waiting to run
mkdocs / deploy (push) Waiting to run

This commit is contained in:
trapexit 2025-10-24 08:20:29 -05:00 • committed by GitHub
parent 00e5467e99
commit 727c522fb8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
46 changed files with 1294 additions and 1316 deletions

View file

@ -46,7 +46,7 @@
*/
static
void
_tweak_flags_writeback_cache(int *flags_)
_tweak_flags_cache_writeback(int *flags_)
{
if((*flags_ & O_ACCMODE) == O_WRONLY)
*flags_ = ((*flags_ & ~O_ACCMODE) | O_RDWR);
@ -87,11 +87,6 @@ _config_to_ffi_flags(Config &cfg_,
{
switch(cfg_.cache_files)
{
case CacheFiles::ENUM::LIBFUSE:
ffi_->direct_io = cfg_.direct_io;
ffi_->keep_cache = cfg_.kernel_cache;
ffi_->auto_cache = cfg_.auto_cache;
break;
case CacheFiles::ENUM::OFF:
ffi_->direct_io = 1;
ffi_->keep_cache = 0;
@ -215,8 +210,8 @@ _create(const Policy::Search &searchFunc_,
constexpr
const
uint64_t
_(const PassthroughEnum e_,
const uint64_t m_)
_(const PassthroughIOEnum e_,
const uint64_t m_)
{
return ((((uint64_t)e_) << 32) | (m_ & O_ACCMODE));
}
@ -234,8 +229,8 @@ _create_for_insert_lambda(const fuse_req_ctx_t *ctx_,
const ugid::Set ugid(ctx_->uid,ctx_->gid);
::_config_to_ffi_flags(cfg,ctx_->pid,ffi_);
if(cfg.writeback_cache)
::_tweak_flags_writeback_cache(&ffi_->flags);
if(cfg.cache_writeback)
::_tweak_flags_cache_writeback(&ffi_->flags);
ffi_->noflush = !::_calculate_flush(cfg.flushonclose,
ffi_->flags);
@ -266,13 +261,13 @@ _create_for_insert_lambda(const fuse_req_ctx_t *ctx_,
of_->ref_count = 1;
of_->fi = fi;
switch(_(cfg.passthrough,ffi_->flags))
switch(_(cfg.passthrough_io,ffi_->flags))
{
case _(Passthrough::ENUM::RO,O_RDONLY):
case _(Passthrough::ENUM::WO,O_WRONLY):
case _(Passthrough::ENUM::RW,O_RDONLY):
case _(Passthrough::ENUM::RW,O_WRONLY):
case _(Passthrough::ENUM::RW,O_RDWR):
case _(PassthroughIO::ENUM::RO,O_RDONLY):
case _(PassthroughIO::ENUM::WO,O_WRONLY):
case _(PassthroughIO::ENUM::RW,O_RDONLY):
case _(PassthroughIO::ENUM::RW,O_WRONLY):
case _(PassthroughIO::ENUM::RW,O_RDWR):
break;
default:
return 0;