From 1bc4660e9f82982ea01cc86e3ad48cabb7f7bfad Mon Sep 17 00:00:00 2001 From: Antonio SJ Musumeci Date: Fri, 12 Apr 2024 11:23:45 -0500 Subject: [PATCH] fuse_open.cpp --- src/fuse_open.cpp | 50 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/src/fuse_open.cpp b/src/fuse_open.cpp index 198578e4..23da2f8a 100644 --- a/src/fuse_open.cpp +++ b/src/fuse_open.cpp @@ -282,8 +282,52 @@ _(const PassthroughEnum e_, namespace FUSE { int - open2(const char *fusepath_, - fuse_file_info_t *ffi_) + open_regular(const char *fusepath_, + fuse_file_info_t *ffi_) + { + int rv; + Config::Read cfg; + const fuse_context *fc = fuse_get_context(); + const ugid::Set ugid(fc->uid,fc->gid); + + l::config_to_ffi_flags(cfg,fc->pid,ffi_); + + 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_, + ffi_, + cfg->link_cow, + cfg->nfsopenhack); + + if(rv != 0) + return rv; + + switch(_(cfg->passthrough,ffi_->flags)) + { + case _(PassthroughEnum::r, O_RDONLY): + case _(PassthroughEnum::r, O_RDWR): + case _(PassthroughEnum::w, O_WRONLY): + case _(PassthroughEnum::w, O_RDWR): + case _(PassthroughEnum::ro,O_RDONLY): + case _(PassthroughEnum::wo,O_WRONLY): + case _(PassthroughEnum::rw,O_RDONLY): + case _(PassthroughEnum::rw,O_WRONLY): + case _(PassthroughEnum::rw,O_RDWR): + return l::passthrough(fc,ffi_); + } + + return 0; + } + + int + open_passthrough(const char *fusepath_, + fuse_file_info_t *ffi_) { int rv; Config::Read cfg; @@ -325,6 +369,8 @@ namespace FUSE return 0; } + + int open(const char *fusepath_, fuse_file_info_t *ffi_)