mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-22 16:06:27 -05:00
Rework how fuse request context is handled (#1543)
This commit is contained in:
parent
d18c273293
commit
0371f03def
117 changed files with 1894 additions and 2438 deletions
|
|
@ -50,12 +50,12 @@ _access(const Policy::Search &searchFunc_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::access(const char *fusepath_,
|
||||
int mask_)
|
||||
FUSE::access(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_,
|
||||
int mask_)
|
||||
{
|
||||
const fs::path fusepath{fusepath_};
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
const fs::path fusepath{fusepath_};
|
||||
const ugid::Set ugid(ctx_->uid,ctx_->gid);
|
||||
|
||||
return ::_access(cfg.func.access.policy,
|
||||
cfg.branches,
|
||||
|
|
|
|||
|
|
@ -16,10 +16,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_req_ctx.h"
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
access(const char *fusepath,
|
||||
int mask);
|
||||
access(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath,
|
||||
int mask);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,16 +20,14 @@
|
|||
|
||||
#include "errno.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
int
|
||||
FUSE::bmap(const char *fusepath_,
|
||||
size_t blocksize_,
|
||||
uint64_t *idx_)
|
||||
FUSE::bmap(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_,
|
||||
size_t blocksize_,
|
||||
uint64_t *idx_)
|
||||
{
|
||||
(void)ctx_;
|
||||
(void)fusepath_;
|
||||
(void)blocksize_;
|
||||
(void)idx_;
|
||||
|
|
|
|||
|
|
@ -18,12 +18,17 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "fuse.h"
|
||||
#include "fuse_req_ctx.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
bmap(const char *fusepath,
|
||||
size_t blocksize,
|
||||
uint64_t *idx);
|
||||
bmap(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath,
|
||||
size_t blocksize,
|
||||
uint64_t *idx);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,8 +94,6 @@ int
|
|||
_chmod(const fs::path &fusepath_,
|
||||
const mode_t mode_)
|
||||
{
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
|
||||
return ::_chmod(cfg.func.chmod.policy,
|
||||
cfg.func.getattr.policy,
|
||||
|
|
@ -105,10 +103,12 @@ _chmod(const fs::path &fusepath_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::chmod(const char *fusepath_,
|
||||
mode_t mode_)
|
||||
FUSE::chmod(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_,
|
||||
mode_t mode_)
|
||||
{
|
||||
const fs::path fusepath{fusepath_};
|
||||
const ugid::Set ugid(ctx_->uid,ctx_->gid);
|
||||
|
||||
return ::_chmod(fusepath,mode_);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,12 +16,15 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_req_ctx.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
chmod(const char *fusepath,
|
||||
mode_t mode);
|
||||
chmod(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath,
|
||||
mode_t mode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,13 +94,13 @@ _chown(const Policy::Action &actionFunc_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::chown(const char *fusepath_,
|
||||
uid_t uid_,
|
||||
gid_t gid_)
|
||||
FUSE::chown(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_,
|
||||
uid_t uid_,
|
||||
gid_t gid_)
|
||||
{
|
||||
const fs::path fusepath{fusepath_};
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
const fs::path fusepath{fusepath_};
|
||||
const ugid::Set ugid(ctx_->uid,ctx_->gid);
|
||||
|
||||
return ::_chown(cfg.func.chown.policy,
|
||||
cfg.func.getattr.policy,
|
||||
|
|
|
|||
|
|
@ -16,13 +16,16 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_req_ctx.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
chown(const char *fusepath,
|
||||
uid_t uid,
|
||||
gid_t gid);
|
||||
chown(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath,
|
||||
uid_t uid,
|
||||
gid_t gid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,14 +47,15 @@ _copy_file_range(const int src_fd_,
|
|||
}
|
||||
|
||||
ssize_t
|
||||
FUSE::copy_file_range(const fuse_file_info_t *src_ffi_,
|
||||
FUSE::copy_file_range(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *src_ffi_,
|
||||
off_t src_off_,
|
||||
const fuse_file_info_t *dst_ffi_,
|
||||
off_t dst_off_,
|
||||
const size_t size_,
|
||||
const unsigned int flags_)
|
||||
{
|
||||
FileInfo *src_fi = FileInfo::from_fh(src_ffi_->fh);
|
||||
FileInfo *src_fi = FileInfo::from_fh(src_ffi_->fh);
|
||||
FileInfo *dst_fi = FileInfo::from_fh(dst_ffi_->fh);
|
||||
|
||||
return ::_copy_file_range(src_fi->fd,
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@
|
|||
namespace FUSE
|
||||
{
|
||||
ssize_t
|
||||
copy_file_range(const fuse_file_info_t *ffi_in,
|
||||
copy_file_range(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi_in,
|
||||
off_t offset_in,
|
||||
const fuse_file_info_t *ffi_out,
|
||||
off_t offset_out,
|
||||
|
|
|
|||
|
|
@ -223,17 +223,17 @@ _(const PassthroughEnum e_,
|
|||
|
||||
static
|
||||
int
|
||||
_create_for_insert_lambda(const fuse_context *fc_,
|
||||
const fs::path &fusepath_,
|
||||
const mode_t mode_,
|
||||
fuse_file_info_t *ffi_,
|
||||
State::OpenFile *of_)
|
||||
_create_for_insert_lambda(const fuse_req_ctx_t *ctx_,
|
||||
const fs::path &fusepath_,
|
||||
const mode_t mode_,
|
||||
fuse_file_info_t *ffi_,
|
||||
State::OpenFile *of_)
|
||||
{
|
||||
int rv;
|
||||
FileInfo *fi;
|
||||
const ugid::Set ugid(fc_->uid,fc_->gid);
|
||||
const ugid::Set ugid(ctx_->uid,ctx_->gid);
|
||||
|
||||
::_config_to_ffi_flags(cfg,fc_->pid,ffi_);
|
||||
::_config_to_ffi_flags(cfg,ctx_->pid,ffi_);
|
||||
if(cfg.writeback_cache)
|
||||
::_tweak_flags_writeback_cache(&ffi_->flags);
|
||||
ffi_->noflush = !::_calculate_flush(cfg.flushonclose,
|
||||
|
|
@ -245,7 +245,7 @@ _create_for_insert_lambda(const fuse_context *fc_,
|
|||
fusepath_,
|
||||
ffi_,
|
||||
mode_,
|
||||
fc_->umask);
|
||||
ctx_->umask);
|
||||
if(rv == -EROFS)
|
||||
{
|
||||
cfg.branches.find_and_set_mode_ro();
|
||||
|
|
@ -255,7 +255,7 @@ _create_for_insert_lambda(const fuse_context *fc_,
|
|||
fusepath_,
|
||||
ffi_,
|
||||
mode_,
|
||||
fc_->umask);
|
||||
ctx_->umask);
|
||||
}
|
||||
|
||||
if(rv < 0)
|
||||
|
|
@ -278,7 +278,7 @@ _create_for_insert_lambda(const fuse_context *fc_,
|
|||
return 0;
|
||||
}
|
||||
|
||||
of_->backing_id = FUSE::passthrough_open(fc_,fi->fd);
|
||||
of_->backing_id = FUSE::passthrough_open(fi->fd);
|
||||
if(of_->backing_id < 0)
|
||||
return 0;
|
||||
|
||||
|
|
@ -292,16 +292,16 @@ _create_for_insert_lambda(const fuse_context *fc_,
|
|||
static
|
||||
inline
|
||||
auto
|
||||
_create_insert_lambda(const fuse_context *fc_,
|
||||
const fs::path &fusepath_,
|
||||
const mode_t mode_,
|
||||
fuse_file_info_t *ffi_,
|
||||
int *_rv_)
|
||||
_create_insert_lambda(const fuse_req_ctx_t *ctx_,
|
||||
const fs::path &fusepath_,
|
||||
const mode_t mode_,
|
||||
fuse_file_info_t *ffi_,
|
||||
int *_rv_)
|
||||
{
|
||||
return
|
||||
[=](auto &val_)
|
||||
{
|
||||
*_rv_ = ::_create_for_insert_lambda(fc_,
|
||||
*_rv_ = ::_create_for_insert_lambda(ctx_,
|
||||
fusepath_,
|
||||
mode_,
|
||||
ffi_,
|
||||
|
|
@ -326,24 +326,24 @@ _create_update_lambda()
|
|||
|
||||
static
|
||||
int
|
||||
_create(const fuse_context *fc_,
|
||||
const fs::path &fusepath_,
|
||||
mode_t mode_,
|
||||
fuse_file_info_t *ffi_)
|
||||
_create(const fuse_req_ctx_t *ctx_,
|
||||
const fs::path &fusepath_,
|
||||
mode_t mode_,
|
||||
fuse_file_info_t *ffi_)
|
||||
{
|
||||
int rv;
|
||||
auto &of = state.open_files;
|
||||
|
||||
rv = -EINVAL;
|
||||
of.try_emplace_and_visit(fc_->nodeid,
|
||||
::_create_insert_lambda(fc_,fusepath_,mode_,ffi_,&rv),
|
||||
of.try_emplace_and_visit(ctx_->nodeid,
|
||||
::_create_insert_lambda(ctx_,fusepath_,mode_,ffi_,&rv),
|
||||
::_create_update_lambda());
|
||||
|
||||
// Can't abort an emplace_and_visit and can't assume another thread
|
||||
// hasn't created an entry since this failure so erase only if
|
||||
// ref_count is default (0).
|
||||
if(rv < 0)
|
||||
of.erase_if(fc_->nodeid,
|
||||
of.erase_if(ctx_->nodeid,
|
||||
[](const auto &val_)
|
||||
{
|
||||
return (val_.second.ref_count <= 0);
|
||||
|
|
@ -353,12 +353,12 @@ _create(const fuse_context *fc_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::create(const char *fusepath_,
|
||||
mode_t mode_,
|
||||
fuse_file_info_t *ffi_)
|
||||
FUSE::create(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_,
|
||||
mode_t mode_,
|
||||
fuse_file_info_t *ffi_)
|
||||
{
|
||||
const fs::path fusepath{fusepath_};
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const fs::path fusepath{fusepath_};
|
||||
|
||||
return ::_create(fc,fusepath,mode_,ffi_);
|
||||
return ::_create(ctx_,fusepath,mode_,ffi_);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
create(const char *fusepath,
|
||||
mode_t mode,
|
||||
fuse_file_info_t *ffi);
|
||||
create(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath,
|
||||
mode_t mode,
|
||||
fuse_file_info_t *ffi);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,18 +40,18 @@ _fallocate(const int fd_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::fallocate(const uint64_t fh_,
|
||||
int mode_,
|
||||
off_t offset_,
|
||||
off_t len_)
|
||||
FUSE::fallocate(const fuse_req_ctx_t *ctx_,
|
||||
const uint64_t fh_,
|
||||
int mode_,
|
||||
off_t offset_,
|
||||
off_t len_)
|
||||
{
|
||||
uint64_t fh;
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
|
||||
fh = fh_;
|
||||
if(fh == 0)
|
||||
{
|
||||
state.open_files.cvisit(fc->nodeid,
|
||||
state.open_files.cvisit(ctx_->nodeid,
|
||||
[&](auto &val_)
|
||||
{
|
||||
fh = val_.second.fi->to_fh();
|
||||
|
|
|
|||
|
|
@ -22,8 +22,9 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
fallocate(const uint64_t fh,
|
||||
int mode,
|
||||
off_t offset,
|
||||
off_t len);
|
||||
fallocate(const fuse_req_ctx_t *ctx,
|
||||
const uint64_t fh,
|
||||
int mode,
|
||||
off_t offset,
|
||||
off_t len);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,16 +37,16 @@ _fchmod(const int fd_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::fchmod(const uint64_t fh_,
|
||||
const mode_t mode_)
|
||||
FUSE::fchmod(const fuse_req_ctx_t *ctx_,
|
||||
const uint64_t fh_,
|
||||
const mode_t mode_)
|
||||
{
|
||||
uint64_t fh;
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
|
||||
fh = fh_;
|
||||
if(fh == 0)
|
||||
{
|
||||
state.open_files.cvisit(fc->nodeid,
|
||||
state.open_files.cvisit(ctx_->nodeid,
|
||||
[&](auto &val_)
|
||||
{
|
||||
fh = val_.second.fi->to_fh();
|
||||
|
|
|
|||
|
|
@ -18,12 +18,15 @@
|
|||
|
||||
#include "fuse.h"
|
||||
|
||||
#include "fuse_req_ctx.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
fchmod(const uint64_t fh,
|
||||
const mode_t mode);
|
||||
fchmod(const fuse_req_ctx_t *ctx,
|
||||
const uint64_t fh,
|
||||
const mode_t mode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,17 +40,17 @@ _fchown(const int fd_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::fchown(const uint64_t fh_,
|
||||
const uid_t uid_,
|
||||
const gid_t gid_)
|
||||
FUSE::fchown(const fuse_req_ctx_t *ctx_,
|
||||
const uint64_t fh_,
|
||||
const uid_t uid_,
|
||||
const gid_t gid_)
|
||||
{
|
||||
uint64_t fh;
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
|
||||
fh = fh_;
|
||||
if(fh == 0)
|
||||
{
|
||||
state.open_files.cvisit(fc->nodeid,
|
||||
state.open_files.cvisit(ctx_->nodeid,
|
||||
[&](auto &val_)
|
||||
{
|
||||
fh = val_.second.fi->to_fh();
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
fchown(const uint64_t fh,
|
||||
uid_t uid,
|
||||
gid_t gid);
|
||||
fchown(const fuse_req_ctx_t *ctx,
|
||||
const uint64_t fh,
|
||||
uid_t uid,
|
||||
gid_t gid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,18 +46,18 @@ _fgetattr(const FileInfo *fi_,
|
|||
|
||||
|
||||
int
|
||||
FUSE::fgetattr(const uint64_t fh_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
FUSE::fgetattr(const fuse_req_ctx_t *ctx_,
|
||||
const uint64_t fh_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
{
|
||||
int rv;
|
||||
uint64_t fh;
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
|
||||
fh = fh_;
|
||||
if(fh == 0)
|
||||
{
|
||||
state.open_files.cvisit(fc->nodeid,
|
||||
state.open_files.cvisit(ctx_->nodeid,
|
||||
[&](const auto &val_)
|
||||
{
|
||||
fh = val_.second.fi->to_fh();
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
fgetattr(const uint64_t fh,
|
||||
struct stat *st,
|
||||
fuse_timeouts_t *timeout);
|
||||
fgetattr(const fuse_req_ctx_t *ctx,
|
||||
const uint64_t fh,
|
||||
struct stat *st,
|
||||
fuse_timeouts_t *timeout);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,16 +37,16 @@ _flock(const int fd_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::flock(const fuse_file_info_t *ffi_,
|
||||
FUSE::flock(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi_,
|
||||
int op_)
|
||||
{
|
||||
uint64_t fh;
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
|
||||
fh = ffi_->fh;
|
||||
if(fh == 0)
|
||||
{
|
||||
state.open_files.cvisit(fc->nodeid,
|
||||
state.open_files.cvisit(ctx_->nodeid,
|
||||
[&](const auto &val_)
|
||||
{
|
||||
fh = val_.second.fi->to_fh();
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
flock(const fuse_file_info_t *ffi,
|
||||
flock(const fuse_req_ctx_t *ctx,
|
||||
const fuse_file_info_t *ffi,
|
||||
int op);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ _flush(const int fd_)
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::flush(const fuse_file_info_t *ffi_)
|
||||
FUSE::flush(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi_)
|
||||
{
|
||||
FileInfo *fi = FileInfo::from_fh(ffi_->fh);
|
||||
|
||||
|
|
|
|||
|
|
@ -22,5 +22,6 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
flush(const fuse_file_info_t *ffi);
|
||||
flush(const fuse_req_ctx_t *ctx,
|
||||
const fuse_file_info_t *ffi);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,8 +43,9 @@ _fsync(const int fd_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::fsync(const uint64_t fh_,
|
||||
int isdatasync_)
|
||||
FUSE::fsync(const fuse_req_ctx_t *ctx_,
|
||||
const uint64_t fh_,
|
||||
int isdatasync_)
|
||||
{
|
||||
FileInfo *fi = FileInfo::from_fh(fh_);
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
fsync(const uint64_t fh,
|
||||
int isdatasync);
|
||||
fsync(const fuse_req_ctx_t *ctx,
|
||||
const uint64_t fh,
|
||||
int isdatasync);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ _fsyncdir(const DirInfo *di_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::fsyncdir(const fuse_file_info_t *ffi_,
|
||||
FUSE::fsyncdir(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi_,
|
||||
int isdatasync_)
|
||||
{
|
||||
DirInfo *di = DirInfo::from_fh(ffi_->fh);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
fsyncdir(const fuse_file_info_t *ffi,
|
||||
fsyncdir(const fuse_req_ctx_t *ctx,
|
||||
const fuse_file_info_t *ffi,
|
||||
int isdatasync);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,16 +37,16 @@ _ftruncate(const int fd_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::ftruncate(const uint64_t fh_,
|
||||
off_t size_)
|
||||
FUSE::ftruncate(const fuse_req_ctx_t *ctx_,
|
||||
const uint64_t fh_,
|
||||
off_t size_)
|
||||
{
|
||||
uint64_t fh;
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
|
||||
fh = fh_;
|
||||
if(fh == 0)
|
||||
{
|
||||
state.open_files.cvisit(fc->nodeid,
|
||||
state.open_files.cvisit(ctx_->nodeid,
|
||||
[&](auto &val_)
|
||||
{
|
||||
fh = val_.second.fi->to_fh();
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
ftruncate(const uint64_t fh,
|
||||
off_t size);
|
||||
ftruncate(const fuse_req_ctx_t *ctx,
|
||||
const uint64_t fh,
|
||||
off_t size);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,16 +39,16 @@ _futimens(const int fd_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::futimens(const uint64_t fh_,
|
||||
const struct timespec ts_[2])
|
||||
FUSE::futimens(const fuse_req_ctx_t *ctx_,
|
||||
const uint64_t fh_,
|
||||
const struct timespec ts_[2])
|
||||
{
|
||||
uint64_t fh;
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
|
||||
fh = fh_;
|
||||
if(fh == 0)
|
||||
{
|
||||
state.open_files.cvisit(fc->nodeid,
|
||||
state.open_files.cvisit(ctx_->nodeid,
|
||||
[&](const auto &val_)
|
||||
{
|
||||
fh = val_.second.fi->to_fh();
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
futimens(const uint64_t fh,
|
||||
const timespec ts[2]);
|
||||
futimens(const fuse_req_ctx_t *ctx,
|
||||
const uint64_t fh,
|
||||
const timespec ts[2]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,8 +177,6 @@ _getattr(const fs::path &fusepath_,
|
|||
fuse_timeouts_t *timeout_)
|
||||
{
|
||||
int rv;
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
|
||||
rv = ::_getattr(cfg.func.getattr.policy,
|
||||
cfg.branches,
|
||||
|
|
@ -199,13 +197,25 @@ _getattr(const fs::path &fusepath_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::getattr(const char *fusepath_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
FUSE::getattr(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
{
|
||||
const fs::path fusepath{fusepath_};
|
||||
|
||||
return FUSE::getattr(fusepath,st_,timeout_);
|
||||
return FUSE::getattr(ctx_,fusepath,st_,timeout_);
|
||||
}
|
||||
|
||||
int
|
||||
FUSE::getattr(const fuse_req_ctx_t *ctx_,
|
||||
const fs::path &fusepath_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
{
|
||||
const ugid::Set ugid(ctx_);
|
||||
|
||||
return FUSE::getattr(fusepath_,st_,timeout_);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -28,9 +28,16 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
getattr(const char *fusepath,
|
||||
struct stat *buf,
|
||||
fuse_timeouts_t *timeout);
|
||||
getattr(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath,
|
||||
struct stat *buf,
|
||||
fuse_timeouts_t *timeout);
|
||||
|
||||
int
|
||||
getattr(const fuse_req_ctx_t *ctx,
|
||||
const fs::path &fusepath,
|
||||
struct stat *buf,
|
||||
fuse_timeouts_t *timeout);
|
||||
|
||||
int
|
||||
getattr(const fs::path &fusepath,
|
||||
|
|
|
|||
|
|
@ -172,10 +172,11 @@ _getxattr(const Policy::Search &searchFunc_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::getxattr(const char *fusepath_,
|
||||
const char *attrname_,
|
||||
char *attrvalue_,
|
||||
size_t attrvalue_size_)
|
||||
FUSE::getxattr(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_,
|
||||
const char *attrname_,
|
||||
char *attrvalue_,
|
||||
size_t attrvalue_size_)
|
||||
{
|
||||
const fs::path fusepath{fusepath_};
|
||||
|
||||
|
|
@ -192,8 +193,7 @@ FUSE::getxattr(const char *fusepath_,
|
|||
if(cfg.xattr.to_int())
|
||||
return -cfg.xattr.to_int();
|
||||
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
const ugid::Set ugid(ctx_->uid,ctx_->gid);
|
||||
|
||||
return ::_getxattr(cfg.func.getxattr.policy,
|
||||
cfg.branches,
|
||||
|
|
|
|||
|
|
@ -16,14 +16,17 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_req_ctx.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
getxattr(const char *fusepath,
|
||||
const char *attrname,
|
||||
char *attrvalue,
|
||||
size_t attrvalue_size);
|
||||
getxattr(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath,
|
||||
const char *attrname,
|
||||
char *attrvalue,
|
||||
size_t attrvalue_size);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,14 +107,14 @@ _ioctl(const int fd_,
|
|||
|
||||
static
|
||||
int
|
||||
_ioctl_file(const fuse_file_info_t *ffi_,
|
||||
_ioctl_file(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi_,
|
||||
const uint32_t cmd_,
|
||||
void *data_,
|
||||
uint32_t *out_bufsz_)
|
||||
{
|
||||
FileInfo *fi = FileInfo::from_fh(ffi_->fh);
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
FileInfo *fi = FileInfo::from_fh(ffi_->fh);
|
||||
const ugid::Set ugid(ctx_);
|
||||
|
||||
return ::_ioctl(fi->fd,cmd_,data_,out_bufsz_);
|
||||
}
|
||||
|
|
@ -156,14 +156,14 @@ _ioctl_dir_base(const Policy::Search &searchFunc_,
|
|||
|
||||
static
|
||||
int
|
||||
_ioctl_dir(const fuse_file_info_t *ffi_,
|
||||
_ioctl_dir(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi_,
|
||||
const uint32_t cmd_,
|
||||
void *data_,
|
||||
uint32_t *out_bufsz_)
|
||||
{
|
||||
DirInfo *di = DirInfo::from_fh(ffi_->fh);
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
DirInfo *di = DirInfo::from_fh(ffi_->fh);
|
||||
const ugid::Set ugid(ctx_);
|
||||
|
||||
return ::_ioctl_dir_base(cfg.func.open.policy,
|
||||
cfg.branches,
|
||||
|
|
@ -181,7 +181,8 @@ _is_btrfs_ioctl_cmd(const unsigned long cmd_)
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::ioctl(const fuse_file_info_t *ffi_,
|
||||
FUSE::ioctl(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi_,
|
||||
unsigned long cmd_,
|
||||
void *arg_,
|
||||
unsigned int flags_,
|
||||
|
|
@ -192,7 +193,7 @@ FUSE::ioctl(const fuse_file_info_t *ffi_,
|
|||
return -ENOTTY;
|
||||
|
||||
if(flags_ & FUSE_IOCTL_DIR)
|
||||
return ::_ioctl_dir(ffi_,cmd_,data_,out_bufsz_);
|
||||
return ::_ioctl_dir(ctx_,ffi_,cmd_,data_,out_bufsz_);
|
||||
|
||||
return ::_ioctl_file(ffi_,cmd_,data_,out_bufsz_);
|
||||
return ::_ioctl_file(ctx_,ffi_,cmd_,data_,out_bufsz_);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
ioctl(const fuse_file_info_t *ffi,
|
||||
ioctl(const fuse_req_ctx_t *ctx,
|
||||
const fuse_file_info_t *ffi,
|
||||
unsigned long cmd,
|
||||
void *arg,
|
||||
unsigned int flags,
|
||||
|
|
|
|||
|
|
@ -165,36 +165,35 @@ _link_preserve_path(const Policy::Action &actionFunc_,
|
|||
|
||||
static
|
||||
int
|
||||
_link(Config &cfg_,
|
||||
const fs::path &oldpath_,
|
||||
_link(const fs::path &oldpath_,
|
||||
const fs::path &newpath_,
|
||||
struct stat *st_)
|
||||
{
|
||||
if(cfg_.func.create.policy.path_preserving() && !cfg_.ignorepponrename)
|
||||
return ::_link_preserve_path(cfg_.func.link.policy,
|
||||
cfg_.branches,
|
||||
if(cfg.func.create.policy.path_preserving() && !cfg.ignorepponrename)
|
||||
return ::_link_preserve_path(cfg.func.link.policy,
|
||||
cfg.branches,
|
||||
oldpath_,
|
||||
newpath_,
|
||||
st_);
|
||||
|
||||
return ::_link_create_path(cfg_.func.getattr.policy,
|
||||
cfg_.func.link.policy,
|
||||
cfg_.branches,
|
||||
return ::_link_create_path(cfg.func.getattr.policy,
|
||||
cfg.func.link.policy,
|
||||
cfg.branches,
|
||||
oldpath_,
|
||||
newpath_);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
_link(Config &cfg_,
|
||||
const fs::path &oldpath_,
|
||||
const fs::path &newpath_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeouts_)
|
||||
_link(const fuse_req_ctx_t *ctx_,
|
||||
const fs::path &oldpath_,
|
||||
const fs::path &newpath_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeouts_)
|
||||
{
|
||||
int rv;
|
||||
|
||||
rv = ::_link(cfg_,oldpath_,newpath_,st_);
|
||||
rv = ::_link(oldpath_,newpath_,st_);
|
||||
if(rv < 0)
|
||||
return rv;
|
||||
|
||||
|
|
@ -203,10 +202,11 @@ _link(Config &cfg_,
|
|||
|
||||
static
|
||||
int
|
||||
_link_exdev_rel_symlink(const fs::path &oldpath_,
|
||||
const fs::path &newpath_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeouts_)
|
||||
_link_exdev_rel_symlink(const fuse_req_ctx_t *ctx_,
|
||||
const fs::path &oldpath_,
|
||||
const fs::path &newpath_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeouts_)
|
||||
{
|
||||
int rv;
|
||||
fs::path target(oldpath_);
|
||||
|
|
@ -214,9 +214,9 @@ _link_exdev_rel_symlink(const fs::path &oldpath_,
|
|||
|
||||
target = target.lexically_relative(linkpath.parent_path());
|
||||
|
||||
rv = FUSE::symlink(target.c_str(),linkpath);
|
||||
rv = FUSE::symlink(ctx_,target.c_str(),linkpath);
|
||||
if(rv == 0)
|
||||
rv = FUSE::getattr(oldpath_,st_,timeouts_);
|
||||
rv = FUSE::getattr(ctx_,oldpath_,st_,timeouts_);
|
||||
|
||||
// Disable caching since we created a symlink but should be a regular.
|
||||
timeouts_->attr = 0;
|
||||
|
|
@ -227,7 +227,8 @@ _link_exdev_rel_symlink(const fs::path &oldpath_,
|
|||
|
||||
static
|
||||
int
|
||||
_link_exdev_abs_base_symlink(const Policy::Search &openPolicy_,
|
||||
_link_exdev_abs_base_symlink(const fuse_req_ctx_t *ctx_,
|
||||
const Policy::Search &openPolicy_,
|
||||
const Branches::Ptr &ibranches_,
|
||||
const fs::path &oldpath_,
|
||||
const fs::path &newpath_,
|
||||
|
|
@ -244,9 +245,9 @@ _link_exdev_abs_base_symlink(const Policy::Search &openPolicy_,
|
|||
|
||||
target = obranches[0]->path / oldpath_;
|
||||
|
||||
rv = FUSE::symlink(target.c_str(),newpath_);
|
||||
rv = FUSE::symlink(ctx_,target.c_str(),newpath_);
|
||||
if(rv == 0)
|
||||
rv = FUSE::getattr(oldpath_,st_,timeouts_);
|
||||
rv = FUSE::getattr(ctx_,oldpath_,st_,timeouts_);
|
||||
|
||||
// Disable caching since we created a symlink but should be a regular.
|
||||
timeouts_->attr = 0;
|
||||
|
|
@ -257,11 +258,12 @@ _link_exdev_abs_base_symlink(const Policy::Search &openPolicy_,
|
|||
|
||||
static
|
||||
int
|
||||
_link_exdev_abs_pool_symlink(const fs::path &mount_,
|
||||
const fs::path &oldpath_,
|
||||
const fs::path &newpath_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeouts_)
|
||||
_link_exdev_abs_pool_symlink(const fuse_req_ctx_t *ctx_,
|
||||
const fs::path &mount_,
|
||||
const fs::path &oldpath_,
|
||||
const fs::path &newpath_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeouts_)
|
||||
{
|
||||
int rv;
|
||||
StrVec basepaths;
|
||||
|
|
@ -269,9 +271,9 @@ _link_exdev_abs_pool_symlink(const fs::path &mount_,
|
|||
|
||||
target = mount_ / oldpath_;
|
||||
|
||||
rv = FUSE::symlink(target.c_str(),newpath_);
|
||||
rv = FUSE::symlink(ctx_,target.c_str(),newpath_);
|
||||
if(rv == 0)
|
||||
rv = FUSE::getattr(oldpath_,st_,timeouts_);
|
||||
rv = FUSE::getattr(ctx_,oldpath_,st_,timeouts_);
|
||||
|
||||
// Disable caching since we created a symlink but should be a regular.
|
||||
timeouts_->attr = 0;
|
||||
|
|
@ -282,30 +284,33 @@ _link_exdev_abs_pool_symlink(const fs::path &mount_,
|
|||
|
||||
static
|
||||
int
|
||||
_link_exdev(Config &cfg_,
|
||||
const fs::path &oldpath_,
|
||||
const fs::path &newpath_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeouts_)
|
||||
_link_exdev(const fuse_req_ctx_t *ctx_,
|
||||
const fs::path &oldpath_,
|
||||
const fs::path &newpath_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeouts_)
|
||||
{
|
||||
switch(cfg_.link_exdev)
|
||||
switch(cfg.link_exdev)
|
||||
{
|
||||
case LinkEXDEV::ENUM::PASSTHROUGH:
|
||||
return -EXDEV;
|
||||
case LinkEXDEV::ENUM::REL_SYMLINK:
|
||||
return ::_link_exdev_rel_symlink(oldpath_,
|
||||
return ::_link_exdev_rel_symlink(ctx_,
|
||||
oldpath_,
|
||||
newpath_,
|
||||
st_,
|
||||
timeouts_);
|
||||
case LinkEXDEV::ENUM::ABS_BASE_SYMLINK:
|
||||
return ::_link_exdev_abs_base_symlink(cfg_.func.open.policy,
|
||||
cfg_.branches,
|
||||
return ::_link_exdev_abs_base_symlink(ctx_,
|
||||
cfg.func.open.policy,
|
||||
cfg.branches,
|
||||
oldpath_,
|
||||
newpath_,
|
||||
st_,
|
||||
timeouts_);
|
||||
case LinkEXDEV::ENUM::ABS_POOL_SYMLINK:
|
||||
return ::_link_exdev_abs_pool_symlink(cfg_.mountpoint,
|
||||
return ::_link_exdev_abs_pool_symlink(ctx_,
|
||||
cfg.mountpoint,
|
||||
oldpath_,
|
||||
newpath_,
|
||||
st_,
|
||||
|
|
@ -316,20 +321,20 @@ _link_exdev(Config &cfg_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::link(const char *oldpath_,
|
||||
const char *newpath_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeouts_)
|
||||
FUSE::link(const fuse_req_ctx_t *ctx_,
|
||||
const char *oldpath_,
|
||||
const char *newpath_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeouts_)
|
||||
{
|
||||
int rv;
|
||||
const fs::path oldpath{oldpath_};
|
||||
const fs::path newpath{newpath_};
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
const fs::path oldpath{oldpath_};
|
||||
const fs::path newpath{newpath_};
|
||||
const ugid::Set ugid(ctx_);
|
||||
|
||||
rv = ::_link(cfg,oldpath,newpath,st_,timeouts_);
|
||||
rv = ::_link(ctx_,oldpath,newpath,st_,timeouts_);
|
||||
if(rv == -EXDEV)
|
||||
rv = ::_link_exdev(cfg,oldpath,newpath,st_,timeouts_);
|
||||
rv = ::_link_exdev(ctx_,oldpath,newpath,st_,timeouts_);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,9 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
link(const char *oldpath,
|
||||
const char *newpath,
|
||||
struct stat *st,
|
||||
fuse_timeouts_t *timeouts);
|
||||
link(const fuse_req_ctx_t *ctx,
|
||||
const char *oldpath,
|
||||
const char *newpath,
|
||||
struct stat *st,
|
||||
fuse_timeouts_t *timeouts);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,9 +123,10 @@ _listxattr(const Policy::Search &searchFunc_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::listxattr(const char *fusepath_,
|
||||
char *list_,
|
||||
size_t size_)
|
||||
FUSE::listxattr(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_,
|
||||
char *list_,
|
||||
size_t size_)
|
||||
{
|
||||
const fs::path fusepath{fusepath_};
|
||||
|
||||
|
|
@ -142,8 +143,7 @@ FUSE::listxattr(const char *fusepath_,
|
|||
return -ENOSYS;
|
||||
}
|
||||
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
const ugid::Set ugid(ctx_);
|
||||
|
||||
return ::_listxattr(cfg.func.listxattr.policy,
|
||||
cfg.branches,
|
||||
|
|
|
|||
|
|
@ -16,12 +16,15 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_req_ctx.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
listxattr(const char *fusepath,
|
||||
char *buf,
|
||||
size_t count);
|
||||
listxattr(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath,
|
||||
char *buf,
|
||||
size_t count);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@
|
|||
|
||||
|
||||
int
|
||||
FUSE::lock(const fuse_file_info_t *ffi,
|
||||
FUSE::lock(const fuse_req_ctx_t *ctx,
|
||||
const fuse_file_info_t *ffi,
|
||||
int cmd,
|
||||
struct flock *flock)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
lock(const fuse_file_info_t *ffi,
|
||||
lock(const fuse_req_ctx_t *ctx,
|
||||
const fuse_file_info_t *ffi,
|
||||
int cmd,
|
||||
struct flock *flock);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,20 +125,20 @@ _mkdir(const Policy::Search &getattrPolicy_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::mkdir(const char *fusepath_,
|
||||
mode_t mode_)
|
||||
FUSE::mkdir(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_,
|
||||
mode_t mode_)
|
||||
{
|
||||
int rv;
|
||||
const fs::path fusepath{fusepath_};
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
const fs::path fusepath{fusepath_};
|
||||
const ugid::Set ugid(ctx_);
|
||||
|
||||
rv = ::_mkdir(cfg.func.getattr.policy,
|
||||
cfg.func.mkdir.policy,
|
||||
cfg.branches,
|
||||
fusepath,
|
||||
mode_,
|
||||
fc->umask);
|
||||
ctx_->umask);
|
||||
if(rv == -EROFS)
|
||||
{
|
||||
cfg.branches.find_and_set_mode_ro();
|
||||
|
|
@ -147,7 +147,7 @@ FUSE::mkdir(const char *fusepath_,
|
|||
cfg.branches,
|
||||
fusepath,
|
||||
mode_,
|
||||
fc->umask);
|
||||
ctx_->umask);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
|
|
|||
|
|
@ -16,12 +16,15 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_req_ctx.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
mkdir(const char *fusepath,
|
||||
mode_t mode);
|
||||
mkdir(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath,
|
||||
mode_t mode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,21 +132,21 @@ _mknod(const Policy::Search &searchFunc_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::mknod(const char *fusepath_,
|
||||
mode_t mode_,
|
||||
dev_t rdev_)
|
||||
FUSE::mknod(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_,
|
||||
mode_t mode_,
|
||||
dev_t rdev_)
|
||||
{
|
||||
int rv;
|
||||
const fs::path fusepath{fusepath_};
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
const fs::path fusepath{fusepath_};
|
||||
const ugid::Set ugid(ctx_);
|
||||
|
||||
rv = ::_mknod(cfg.func.getattr.policy,
|
||||
cfg.func.mknod.policy,
|
||||
cfg.branches,
|
||||
fusepath,
|
||||
mode_,
|
||||
fc->umask,
|
||||
ctx_->umask,
|
||||
rdev_);
|
||||
if(rv == -EROFS)
|
||||
{
|
||||
|
|
@ -156,7 +156,7 @@ FUSE::mknod(const char *fusepath_,
|
|||
cfg.branches,
|
||||
fusepath,
|
||||
mode_,
|
||||
fc->umask,
|
||||
ctx_->umask,
|
||||
rdev_);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,13 +17,16 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_req_ctx.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
mknod(const char *fusepath,
|
||||
mode_t mode,
|
||||
dev_t rdev);
|
||||
mknod(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath,
|
||||
mode_t mode,
|
||||
dev_t rdev);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -280,16 +280,16 @@ _(const PassthroughEnum e_,
|
|||
|
||||
static
|
||||
int
|
||||
_open_for_insert_lambda(const fuse_context *fc_,
|
||||
const fs::path &fusepath_,
|
||||
fuse_file_info_t *ffi_,
|
||||
State::OpenFile *of_)
|
||||
_open_for_insert_lambda(const fuse_req_ctx_t *ctx_,
|
||||
const fs::path &fusepath_,
|
||||
fuse_file_info_t *ffi_,
|
||||
State::OpenFile *of_)
|
||||
{
|
||||
int rv;
|
||||
FileInfo *fi;
|
||||
const ugid::Set ugid(fc_->uid,fc_->gid);
|
||||
const ugid::Set ugid(ctx_);
|
||||
|
||||
::_config_to_ffi_flags(cfg,fc_->pid,ffi_);
|
||||
::_config_to_ffi_flags(cfg,ctx_->pid,ffi_);
|
||||
|
||||
if(cfg.writeback_cache)
|
||||
::_tweak_flags_writeback_cache(&ffi_->flags);
|
||||
|
|
@ -324,7 +324,7 @@ _open_for_insert_lambda(const fuse_context *fc_,
|
|||
return 0;
|
||||
}
|
||||
|
||||
of_->backing_id = FUSE::passthrough_open(fc_,fi->fd);
|
||||
of_->backing_id = FUSE::passthrough_open(fi->fd);
|
||||
if(of_->backing_id <= 0)
|
||||
return 0;
|
||||
|
||||
|
|
@ -337,15 +337,15 @@ _open_for_insert_lambda(const fuse_context *fc_,
|
|||
|
||||
static
|
||||
int
|
||||
_open_for_update_lambda(const fuse_context *fc_,
|
||||
const fs::path &fusepath_,
|
||||
fuse_file_info_t *ffi_,
|
||||
State::OpenFile *of_)
|
||||
_open_for_update_lambda(const fuse_req_ctx_t *ctx_,
|
||||
const fs::path &fusepath_,
|
||||
fuse_file_info_t *ffi_,
|
||||
State::OpenFile *of_)
|
||||
{
|
||||
int rv;
|
||||
const ugid::Set ugid(fc_->uid,fc_->gid);
|
||||
const ugid::Set ugid(ctx_);
|
||||
|
||||
::_config_to_ffi_flags(cfg,fc_->pid,ffi_);
|
||||
::_config_to_ffi_flags(cfg,ctx_->pid,ffi_);
|
||||
|
||||
if(cfg.writeback_cache)
|
||||
::_tweak_flags_writeback_cache(&ffi_->flags);
|
||||
|
|
@ -375,15 +375,15 @@ _open_for_update_lambda(const fuse_context *fc_,
|
|||
static
|
||||
inline
|
||||
auto
|
||||
_open_insert_lambda(const fuse_context *fc_,
|
||||
const fs::path &fusepath_,
|
||||
fuse_file_info_t *ffi_,
|
||||
int *rv_)
|
||||
_open_insert_lambda(const fuse_req_ctx_t *ctx_,
|
||||
const fs::path &fusepath_,
|
||||
fuse_file_info_t *ffi_,
|
||||
int *rv_)
|
||||
{
|
||||
return
|
||||
[=](auto &val_)
|
||||
{
|
||||
*rv_ = ::_open_for_insert_lambda(fc_,
|
||||
*rv_ = ::_open_for_insert_lambda(ctx_,
|
||||
fusepath_,
|
||||
ffi_,
|
||||
&val_.second);
|
||||
|
|
@ -393,10 +393,10 @@ _open_insert_lambda(const fuse_context *fc_,
|
|||
static
|
||||
inline
|
||||
auto
|
||||
_open_update_lambda(const fuse_context *fc_,
|
||||
const fs::path &fusepath_,
|
||||
fuse_file_info_t *ffi_,
|
||||
int *rv_)
|
||||
_open_update_lambda(const fuse_req_ctx_t *ctx_,
|
||||
const fs::path &fusepath_,
|
||||
fuse_file_info_t *ffi_,
|
||||
int *rv_)
|
||||
{
|
||||
return
|
||||
[=](auto &val_)
|
||||
|
|
@ -406,14 +406,14 @@ _open_update_lambda(const fuse_context *fc_,
|
|||
// to abort an insert.
|
||||
if(val_.second.ref_count <= 0)
|
||||
{
|
||||
*rv_ = ::_open_for_insert_lambda(fc_,
|
||||
*rv_ = ::_open_for_insert_lambda(ctx_,
|
||||
fusepath_,
|
||||
ffi_,
|
||||
&val_.second);
|
||||
return;
|
||||
}
|
||||
|
||||
*rv_ = ::_open_for_update_lambda(fc_,
|
||||
*rv_ = ::_open_for_update_lambda(ctx_,
|
||||
fusepath_,
|
||||
ffi_,
|
||||
&val_.second);
|
||||
|
|
@ -422,23 +422,23 @@ _open_update_lambda(const fuse_context *fc_,
|
|||
|
||||
static
|
||||
int
|
||||
_open(const fuse_context *fc_,
|
||||
const fs::path &fusepath_,
|
||||
fuse_file_info_t *ffi_)
|
||||
_open(const fuse_req_ctx_t *ctx_,
|
||||
const fs::path &fusepath_,
|
||||
fuse_file_info_t *ffi_)
|
||||
{
|
||||
int rv;
|
||||
auto &of = state.open_files;
|
||||
|
||||
rv = -EINVAL;
|
||||
of.try_emplace_and_visit(fc_->nodeid,
|
||||
::_open_insert_lambda(fc_,fusepath_,ffi_,&rv),
|
||||
::_open_update_lambda(fc_,fusepath_,ffi_,&rv));
|
||||
of.try_emplace_and_visit(ctx_->nodeid,
|
||||
::_open_insert_lambda(ctx_,fusepath_,ffi_,&rv),
|
||||
::_open_update_lambda(ctx_,fusepath_,ffi_,&rv));
|
||||
|
||||
// Can't abort an emplace_and_visit and can't assume another thread
|
||||
// hasn't created an entry since this failure so erase only if
|
||||
// ref_count is default (0).
|
||||
if(rv < 0)
|
||||
of.erase_if(fc_->nodeid,
|
||||
of.erase_if(ctx_->nodeid,
|
||||
[](auto &val_)
|
||||
{
|
||||
return (val_.second.ref_count <= 0);
|
||||
|
|
@ -449,11 +449,11 @@ _open(const fuse_context *fc_,
|
|||
|
||||
|
||||
int
|
||||
FUSE::open(const char *fusepath_,
|
||||
fuse_file_info_t *ffi_)
|
||||
FUSE::open(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_,
|
||||
fuse_file_info_t *ffi_)
|
||||
{
|
||||
const fs::path fusepath{fusepath_};
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
|
||||
return ::_open(fc,fusepath,ffi_);
|
||||
return ::_open(ctx_,fusepath,ffi_);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
open(const char *fusepath,
|
||||
fuse_file_info_t *ffi);
|
||||
open(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath,
|
||||
fuse_file_info_t *ffi);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,9 @@
|
|||
|
||||
|
||||
int
|
||||
FUSE::opendir(const char *fusepath_,
|
||||
fuse_file_info_t *ffi_)
|
||||
FUSE::opendir(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_,
|
||||
fuse_file_info_t *ffi_)
|
||||
{
|
||||
DirInfo *di;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
opendir(const char *fusepath,
|
||||
fuse_file_info_t *ffi);
|
||||
opendir(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath,
|
||||
fuse_file_info_t *ffi);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,27 +4,28 @@
|
|||
|
||||
#include "fuse.h"
|
||||
|
||||
// Becoming root is required due to current security policies within
|
||||
// the kernel. This may be able to be changed in the future.
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
static
|
||||
inline
|
||||
int
|
||||
passthrough_open(const fuse_context *fc_,
|
||||
const int fd_)
|
||||
passthrough_open(const int fd_)
|
||||
{
|
||||
const ugid::SetRootGuard _;
|
||||
|
||||
return fuse_passthrough_open(fc_,fd_);
|
||||
return fuse_passthrough_open(fd_);
|
||||
}
|
||||
|
||||
static
|
||||
inline
|
||||
int
|
||||
passthrough_close(const fuse_context *fc_,
|
||||
const int backing_id_)
|
||||
passthrough_close(const int backing_id_)
|
||||
{
|
||||
const ugid::SetRootGuard _;
|
||||
|
||||
return fuse_passthrough_close(fc_,backing_id_);
|
||||
return fuse_passthrough_close(backing_id_);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,12 @@
|
|||
|
||||
|
||||
int
|
||||
FUSE::poll(const fuse_file_info_t *ffi_,
|
||||
FUSE::poll(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi_,
|
||||
fuse_pollhandle_t *ph_,
|
||||
unsigned *reventsp_)
|
||||
{
|
||||
(void)ctx_;
|
||||
(void)ffi_;
|
||||
(void)ph_;
|
||||
(void)reventsp_;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
poll(const fuse_file_info_t *ffi,
|
||||
poll(const fuse_req_ctx_t *ctx,
|
||||
const fuse_file_info_t *ffi,
|
||||
fuse_pollhandle_t *ph,
|
||||
unsigned *reventsp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,12 +56,13 @@ _read_cached(const int fd_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::read(const fuse_file_info_t *ffi_,
|
||||
FUSE::read(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi_,
|
||||
char *buf_,
|
||||
size_t size_,
|
||||
off_t offset_)
|
||||
{
|
||||
ioprio::SetFrom iop(fuse_get_context()->pid);
|
||||
ioprio::SetFrom iop(ctx_->pid);
|
||||
FileInfo *fi = FileInfo::from_fh(ffi_->fh);
|
||||
|
||||
if(fi->direct_io)
|
||||
|
|
@ -71,7 +72,8 @@ FUSE::read(const fuse_file_info_t *ffi_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::read_null(const fuse_file_info_t *ffi_,
|
||||
FUSE::read_null(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi_,
|
||||
char *buf_,
|
||||
size_t size_,
|
||||
off_t offset_)
|
||||
|
|
|
|||
|
|
@ -24,13 +24,15 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
read(const fuse_file_info_t *ffi,
|
||||
read(const fuse_req_ctx_t *ctx,
|
||||
const fuse_file_info_t *ffi,
|
||||
char *buf,
|
||||
size_t size,
|
||||
off_t offset);
|
||||
|
||||
int
|
||||
read_null(const fuse_file_info_t *ffi,
|
||||
read_null(const fuse_req_ctx_t *ctx,
|
||||
const fuse_file_info_t *ffi,
|
||||
char *buf,
|
||||
size_t size,
|
||||
off_t offset);
|
||||
|
|
|
|||
|
|
@ -31,10 +31,11 @@
|
|||
|
||||
|
||||
int
|
||||
FUSE::readdir(const fuse_file_info_t *ffi_,
|
||||
FUSE::readdir(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi_,
|
||||
fuse_dirents_t *buf_)
|
||||
{
|
||||
return cfg.readdir(ffi_,buf_);
|
||||
return cfg.readdir(ctx_,ffi_,buf_);
|
||||
}
|
||||
|
||||
FUSE::ReadDir::ReadDir(const std::string_view s_)
|
||||
|
|
@ -99,7 +100,8 @@ _handle_ENOENT(const fuse_file_info_t *ffi_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::ReadDir::operator()(const fuse_file_info_t *ffi_,
|
||||
FUSE::ReadDir::operator()(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi_,
|
||||
fuse_dirents_t *buf_)
|
||||
{
|
||||
int rv;
|
||||
|
|
@ -108,7 +110,7 @@ FUSE::ReadDir::operator()(const fuse_file_info_t *ffi_,
|
|||
readdir = std::atomic_load(&_impl);
|
||||
assert(readdir);
|
||||
|
||||
rv = (*readdir)(ffi_,buf_);
|
||||
rv = (*readdir)(ctx_,ffi_,buf_);
|
||||
if(rv == -ENOENT)
|
||||
return ::_handle_ENOENT(ffi_,buf_);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@
|
|||
|
||||
namespace FUSE
|
||||
{
|
||||
int readdir(fuse_file_info_t const *ffi,
|
||||
int readdir(const fuse_req_ctx_t *ctx,
|
||||
fuse_file_info_t const *ffi,
|
||||
fuse_dirents_t *buf);
|
||||
}
|
||||
|
||||
|
|
@ -49,7 +50,8 @@ namespace FUSE
|
|||
int from_string(const std::string_view);
|
||||
|
||||
public:
|
||||
int operator()(fuse_file_info_t const *ffi,
|
||||
int operator()(const fuse_req_ctx_t *ctx,
|
||||
fuse_file_info_t const *ffi,
|
||||
fuse_dirents_t *buf);
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ namespace FUSE
|
|||
virtual ~ReadDirBase() {};
|
||||
|
||||
public:
|
||||
virtual int operator()(const fuse_file_info_t *ffi,
|
||||
virtual int operator()(const fuse_req_ctx_t *ctx,
|
||||
const fuse_file_info_t *ffi,
|
||||
fuse_dirents_t *buf) = 0;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,16 +86,16 @@ _concurrent_readdir(ThreadPool &tp_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::ReadDirCOR::operator()(const fuse_file_info_t *ffi_,
|
||||
FUSE::ReadDirCOR::operator()(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi_,
|
||||
fuse_dirents_t *dirents_)
|
||||
{
|
||||
DirInfo *di = DirInfo::from_fh(ffi_->fh);
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
DirInfo *di = DirInfo::from_fh(ffi_->fh);
|
||||
|
||||
return ::_concurrent_readdir(_tp,
|
||||
cfg.branches,
|
||||
di->fusepath,
|
||||
dirents_,
|
||||
fc->uid,
|
||||
fc->gid);
|
||||
ctx_->uid,
|
||||
ctx_->gid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ namespace FUSE
|
|||
unsigned max_queue_depth);
|
||||
~ReadDirCOR();
|
||||
|
||||
int operator()(const fuse_file_info_t *ffi,
|
||||
int operator()(const fuse_req_ctx_t *ctx,
|
||||
const fuse_file_info_t *ffi,
|
||||
fuse_dirents_t *buf);
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -61,16 +61,16 @@ _readdir(ThreadPool &tp_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::ReadDirCOSR::operator()(fuse_file_info_t const *ffi_,
|
||||
FUSE::ReadDirCOSR::operator()(const fuse_req_ctx_t *ctx_,
|
||||
fuse_file_info_t const *ffi_,
|
||||
fuse_dirents_t *dirents_)
|
||||
{
|
||||
DirInfo *di = DirInfo::from_fh(ffi_->fh);
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
DirInfo *di = DirInfo::from_fh(ffi_->fh);
|
||||
|
||||
return ::_readdir(_tp,
|
||||
cfg.branches,
|
||||
di->fusepath,
|
||||
dirents_,
|
||||
fc->uid,
|
||||
fc->gid);
|
||||
ctx_->uid,
|
||||
ctx_->gid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ namespace FUSE
|
|||
unsigned max_queue_depth);
|
||||
~ReadDirCOSR();
|
||||
|
||||
int operator()(fuse_file_info_t const *ffi,
|
||||
int operator()(const fuse_req_ctx_t *ctx,
|
||||
fuse_file_info_t const *ffi,
|
||||
fuse_dirents_t *buf);
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@
|
|||
|
||||
|
||||
int
|
||||
FUSE::readdir_plus(const fuse_file_info_t *ffi_,
|
||||
FUSE::readdir_plus(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi_,
|
||||
fuse_dirents_t *buf_)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
namespace FUSE
|
||||
{
|
||||
int readdir_plus(fuse_file_info_t const *ffi,
|
||||
int readdir_plus(const fuse_req_ctx_t *ctx,
|
||||
const fuse_file_info_t *ffi,
|
||||
fuse_dirents_t *buf);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,12 +29,12 @@
|
|||
#endif
|
||||
|
||||
int
|
||||
FUSE::ReadDirSeq::operator()(fuse_file_info_t const *ffi_,
|
||||
FUSE::ReadDirSeq::operator()(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi_,
|
||||
fuse_dirents_t *dirents_)
|
||||
{
|
||||
DirInfo *di = DirInfo::from_fh(ffi_->fh);
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
DirInfo *di = DirInfo::from_fh(ffi_->fh);
|
||||
const ugid::Set ugid(ctx_);
|
||||
|
||||
return ::_readdir(cfg.branches,
|
||||
di->fusepath,
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@ namespace FUSE
|
|||
ReadDirSeq() {}
|
||||
~ReadDirSeq() {}
|
||||
|
||||
int operator()(fuse_file_info_t const *ffi,
|
||||
int operator()(const fuse_req_ctx_t *ctx,
|
||||
const fuse_file_info_t *ffi,
|
||||
fuse_dirents_t *buf);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,13 +115,13 @@ _readlink(const Policy::Search &searchFunc_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::readlink(const char *fusepath_,
|
||||
char *buf_,
|
||||
size_t size_)
|
||||
FUSE::readlink(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_,
|
||||
char *buf_,
|
||||
size_t size_)
|
||||
{
|
||||
const fs::path fusepath{fusepath_};
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
const fs::path fusepath{fusepath_};
|
||||
const ugid::Set ugid(ctx_);
|
||||
|
||||
return ::_readlink(cfg.func.readlink.policy,
|
||||
cfg.branches,
|
||||
|
|
|
|||
|
|
@ -16,13 +16,16 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_req_ctx.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
readlink(const char *fusepath,
|
||||
char *buf,
|
||||
size_t size);
|
||||
readlink(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath,
|
||||
char *buf,
|
||||
size_t size);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,9 +29,8 @@
|
|||
static
|
||||
constexpr
|
||||
auto
|
||||
_erase_if_lambda(const fuse_context *fc_,
|
||||
FileInfo *fi_,
|
||||
bool *existed_in_map_)
|
||||
_erase_if_lambda(FileInfo *fi_,
|
||||
bool *existed_in_map_)
|
||||
{
|
||||
return
|
||||
[=](auto &val_)
|
||||
|
|
@ -49,7 +48,7 @@ _erase_if_lambda(const fuse_context *fc_,
|
|||
return false;
|
||||
|
||||
if(val_.second.backing_id > 0)
|
||||
FUSE::passthrough_close(fc_,val_.second.backing_id);
|
||||
FUSE::passthrough_close(val_.second.backing_id);
|
||||
fs::close(val_.second.fi->fd);
|
||||
delete val_.second.fi;
|
||||
|
||||
|
|
@ -59,9 +58,9 @@ _erase_if_lambda(const fuse_context *fc_,
|
|||
|
||||
static
|
||||
int
|
||||
_release(const fuse_context *fc_,
|
||||
FileInfo *fi_,
|
||||
const bool dropcacheonclose_)
|
||||
_release(const fuse_req_ctx_t *ctx_,
|
||||
FileInfo *fi_,
|
||||
const bool dropcacheonclose_)
|
||||
{
|
||||
bool existed_in_map;
|
||||
|
||||
|
|
@ -77,8 +76,8 @@ _release(const fuse_context *fc_,
|
|||
// existed. Just how many it erased and in this case I only want to
|
||||
// erase if there are no more open files.
|
||||
existed_in_map = false;
|
||||
state.open_files.erase_if(fc_->nodeid,
|
||||
::_erase_if_lambda(fc_,fi_,&existed_in_map));
|
||||
state.open_files.erase_if(ctx_->nodeid,
|
||||
::_erase_if_lambda(fi_,&existed_in_map));
|
||||
if(existed_in_map)
|
||||
return 0;
|
||||
|
||||
|
|
@ -90,18 +89,17 @@ _release(const fuse_context *fc_,
|
|||
|
||||
static
|
||||
int
|
||||
_release(const fuse_context *fc_,
|
||||
_release(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi_)
|
||||
{
|
||||
FileInfo *fi = FileInfo::from_fh(ffi_->fh);
|
||||
|
||||
return ::_release(fc_,fi,cfg.dropcacheonclose);
|
||||
return ::_release(ctx_,fi,cfg.dropcacheonclose);
|
||||
}
|
||||
|
||||
int
|
||||
FUSE::release(const fuse_file_info_t *ffi_)
|
||||
FUSE::release(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi_)
|
||||
{
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
|
||||
return ::_release(fc,ffi_);
|
||||
return ::_release(ctx_,ffi_);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,5 +22,6 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
release(const fuse_file_info_t *ffi);
|
||||
release(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ _releasedir(DirInfo *di_)
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::releasedir(const fuse_file_info_t *ffi_)
|
||||
FUSE::releasedir(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi_)
|
||||
{
|
||||
DirInfo *di = DirInfo::from_fh(ffi_->fh);
|
||||
|
||||
|
|
|
|||
|
|
@ -22,5 +22,6 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
releasedir(const fuse_file_info_t *ffi);
|
||||
releasedir(const fuse_req_ctx_t *ctx,
|
||||
const fuse_file_info_t *ffi);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
int
|
||||
FUSE::removemapping()
|
||||
FUSE::removemapping(const fuse_req_ctx_t *ctx)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,5 +23,5 @@
|
|||
|
||||
namespace FUSE
|
||||
{
|
||||
int removemapping();
|
||||
int removemapping(const fuse_req_ctx_t *ctx);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,8 +89,9 @@ _removexattr(const Policy::Action &actionFunc_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::removexattr(const char *fusepath_,
|
||||
const char *attrname_)
|
||||
FUSE::removexattr(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_,
|
||||
const char *attrname_)
|
||||
{
|
||||
const fs::path fusepath{fusepath_};
|
||||
|
||||
|
|
@ -100,8 +101,7 @@ FUSE::removexattr(const char *fusepath_,
|
|||
if(cfg.xattr.to_int())
|
||||
return -cfg.xattr.to_int();
|
||||
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
const ugid::Set ugid(ctx_);
|
||||
|
||||
return ::_removexattr(cfg.func.removexattr.policy,
|
||||
cfg.func.getxattr.policy,
|
||||
|
|
|
|||
|
|
@ -16,10 +16,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_req_ctx.h"
|
||||
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
removexattr(const char *fusepath,
|
||||
const char *attrname);
|
||||
removexattr(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath,
|
||||
const char *attrname);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -244,7 +244,8 @@ _rename_exdev_rename_target(const Policy::Action &actionPolicy_,
|
|||
|
||||
static
|
||||
int
|
||||
_rename_exdev_rel_symlink(const Policy::Action &actionPolicy_,
|
||||
_rename_exdev_rel_symlink(const fuse_req_ctx_t *ctx_,
|
||||
const Policy::Action &actionPolicy_,
|
||||
const Branches::Ptr &branches_,
|
||||
const fs::path &oldfusepath_,
|
||||
const fs::path &newfusepath_)
|
||||
|
|
@ -263,7 +264,7 @@ _rename_exdev_rel_symlink(const Policy::Action &actionPolicy_,
|
|||
target /= oldfusepath_;
|
||||
target = target.lexically_relative(linkpath.parent_path());
|
||||
|
||||
rv = FUSE::symlink(target.c_str(),linkpath);
|
||||
rv = FUSE::symlink(ctx_,target.c_str(),linkpath);
|
||||
if(rv < 0)
|
||||
::_rename_exdev_rename_back(branches,oldfusepath_);
|
||||
|
||||
|
|
@ -272,7 +273,8 @@ _rename_exdev_rel_symlink(const Policy::Action &actionPolicy_,
|
|||
|
||||
static
|
||||
int
|
||||
_rename_exdev_abs_symlink(const Policy::Action &actionPolicy_,
|
||||
_rename_exdev_abs_symlink(const fuse_req_ctx_t *ctx_,
|
||||
const Policy::Action &actionPolicy_,
|
||||
const Branches::Ptr &branches_,
|
||||
const fs::path &mount_,
|
||||
const fs::path &oldfusepath_,
|
||||
|
|
@ -292,7 +294,7 @@ _rename_exdev_abs_symlink(const Policy::Action &actionPolicy_,
|
|||
target /= ".mergerfs_rename_exdev";
|
||||
target /= oldfusepath_;
|
||||
|
||||
rv = FUSE::symlink(target.c_str(),linkpath);
|
||||
rv = FUSE::symlink(ctx_,target.c_str(),linkpath);
|
||||
if(rv < 0)
|
||||
::_rename_exdev_rename_back(branches,oldfusepath_);
|
||||
|
||||
|
|
@ -301,23 +303,25 @@ _rename_exdev_abs_symlink(const Policy::Action &actionPolicy_,
|
|||
|
||||
static
|
||||
int
|
||||
_rename_exdev(Config &cfg_,
|
||||
const fs::path &oldfusepath_,
|
||||
const fs::path &newfusepath_)
|
||||
_rename_exdev(const fuse_req_ctx_t *ctx_,
|
||||
const fs::path &oldfusepath_,
|
||||
const fs::path &newfusepath_)
|
||||
{
|
||||
switch(cfg_.rename_exdev)
|
||||
switch(cfg.rename_exdev)
|
||||
{
|
||||
case RenameEXDEV::ENUM::PASSTHROUGH:
|
||||
return -EXDEV;
|
||||
case RenameEXDEV::ENUM::REL_SYMLINK:
|
||||
return ::_rename_exdev_rel_symlink(cfg_.func.rename.policy,
|
||||
cfg_.branches,
|
||||
return ::_rename_exdev_rel_symlink(ctx_,
|
||||
cfg.func.rename.policy,
|
||||
cfg.branches,
|
||||
oldfusepath_,
|
||||
newfusepath_);
|
||||
case RenameEXDEV::ENUM::ABS_SYMLINK:
|
||||
return ::_rename_exdev_abs_symlink(cfg_.func.rename.policy,
|
||||
cfg_.branches,
|
||||
cfg_.mountpoint,
|
||||
return ::_rename_exdev_abs_symlink(ctx_,
|
||||
cfg.func.rename.policy,
|
||||
cfg.branches,
|
||||
cfg.mountpoint,
|
||||
oldfusepath_,
|
||||
newfusepath_);
|
||||
}
|
||||
|
|
@ -327,36 +331,35 @@ _rename_exdev(Config &cfg_,
|
|||
|
||||
static
|
||||
int
|
||||
_rename(Config &cfg_,
|
||||
const fs::path &oldpath_,
|
||||
_rename(const fs::path &oldpath_,
|
||||
const fs::path &newpath_)
|
||||
{
|
||||
if(cfg_.func.create.policy.path_preserving() && !cfg_.ignorepponrename)
|
||||
return ::_rename_preserve_path(cfg_.func.rename.policy,
|
||||
cfg_.branches,
|
||||
if(cfg.func.create.policy.path_preserving() && !cfg.ignorepponrename)
|
||||
return ::_rename_preserve_path(cfg.func.rename.policy,
|
||||
cfg.branches,
|
||||
oldpath_,
|
||||
newpath_);
|
||||
|
||||
return ::_rename_create_path(cfg_.func.getattr.policy,
|
||||
cfg_.func.rename.policy,
|
||||
cfg_.branches,
|
||||
return ::_rename_create_path(cfg.func.getattr.policy,
|
||||
cfg.func.rename.policy,
|
||||
cfg.branches,
|
||||
oldpath_,
|
||||
newpath_);
|
||||
}
|
||||
|
||||
int
|
||||
FUSE::rename(const char *oldfusepath_,
|
||||
const char *newfusepath_)
|
||||
FUSE::rename(const fuse_req_ctx_t *ctx_,
|
||||
const char *oldfusepath_,
|
||||
const char *newfusepath_)
|
||||
{
|
||||
int rv;
|
||||
const fs::path oldfusepath{oldfusepath_};
|
||||
const fs::path newfusepath{newfusepath_};
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
const ugid::Set ugid(ctx_);
|
||||
|
||||
rv = ::_rename(cfg,oldfusepath,newfusepath);
|
||||
rv = ::_rename(oldfusepath,newfusepath);
|
||||
if(rv == -EXDEV)
|
||||
return ::_rename_exdev(cfg,oldfusepath,newfusepath);
|
||||
return ::_rename_exdev(ctx_,oldfusepath,newfusepath);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,10 +16,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_req_ctx.h"
|
||||
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
rename(const char *from,
|
||||
const char *to);
|
||||
rename(const fuse_req_ctx_t *ctx,
|
||||
const char *from,
|
||||
const char *to);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,11 +92,11 @@ _rmdir(const Policy::Action &actionFunc_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::rmdir(const char *fusepath_)
|
||||
FUSE::rmdir(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_)
|
||||
{
|
||||
const fs::path fusepath{fusepath_};
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
const fs::path fusepath{fusepath_};
|
||||
const ugid::Set ugid(ctx_);
|
||||
|
||||
return ::_rmdir(cfg.func.rmdir.policy,
|
||||
cfg.branches,
|
||||
|
|
|
|||
|
|
@ -16,9 +16,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_req_ctx.h"
|
||||
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
rmdir(const char *fusepath);
|
||||
rmdir(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,11 +25,12 @@
|
|||
|
||||
|
||||
ssize_t
|
||||
FUSE::setupmapping(uint64_t *fh_,
|
||||
uint64_t foffset_,
|
||||
uint64_t len_,
|
||||
uint64_t flags_,
|
||||
uint64_t moffset_)
|
||||
FUSE::setupmapping(const fuse_req_ctx_t *ctx_,
|
||||
uint64_t *fh_,
|
||||
uint64_t foffset_,
|
||||
uint64_t len_,
|
||||
uint64_t flags_,
|
||||
uint64_t moffset_)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@
|
|||
|
||||
namespace FUSE
|
||||
{
|
||||
ssize_t setupmapping(uint64_t *fh_,
|
||||
ssize_t setupmapping(const fuse_req_ctx_t *ctx,
|
||||
uint64_t *fh_,
|
||||
uint64_t foffset_,
|
||||
uint64_t len_,
|
||||
uint64_t flags_,
|
||||
|
|
|
|||
|
|
@ -180,11 +180,12 @@ _setxattr(const Policy::Action &setxattrPolicy_,
|
|||
|
||||
static
|
||||
int
|
||||
_setxattr(const fs::path &fusepath_,
|
||||
const char *attrname_,
|
||||
const char *attrval_,
|
||||
size_t attrvalsize_,
|
||||
int flags_)
|
||||
_setxattr(const fuse_req_ctx_t *ctx_,
|
||||
const fs::path &fusepath_,
|
||||
const char *attrname_,
|
||||
const char *attrval_,
|
||||
size_t attrvalsize_,
|
||||
int flags_)
|
||||
{
|
||||
if((cfg.security_capability == false) &&
|
||||
::_is_attrname_security_capability(attrname_))
|
||||
|
|
@ -193,8 +194,7 @@ _setxattr(const fs::path &fusepath_,
|
|||
if(cfg.xattr.to_int())
|
||||
return -cfg.xattr.to_int();
|
||||
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
const ugid::Set ugid(ctx_);
|
||||
|
||||
return ::_setxattr(cfg.func.setxattr.policy,
|
||||
cfg.func.getxattr.policy,
|
||||
|
|
@ -208,11 +208,12 @@ _setxattr(const fs::path &fusepath_,
|
|||
|
||||
|
||||
int
|
||||
FUSE::setxattr(const char *fusepath_,
|
||||
const char *attrname_,
|
||||
const char *attrval_,
|
||||
size_t attrvalsize_,
|
||||
int flags_)
|
||||
FUSE::setxattr(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_,
|
||||
const char *attrname_,
|
||||
const char *attrval_,
|
||||
size_t attrvalsize_,
|
||||
int flags_)
|
||||
{
|
||||
const fs::path fusepath{fusepath_};
|
||||
|
||||
|
|
@ -222,5 +223,10 @@ FUSE::setxattr(const char *fusepath_,
|
|||
attrvalsize_,
|
||||
flags_);
|
||||
|
||||
return ::_setxattr(fusepath,attrname_,attrval_,attrvalsize_,flags_);
|
||||
return ::_setxattr(ctx_,
|
||||
fusepath,
|
||||
attrname_,
|
||||
attrval_,
|
||||
attrvalsize_,
|
||||
flags_);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,13 +18,16 @@
|
|||
|
||||
#include <cstddef>
|
||||
|
||||
#include "fuse_req_ctx.h"
|
||||
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
setxattr(const char *fusepath,
|
||||
const char *attrname,
|
||||
const char *attrval,
|
||||
size_t attrvalize,
|
||||
int flags);
|
||||
setxattr(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath,
|
||||
const char *attrname,
|
||||
const char *attrval,
|
||||
size_t attrvalize,
|
||||
int flags);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,12 +142,12 @@ _statfs(const Branches::Ptr &branches_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::statfs(const char *fusepath_,
|
||||
struct statvfs *st_)
|
||||
FUSE::statfs(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_,
|
||||
struct statvfs *st_)
|
||||
{
|
||||
const fs::path fusepath{fusepath_};
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
const fs::path fusepath{fusepath_};
|
||||
const ugid::Set ugid(ctx_);
|
||||
|
||||
return ::_statfs(cfg.branches,
|
||||
fusepath,
|
||||
|
|
|
|||
|
|
@ -16,12 +16,15 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_req_ctx.h"
|
||||
|
||||
#include <sys/statvfs.h>
|
||||
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
statfs(const char *fusepath,
|
||||
struct statvfs *fsstat);
|
||||
statfs(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath,
|
||||
struct statvfs *fsstat);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,14 +25,16 @@
|
|||
|
||||
namespace FUSE
|
||||
{
|
||||
int statx(const char *fusepath,
|
||||
const uint32_t flags,
|
||||
const uint32_t mask,
|
||||
struct fuse_statx *st,
|
||||
fuse_timeouts_t *timeout);
|
||||
int statx_fh(const uint64_t fh,
|
||||
const uint32_t flags,
|
||||
const uint32_t mask,
|
||||
struct fuse_statx *st,
|
||||
fuse_timeouts_t *timeout);
|
||||
int statx(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath,
|
||||
const uint32_t flags,
|
||||
const uint32_t mask,
|
||||
struct fuse_statx *st,
|
||||
fuse_timeouts_t *timeout);
|
||||
int statx_fh(const fuse_req_ctx_t *ctx,
|
||||
const uint64_t fh,
|
||||
const uint32_t flags,
|
||||
const uint32_t mask,
|
||||
struct fuse_statx *st,
|
||||
fuse_timeouts_t *timeout);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,8 +179,6 @@ _statx(const fs::path &fusepath_,
|
|||
fuse_timeouts_t *timeout_)
|
||||
{
|
||||
int rv;
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
|
||||
rv = ::_statx(cfg.func.getattr.policy,
|
||||
cfg.branches,
|
||||
|
|
@ -203,17 +201,20 @@ _statx(const fs::path &fusepath_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::statx(const char *fusepath_,
|
||||
const uint32_t flags_,
|
||||
const uint32_t mask_,
|
||||
struct fuse_statx *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
FUSE::statx(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_,
|
||||
const uint32_t flags_,
|
||||
const uint32_t mask_,
|
||||
struct fuse_statx *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
{
|
||||
const fs::path fusepath{fusepath_};
|
||||
|
||||
if(Config::is_ctrl_file(fusepath))
|
||||
return ::_statx_controlfile(st_);
|
||||
|
||||
const ugid::Set ugid(ctx_);
|
||||
|
||||
return ::_statx(fusepath,
|
||||
flags_|AT_STATX_DONT_SYNC,
|
||||
mask_,
|
||||
|
|
@ -222,19 +223,19 @@ FUSE::statx(const char *fusepath_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::statx_fh(const uint64_t fh_,
|
||||
const uint32_t flags_,
|
||||
const uint32_t mask_,
|
||||
struct fuse_statx *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
FUSE::statx_fh(const fuse_req_ctx_t *ctx_,
|
||||
const uint64_t fh_,
|
||||
const uint32_t flags_,
|
||||
const uint32_t mask_,
|
||||
struct fuse_statx *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
{
|
||||
uint64_t fh;
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
|
||||
fh = fh_;
|
||||
if(fh == 0)
|
||||
{
|
||||
state.open_files.cvisit(fc->nodeid,
|
||||
state.open_files.cvisit(ctx_->nodeid,
|
||||
[&](auto &val_)
|
||||
{
|
||||
fh = val_.second.fi->to_fh();
|
||||
|
|
@ -246,6 +247,8 @@ FUSE::statx_fh(const uint64_t fh_,
|
|||
|
||||
FileInfo *fi = FileInfo::from_fh(fh);
|
||||
|
||||
const ugid::Set ugid(ctx_);
|
||||
|
||||
return ::_statx(fi->fusepath,
|
||||
flags_|AT_STATX_DONT_SYNC,
|
||||
mask_,
|
||||
|
|
|
|||
|
|
@ -1,21 +1,23 @@
|
|||
#include "fuse_statx.hpp"
|
||||
|
||||
int
|
||||
FUSE::statx(const char *fusepath_,
|
||||
const uint32_t flags_,
|
||||
const uint32_t mask_,
|
||||
struct fuse_statx *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
FUSE::statx(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_,
|
||||
const uint32_t flags_,
|
||||
const uint32_t mask_,
|
||||
struct fuse_statx *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
int
|
||||
FUSE::statx_fh(const uint64_t fh_,
|
||||
const uint32_t flags_,
|
||||
const uint32_t mask_,
|
||||
struct fuse_statx *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
FUSE::statx_fh(const fuse_req_ctx_t *ctx_,
|
||||
const uint64_t fh_,
|
||||
const uint32_t flags_,
|
||||
const uint32_t mask_,
|
||||
struct fuse_statx *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,28 +120,30 @@ _symlink(const Policy::Search &searchFunc_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::symlink(const char *target_,
|
||||
const char *linkpath_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeouts_)
|
||||
FUSE::symlink(const fuse_req_ctx_t *ctx_,
|
||||
const char *target_,
|
||||
const char *linkpath_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeouts_)
|
||||
{
|
||||
const fs::path linkpath{linkpath_};
|
||||
|
||||
return FUSE::symlink(target_,
|
||||
return FUSE::symlink(ctx_,
|
||||
target_,
|
||||
linkpath,
|
||||
st_,
|
||||
timeouts_);
|
||||
}
|
||||
|
||||
int
|
||||
FUSE::symlink(const char *target_,
|
||||
const fs::path &linkpath_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeouts_)
|
||||
FUSE::symlink(const fuse_req_ctx_t *ctx_,
|
||||
const char *target_,
|
||||
const fs::path &linkpath_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeouts_)
|
||||
{
|
||||
int rv;
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
const ugid::Set ugid(ctx_);
|
||||
|
||||
rv = ::_symlink(cfg.func.getattr.policy,
|
||||
cfg.func.symlink.policy,
|
||||
|
|
|
|||
|
|
@ -27,15 +27,16 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
symlink(const char *target,
|
||||
const char *linkpath,
|
||||
struct stat *st = NULL,
|
||||
fuse_timeouts_t *timeouts = NULL);
|
||||
symlink(const fuse_req_ctx_t *ctx,
|
||||
const char *target,
|
||||
const char *linkpath,
|
||||
struct stat *st = NULL,
|
||||
fuse_timeouts_t *timeouts = NULL);
|
||||
|
||||
int
|
||||
symlink(const char *target,
|
||||
const fs::path &linkpath,
|
||||
struct stat *st = NULL,
|
||||
fuse_timeouts_t *timeouts = NULL);
|
||||
|
||||
symlink(const fuse_req_ctx_t *ctx,
|
||||
const char *target,
|
||||
const fs::path &linkpath,
|
||||
struct stat *st = NULL,
|
||||
fuse_timeouts_t *timeouts = NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
int
|
||||
FUSE::syncfs()
|
||||
FUSE::syncfs(const fuse_req_ctx_t *ctx_)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,5 +23,5 @@
|
|||
|
||||
namespace FUSE
|
||||
{
|
||||
int syncfs();
|
||||
int syncfs(const fuse_req_ctx_t *ctx);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,9 +24,10 @@
|
|||
|
||||
|
||||
int
|
||||
FUSE::tmpfile(const char *fusepath_,
|
||||
mode_t mode_,
|
||||
fuse_file_info_t *ffi_)
|
||||
FUSE::tmpfile(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_,
|
||||
mode_t mode_,
|
||||
fuse_file_info_t *ffi_)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@
|
|||
namespace FUSE
|
||||
{
|
||||
int
|
||||
tmpfile(const char *fusepath,
|
||||
mode_t mode,
|
||||
fuse_file_info_t *ffi);
|
||||
tmpfile(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath,
|
||||
mode_t mode,
|
||||
fuse_file_info_t *ffi);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,12 +90,12 @@ _truncate(const Policy::Action &actionFunc_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::truncate(const char *fusepath_,
|
||||
off_t size_)
|
||||
FUSE::truncate(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_,
|
||||
off_t size_)
|
||||
{
|
||||
const fs::path fusepath{fusepath_};
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
const fs::path fusepath{fusepath_};
|
||||
const ugid::Set ugid(ctx_);
|
||||
|
||||
return ::_truncate(cfg.func.truncate.policy,
|
||||
cfg.func.getattr.policy,
|
||||
|
|
|
|||
|
|
@ -16,12 +16,15 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "fuse_req_ctx.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
truncate(const char *fusepath,
|
||||
off_t size);
|
||||
truncate(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath,
|
||||
off_t size);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,11 +65,11 @@ _unlink(const Policy::Action &unlinkPolicy_,
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::unlink(const char *fusepath_)
|
||||
FUSE::unlink(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_)
|
||||
{
|
||||
const fs::path fusepath{fusepath_};
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
const fs::path fusepath{fusepath_};
|
||||
const ugid::Set ugid(ctx_);
|
||||
|
||||
return ::_unlink(cfg.func.unlink.policy,
|
||||
cfg.branches,
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue