Browse Source

fuse_open.cpp

passthrough2
Antonio SJ Musumeci 7 months ago
parent
commit
1bc4660e9f
  1. 50
      src/fuse_open.cpp

50
src/fuse_open.cpp

@ -282,8 +282,8 @@ _(const PassthroughEnum e_,
namespace FUSE namespace FUSE
{ {
int int
open2(const char *fusepath_,
fuse_file_info_t *ffi_)
open_regular(const char *fusepath_,
fuse_file_info_t *ffi_)
{ {
int rv; int rv;
Config::Read cfg; Config::Read cfg;
@ -325,6 +325,52 @@ namespace FUSE
return 0; return 0;
} }
int
open_passthrough(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 int
open(const char *fusepath_, open(const char *fusepath_,
fuse_file_info_t *ffi_) fuse_file_info_t *ffi_)

Loading…
Cancel
Save