Browse Source

checkpoint

toml
Antonio SJ Musumeci 3 years ago
parent
commit
dc8baee8a6
  1. 6
      src/fuse_getattr_func.cpp
  2. 3
      src/fuse_getattr_func.hpp
  3. 4
      src/fuse_listxattr.cpp
  4. 12
      src/fuse_listxattr_func.cpp
  5. 9
      src/fuse_listxattr_func.hpp
  6. 9
      src/fuse_listxattr_func_base.hpp
  7. 13
      src/fuse_listxattr_func_ff.cpp
  8. 6
      src/fuse_listxattr_func_ff.hpp
  9. 20
      src/fuse_mkdir.cpp
  10. 6
      src/fuse_mkdir_func.cpp
  11. 6
      src/fuse_mkdir_func.hpp
  12. 8
      src/fuse_mkdir_func_base.hpp
  13. 10
      src/fuse_mkdir_func_epff.cpp
  14. 6
      src/fuse_mkdir_func_epff.hpp
  15. 12
      src/fuse_mkdir_func_ff.cpp
  16. 6
      src/fuse_mkdir_func_ff.hpp
  17. 3
      src/fuse_mkdir_mkdir.cpp
  18. 8
      src/fuse_mkdir_mkdir.hpp

6
src/fuse_getattr_func.cpp

@ -27,12 +27,6 @@ FUSE::GETATTR::Func::Func(const toml::value &toml_)
_getattr = FuncFactory(toml_); _getattr = FuncFactory(toml_);
} }
void
FUSE::GETATTR::Func::operator=(const toml::value &toml_)
{
_getattr = FuncFactory(toml_);
}
int int
FUSE::GETATTR::Func::operator()(const gfs::path &fusepath_, FUSE::GETATTR::Func::operator()(const gfs::path &fusepath_,
struct stat *st_, struct stat *st_,

3
src/fuse_getattr_func.hpp

@ -39,9 +39,6 @@ namespace FUSE::GETATTR
struct stat *st, struct stat *st,
fuse_timeouts_t *timeout); fuse_timeouts_t *timeout);
void operator=(const toml::value&);
private: private:
FuncBase::Ptr _getattr; FuncBase::Ptr _getattr;
}; };

4
src/fuse_listxattr.cpp

@ -93,9 +93,11 @@ namespace FUSE::LISTXATTR
size_t size_) size_t size_)
{ {
State s; State s;
gfs::path fusepath;
const fuse_context *fc = fuse_get_context(); const fuse_context *fc = fuse_get_context();
const ugid::Set ugid(fc->uid,fc->gid); const ugid::Set ugid(fc->uid,fc->gid);
return s->listxattr(fusepath_,list_,size_);
fusepath = &fusepath_[1];
return s->listxattr(fusepath,list_,size_);
} }
} }

12
src/fuse_listxattr_func.cpp

@ -25,16 +25,10 @@ FUSE::LISTXATTR::Func::Func(const toml::value &toml_)
_listxattr = FuncFactory(toml_); _listxattr = FuncFactory(toml_);
} }
void
FUSE::LISTXATTR::Func::operator=(const toml::value &toml_)
{
_listxattr = FuncFactory(toml_);
}
int 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_); return (*_listxattr)(fusepath_,list_,size_);
} }

9
src/fuse_listxattr_func.hpp

@ -33,12 +33,9 @@ namespace FUSE::LISTXATTR
Func(const toml::value &); Func(const toml::value &);
public: 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: private:
FuncBase::Ptr _listxattr; FuncBase::Ptr _listxattr;

9
src/fuse_listxattr_func_base.hpp

@ -18,6 +18,8 @@
#pragma once #pragma once
#include "fs_path.hpp"
#include <memory> #include <memory>
@ -29,9 +31,8 @@ namespace FUSE::LISTXATTR
typedef std::shared_ptr<FuncBase> Ptr; typedef std::shared_ptr<FuncBase> Ptr;
public: 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;
}; };
} }

13
src/fuse_listxattr_func_ff.cpp

@ -21,9 +21,6 @@
#include "fs_llistxattr.hpp" #include "fs_llistxattr.hpp"
namespace gfs = ghc::filesystem;
FUSE::LISTXATTR::FuncFF::FuncFF(const toml::value &toml_) FUSE::LISTXATTR::FuncFF::FuncFF(const toml::value &toml_)
: _branches(toml_) : _branches(toml_)
{ {
@ -31,20 +28,18 @@ FUSE::LISTXATTR::FuncFF::FuncFF(const toml::value &toml_)
} }
int 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; int rv;
gfs::path fusepath;
gfs::path fullpath; gfs::path fullpath;
fusepath = &fusepath_[1];
for(const auto &branch_group : _branches) for(const auto &branch_group : _branches)
{ {
for(const auto &branch : branch_group) for(const auto &branch : branch_group)
{ {
fullpath = branch.path / fusepath;
fullpath = branch.path / fusepath_;
rv = fs::llistxattr(fullpath,list_,size_); rv = fs::llistxattr(fullpath,list_,size_);
if(rv == -ENOENT) if(rv == -ENOENT)

6
src/fuse_listxattr_func_ff.hpp

@ -32,9 +32,9 @@ namespace FUSE::LISTXATTR
FuncFF(const toml::value&); FuncFF(const toml::value&);
public: 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: private:
Branches2 _branches; Branches2 _branches;

20
src/fuse_mkdir.cpp

@ -148,30 +148,16 @@ namespace l
namespace FUSE::MKDIR 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 int
mkdir(const char *fusepath_, mkdir(const char *fusepath_,
mode_t mode_) mode_t mode_)
{ {
State s; State s;
gfs::path fusepath;
const fuse_context *fc = fuse_get_context(); const fuse_context *fc = fuse_get_context();
const ugid::Set ugid(fc->uid,fc->gid); 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);
} }
} }

6
src/fuse_mkdir_func.cpp

@ -28,9 +28,9 @@ FUSE::MKDIR::Func::Func(const toml::value &toml_)
} }
int 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_); return (*_mkdir)(fusepath_,mode_,umask_);
} }

6
src/fuse_mkdir_func.hpp

@ -31,9 +31,9 @@ namespace FUSE::MKDIR
Func(const toml::value &); Func(const toml::value &);
public: 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: private:
FuncBase::Ptr _mkdir; FuncBase::Ptr _mkdir;

8
src/fuse_mkdir_func_base.hpp

@ -18,6 +18,8 @@
#pragma once #pragma once
#include "fs_path.hpp"
#include "fuse.h" #include "fuse.h"
#include <memory> #include <memory>
@ -31,8 +33,8 @@ namespace FUSE::MKDIR
typedef std::shared_ptr<FuncBase> Ptr; typedef std::shared_ptr<FuncBase> Ptr;
public: 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;
}; };
} }

10
src/fuse_mkdir_func_epff.cpp

@ -30,20 +30,18 @@ FUSE::MKDIR::FuncEPFF::FuncEPFF(const toml::value &toml_)
} }
int 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; int rv;
gfs::path fusepath;
gfs::path fullpath; gfs::path fullpath;
fusepath = &fusepath_[1];
for(const auto &branch_group : _branches) for(const auto &branch_group : _branches)
{ {
for(const auto &branch : branch_group) for(const auto &branch : branch_group)
{ {
fullpath = branch.path / fusepath;
fullpath = branch.path / fusepath_;
rv = FUSE::MKDIR::mkdir(fullpath,mode_,umask_); rv = FUSE::MKDIR::mkdir(fullpath,mode_,umask_);
if(rv == -ENOENT) if(rv == -ENOENT)

6
src/fuse_mkdir_func_epff.hpp

@ -31,9 +31,9 @@ namespace FUSE::MKDIR
FuncEPFF(const toml::value&); FuncEPFF(const toml::value&);
public: 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: private:
Branches2 _branches; Branches2 _branches;

12
src/fuse_mkdir_func_ff.cpp

@ -32,25 +32,23 @@ FUSE::MKDIR::FuncFF::FuncFF(const toml::value &toml_)
} }
int 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; int rv;
gfs::path fusepath;
gfs::path fullpath; gfs::path fullpath;
fusepath = &fusepath_[1];
for(const auto &branch_group : _branches) for(const auto &branch_group : _branches)
{ {
for(const auto &branch : branch_group) for(const auto &branch : branch_group)
{ {
fullpath = branch.path / fusepath;
fullpath = branch.path / fusepath_;
rv = FUSE::MKDIR::mkdir(fullpath,mode_,umask_); rv = FUSE::MKDIR::mkdir(fullpath,mode_,umask_);
if(rv == -ENOENT) if(rv == -ENOENT)
{ {
rv = fs::clonepath_as_root(_branches,branch.path,fusepath);
rv = fs::clonepath_as_root(_branches,branch.path,fusepath_);
if(rv >= 0) if(rv >= 0)
rv = FUSE::MKDIR::mkdir(fullpath,mode_,umask_); rv = FUSE::MKDIR::mkdir(fullpath,mode_,umask_);
} }

6
src/fuse_mkdir_func_ff.hpp

@ -31,9 +31,9 @@ namespace FUSE::MKDIR
FuncFF(const toml::value&); FuncFF(const toml::value&);
public: 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: private:
Branches2 _branches; Branches2 _branches;

3
src/fuse_mkdir_mkdir.cpp

@ -22,9 +22,6 @@
#include "fs_mkdir.hpp" #include "fs_mkdir.hpp"
namespace gfs = ghc::filesystem;
int int
FUSE::MKDIR::mkdir(const gfs::path &fullpath_, FUSE::MKDIR::mkdir(const gfs::path &fullpath_,
const mode_t mode_, const mode_t mode_,

8
src/fuse_mkdir_mkdir.hpp

@ -18,7 +18,7 @@
#pragma once #pragma once
#include "ghc/filesystem.hpp"
#include "fs_path.hpp"
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
@ -27,7 +27,7 @@
namespace FUSE::MKDIR namespace FUSE::MKDIR
{ {
int 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…
Cancel
Save