mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-25 17:36:25 -05:00
checkpoint
This commit is contained in:
parent
cba7433166
commit
dc8baee8a6
18 changed files with 54 additions and 93 deletions
|
|
@ -27,12 +27,6 @@ FUSE::GETATTR::Func::Func(const toml::value &toml_)
|
|||
_getattr = FuncFactory(toml_);
|
||||
}
|
||||
|
||||
void
|
||||
FUSE::GETATTR::Func::operator=(const toml::value &toml_)
|
||||
{
|
||||
_getattr = FuncFactory(toml_);
|
||||
}
|
||||
|
||||
int
|
||||
FUSE::GETATTR::Func::operator()(const gfs::path &fusepath_,
|
||||
struct stat *st_,
|
||||
|
|
|
|||
|
|
@ -39,9 +39,6 @@ namespace FUSE::GETATTR
|
|||
struct stat *st,
|
||||
fuse_timeouts_t *timeout);
|
||||
|
||||
|
||||
void operator=(const toml::value&);
|
||||
|
||||
private:
|
||||
FuncBase::Ptr _getattr;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -93,9 +93,11 @@ namespace FUSE::LISTXATTR
|
|||
size_t size_)
|
||||
{
|
||||
State s;
|
||||
gfs::path fusepath;
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
|
||||
return s->listxattr(fusepath_,list_,size_);
|
||||
fusepath = &fusepath_[1];
|
||||
return s->listxattr(fusepath,list_,size_);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,16 +25,10 @@ FUSE::LISTXATTR::Func::Func(const toml::value &toml_)
|
|||
_listxattr = FuncFactory(toml_);
|
||||
}
|
||||
|
||||
void
|
||||
FUSE::LISTXATTR::Func::operator=(const toml::value &toml_)
|
||||
{
|
||||
_listxattr = FuncFactory(toml_);
|
||||
}
|
||||
|
||||
int
|
||||
FUSE::LISTXATTR::Func::operator()(const char *fusepath_,
|
||||
char *list_,
|
||||
const size_t size_)
|
||||
FUSE::LISTXATTR::Func::operator()(const gfs::path &fusepath_,
|
||||
char *list_,
|
||||
const size_t size_)
|
||||
{
|
||||
return (*_listxattr)(fusepath_,list_,size_);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,12 +33,9 @@ namespace FUSE::LISTXATTR
|
|||
Func(const toml::value &);
|
||||
|
||||
public:
|
||||
int operator()(const char *fusepath,
|
||||
char *buf,
|
||||
size_t count);
|
||||
|
||||
|
||||
void operator=(const toml::value&);
|
||||
int operator()(const gfs::path &fusepath,
|
||||
char *buf,
|
||||
size_t count);
|
||||
|
||||
private:
|
||||
FuncBase::Ptr _listxattr;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "fs_path.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
|
|
@ -29,9 +31,8 @@ namespace FUSE::LISTXATTR
|
|||
typedef std::shared_ptr<FuncBase> Ptr;
|
||||
|
||||
public:
|
||||
virtual int operator()(const char *fusepath,
|
||||
char *list,
|
||||
const size_t size) = 0;
|
||||
|
||||
virtual int operator()(const gfs::path &fusepath,
|
||||
char *list,
|
||||
const size_t size) = 0;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,9 +21,6 @@
|
|||
#include "fs_llistxattr.hpp"
|
||||
|
||||
|
||||
namespace gfs = ghc::filesystem;
|
||||
|
||||
|
||||
FUSE::LISTXATTR::FuncFF::FuncFF(const toml::value &toml_)
|
||||
: _branches(toml_)
|
||||
{
|
||||
|
|
@ -31,20 +28,18 @@ FUSE::LISTXATTR::FuncFF::FuncFF(const toml::value &toml_)
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::LISTXATTR::FuncFF::operator()(const char *fusepath_,
|
||||
char *list_,
|
||||
const size_t size_)
|
||||
FUSE::LISTXATTR::FuncFF::operator()(const gfs::path &fusepath_,
|
||||
char *list_,
|
||||
const size_t size_)
|
||||
{
|
||||
int rv;
|
||||
gfs::path fusepath;
|
||||
gfs::path fullpath;
|
||||
|
||||
fusepath = &fusepath_[1];
|
||||
for(const auto &branch_group : _branches)
|
||||
{
|
||||
for(const auto &branch : branch_group)
|
||||
{
|
||||
fullpath = branch.path / fusepath;
|
||||
fullpath = branch.path / fusepath_;
|
||||
|
||||
rv = fs::llistxattr(fullpath,list_,size_);
|
||||
if(rv == -ENOENT)
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ namespace FUSE::LISTXATTR
|
|||
FuncFF(const toml::value&);
|
||||
|
||||
public:
|
||||
int operator()(const char *fusepath,
|
||||
char *list,
|
||||
const size_t size) final;
|
||||
int operator()(const gfs::path &fusepath,
|
||||
char *list,
|
||||
const size_t size) final;
|
||||
|
||||
private:
|
||||
Branches2 _branches;
|
||||
|
|
|
|||
|
|
@ -148,30 +148,16 @@ namespace l
|
|||
|
||||
namespace FUSE::MKDIR
|
||||
{
|
||||
int
|
||||
mkdir_old(const char *fusepath_,
|
||||
mode_t mode_)
|
||||
{
|
||||
Config::Read cfg;
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
|
||||
return l::mkdir(cfg->func.getattr.policy,
|
||||
cfg->func.mkdir.policy,
|
||||
cfg->branches,
|
||||
fusepath_,
|
||||
mode_,
|
||||
fc->umask);
|
||||
}
|
||||
|
||||
int
|
||||
mkdir(const char *fusepath_,
|
||||
mode_t mode_)
|
||||
{
|
||||
State s;
|
||||
gfs::path fusepath;
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
const ugid::Set ugid(fc->uid,fc->gid);
|
||||
|
||||
return s->mkdir(fusepath_,mode_,fc->umask);
|
||||
fusepath = &fusepath_[1];
|
||||
return s->mkdir(fusepath,mode_,fc->umask);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ FUSE::MKDIR::Func::Func(const toml::value &toml_)
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::MKDIR::Func::operator()(const char *fusepath_,
|
||||
const mode_t mode_,
|
||||
const mode_t umask_)
|
||||
FUSE::MKDIR::Func::operator()(const gfs::path &fusepath_,
|
||||
const mode_t mode_,
|
||||
const mode_t umask_)
|
||||
{
|
||||
return (*_mkdir)(fusepath_,mode_,umask_);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ namespace FUSE::MKDIR
|
|||
Func(const toml::value &);
|
||||
|
||||
public:
|
||||
int operator()(const char *fusepath,
|
||||
const mode_t mode,
|
||||
const mode_t umask);
|
||||
int operator()(const gfs::path &fusepath,
|
||||
const mode_t mode,
|
||||
const mode_t umask);
|
||||
|
||||
private:
|
||||
FuncBase::Ptr _mkdir;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "fs_path.hpp"
|
||||
|
||||
#include "fuse.h"
|
||||
|
||||
#include <memory>
|
||||
|
|
@ -31,8 +33,8 @@ namespace FUSE::MKDIR
|
|||
typedef std::shared_ptr<FuncBase> Ptr;
|
||||
|
||||
public:
|
||||
virtual int operator()(const char *fusepath,
|
||||
const mode_t mode,
|
||||
const mode_t umask) = 0;
|
||||
virtual int operator()(const gfs::path &fusepath,
|
||||
const mode_t mode,
|
||||
const mode_t umask) = 0;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,20 +30,18 @@ FUSE::MKDIR::FuncEPFF::FuncEPFF(const toml::value &toml_)
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::MKDIR::FuncEPFF::operator()(const char *fusepath_,
|
||||
const mode_t mode_,
|
||||
const mode_t umask_)
|
||||
FUSE::MKDIR::FuncEPFF::operator()(const gfs::path &fusepath_,
|
||||
const mode_t mode_,
|
||||
const mode_t umask_)
|
||||
{
|
||||
int rv;
|
||||
gfs::path fusepath;
|
||||
gfs::path fullpath;
|
||||
|
||||
fusepath = &fusepath_[1];
|
||||
for(const auto &branch_group : _branches)
|
||||
{
|
||||
for(const auto &branch : branch_group)
|
||||
{
|
||||
fullpath = branch.path / fusepath;
|
||||
fullpath = branch.path / fusepath_;
|
||||
|
||||
rv = FUSE::MKDIR::mkdir(fullpath,mode_,umask_);
|
||||
if(rv == -ENOENT)
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ namespace FUSE::MKDIR
|
|||
FuncEPFF(const toml::value&);
|
||||
|
||||
public:
|
||||
int operator()(const char *fusepath,
|
||||
const mode_t mode,
|
||||
const mode_t umask) final;
|
||||
int operator()(const gfs::path &fusepath,
|
||||
const mode_t mode,
|
||||
const mode_t umask) final;
|
||||
|
||||
private:
|
||||
Branches2 _branches;
|
||||
|
|
|
|||
|
|
@ -32,25 +32,23 @@ FUSE::MKDIR::FuncFF::FuncFF(const toml::value &toml_)
|
|||
}
|
||||
|
||||
int
|
||||
FUSE::MKDIR::FuncFF::operator()(const char *fusepath_,
|
||||
const mode_t mode_,
|
||||
const mode_t umask_)
|
||||
FUSE::MKDIR::FuncFF::operator()(const gfs::path &fusepath_,
|
||||
const mode_t mode_,
|
||||
const mode_t umask_)
|
||||
{
|
||||
int rv;
|
||||
gfs::path fusepath;
|
||||
gfs::path fullpath;
|
||||
|
||||
fusepath = &fusepath_[1];
|
||||
for(const auto &branch_group : _branches)
|
||||
{
|
||||
for(const auto &branch : branch_group)
|
||||
{
|
||||
fullpath = branch.path / fusepath;
|
||||
fullpath = branch.path / fusepath_;
|
||||
|
||||
rv = FUSE::MKDIR::mkdir(fullpath,mode_,umask_);
|
||||
if(rv == -ENOENT)
|
||||
{
|
||||
rv = fs::clonepath_as_root(_branches,branch.path,fusepath);
|
||||
rv = fs::clonepath_as_root(_branches,branch.path,fusepath_);
|
||||
if(rv >= 0)
|
||||
rv = FUSE::MKDIR::mkdir(fullpath,mode_,umask_);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ namespace FUSE::MKDIR
|
|||
FuncFF(const toml::value&);
|
||||
|
||||
public:
|
||||
int operator()(const char *fusepath,
|
||||
const mode_t mode,
|
||||
const mode_t umask) final;
|
||||
int operator()(const gfs::path &fusepath,
|
||||
const mode_t mode,
|
||||
const mode_t umask) final;
|
||||
|
||||
private:
|
||||
Branches2 _branches;
|
||||
|
|
|
|||
|
|
@ -22,9 +22,6 @@
|
|||
#include "fs_mkdir.hpp"
|
||||
|
||||
|
||||
namespace gfs = ghc::filesystem;
|
||||
|
||||
|
||||
int
|
||||
FUSE::MKDIR::mkdir(const gfs::path &fullpath_,
|
||||
const mode_t mode_,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "ghc/filesystem.hpp"
|
||||
#include "fs_path.hpp"
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
namespace FUSE::MKDIR
|
||||
{
|
||||
int
|
||||
mkdir(const ghc::filesystem::path &fullpath,
|
||||
const mode_t mode,
|
||||
const mode_t umask);
|
||||
mkdir(const gfs::path &fullpath,
|
||||
const mode_t mode,
|
||||
const mode_t umask);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue