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. 8
      src/fuse_listxattr_func.cpp
  5. 5
      src/fuse_listxattr_func.hpp
  6. 5
      src/fuse_listxattr_func_base.hpp
  7. 9
      src/fuse_listxattr_func_ff.cpp
  8. 2
      src/fuse_listxattr_func_ff.hpp
  9. 20
      src/fuse_mkdir.cpp
  10. 2
      src/fuse_mkdir_func.cpp
  11. 2
      src/fuse_mkdir_func.hpp
  12. 4
      src/fuse_mkdir_func_base.hpp
  13. 6
      src/fuse_mkdir_func_epff.cpp
  14. 2
      src/fuse_mkdir_func_epff.hpp
  15. 8
      src/fuse_mkdir_func_ff.cpp
  16. 2
      src/fuse_mkdir_func_ff.hpp
  17. 3
      src/fuse_mkdir_mkdir.cpp
  18. 4
      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_);
} }
} }

8
src/fuse_listxattr_func.cpp

@ -25,14 +25,8 @@ 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_,
FUSE::LISTXATTR::Func::operator()(const gfs::path &fusepath_,
char *list_, char *list_,
const size_t size_) const size_t size_)
{ {

5
src/fuse_listxattr_func.hpp

@ -33,13 +33,10 @@ namespace FUSE::LISTXATTR
Func(const toml::value &); Func(const toml::value &);
public: public:
int operator()(const char *fusepath,
int operator()(const gfs::path &fusepath,
char *buf, char *buf,
size_t count); size_t count);
void operator=(const toml::value&);
private: private:
FuncBase::Ptr _listxattr; FuncBase::Ptr _listxattr;
}; };

5
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,
virtual int operator()(const gfs::path &fusepath,
char *list, char *list,
const size_t size) = 0; const size_t size) = 0;
}; };
} }

9
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_,
FUSE::LISTXATTR::FuncFF::operator()(const gfs::path &fusepath_,
char *list_, char *list_,
const size_t size_) 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)

2
src/fuse_listxattr_func_ff.hpp

@ -32,7 +32,7 @@ namespace FUSE::LISTXATTR
FuncFF(const toml::value&); FuncFF(const toml::value&);
public: public:
int operator()(const char *fusepath,
int operator()(const gfs::path &fusepath,
char *list, char *list,
const size_t size) final; const size_t size) final;

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);
} }
} }

2
src/fuse_mkdir_func.cpp

@ -28,7 +28,7 @@ FUSE::MKDIR::Func::Func(const toml::value &toml_)
} }
int int
FUSE::MKDIR::Func::operator()(const char *fusepath_,
FUSE::MKDIR::Func::operator()(const gfs::path &fusepath_,
const mode_t mode_, const mode_t mode_,
const mode_t umask_) const mode_t umask_)
{ {

2
src/fuse_mkdir_func.hpp

@ -31,7 +31,7 @@ namespace FUSE::MKDIR
Func(const toml::value &); Func(const toml::value &);
public: public:
int operator()(const char *fusepath,
int operator()(const gfs::path &fusepath,
const mode_t mode, const mode_t mode,
const mode_t umask); const mode_t umask);

4
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,7 +33,7 @@ namespace FUSE::MKDIR
typedef std::shared_ptr<FuncBase> Ptr; typedef std::shared_ptr<FuncBase> Ptr;
public: public:
virtual int operator()(const char *fusepath,
virtual int operator()(const gfs::path &fusepath,
const mode_t mode, const mode_t mode,
const mode_t umask) = 0; const mode_t umask) = 0;
}; };

6
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_,
FUSE::MKDIR::FuncEPFF::operator()(const gfs::path &fusepath_,
const mode_t mode_, const mode_t mode_,
const mode_t umask_) 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)

2
src/fuse_mkdir_func_epff.hpp

@ -31,7 +31,7 @@ namespace FUSE::MKDIR
FuncEPFF(const toml::value&); FuncEPFF(const toml::value&);
public: public:
int operator()(const char *fusepath,
int operator()(const gfs::path &fusepath,
const mode_t mode, const mode_t mode,
const mode_t umask) final; const mode_t umask) final;

8
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_,
FUSE::MKDIR::FuncFF::operator()(const gfs::path &fusepath_,
const mode_t mode_, const mode_t mode_,
const mode_t umask_) 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_);
} }

2
src/fuse_mkdir_func_ff.hpp

@ -31,7 +31,7 @@ namespace FUSE::MKDIR
FuncFF(const toml::value&); FuncFF(const toml::value&);
public: public:
int operator()(const char *fusepath,
int operator()(const gfs::path &fusepath,
const mode_t mode, const mode_t mode,
const mode_t umask) final; const mode_t umask) final;

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_,

4
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,
mkdir(const gfs::path &fullpath,
const mode_t mode, const mode_t mode,
const mode_t umask); const mode_t umask);
} }
Loading…
Cancel
Save