Browse Source

move policy function type from fs to policy

pull/77/head
Antonio SJ Musumeci 10 years ago
parent
commit
3c8f12281f
  1. 2
      src/access.cpp
  2. 2
      src/chmod.cpp
  3. 2
      src/chown.cpp
  4. 4
      src/create.cpp
  5. 2
      src/fs.hpp
  6. 3
      src/getattr.cpp
  7. 2
      src/getxattr.cpp
  8. 2
      src/ioctl.cpp
  9. 6
      src/link.cpp
  10. 2
      src/listxattr.cpp
  11. 5
      src/mkdir.cpp
  12. 5
      src/mknod.cpp
  13. 3
      src/open.cpp
  14. 20
      src/policy.hpp
  15. 12
      src/readlink.cpp
  16. 3
      src/removexattr.cpp
  17. 7
      src/rename.cpp
  18. 2
      src/rmdir.cpp
  19. 2
      src/setxattr.cpp
  20. 3
      src/symlink.cpp
  21. 3
      src/truncate.cpp
  22. 3
      src/unlink.cpp
  23. 9
      src/utimens.cpp

2
src/access.cpp

@ -45,7 +45,7 @@ using mergerfs::Policy;
static static
int int
_access(const fs::find::Func searchFunc,
_access(const Policy::FuncPtr searchFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace, const size_t minfreespace,
const string &fusepath, const string &fusepath,

2
src/chmod.cpp

@ -39,7 +39,7 @@ using mergerfs::Policy;
static static
int int
_chmod(const fs::find::Func actionFunc,
_chmod(const Policy::FuncPtr actionFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace, const size_t minfreespace,
const string &fusepath, const string &fusepath,

2
src/chown.cpp

@ -40,7 +40,7 @@ using mergerfs::Policy;
static static
int int
_chown(const fs::find::Func actionFunc,
_chown(const Policy::FuncPtr actionFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace, const size_t minfreespace,
const string &fusepath, const string &fusepath,

4
src/create.cpp

@ -43,8 +43,8 @@ using mergerfs::Policy;
static static
int int
_create(const fs::find::Func searchFunc,
const fs::find::Func createFunc,
_create(const Policy::FuncPtr searchFunc,
const Policy::FuncPtr createFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace, const size_t minfreespace,
const string &fusepath, const string &fusepath,

2
src/fs.hpp

@ -100,8 +100,6 @@ namespace fs
namespace find namespace find
{ {
typedef int (*Func)(const vector<string>&,const string&,const size_t,Paths&);
int invalid(const vector<string> &basepaths, int invalid(const vector<string> &basepaths,
const string &fusepath, const string &fusepath,
const size_t minfreespace, const size_t minfreespace,

3
src/getattr.cpp

@ -39,6 +39,7 @@
using std::string; using std::string;
using std::vector; using std::vector;
using mergerfs::Policy;
static static
int int
@ -65,7 +66,7 @@ _getattr_controlfile(struct stat &buf)
static static
int int
_getattr(const fs::find::Func searchFunc,
_getattr(const Policy::FuncPtr searchFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace, const size_t minfreespace,
const string &fusepath, const string &fusepath,

2
src/getxattr.cpp

@ -190,7 +190,7 @@ _getxattr_user_mergerfs(const Path &path,
static static
int int
_getxattr(const fs::find::Func searchFunc,
_getxattr(const Policy::FuncPtr searchFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace, const size_t minfreespace,
const string &fusepath, const string &fusepath,

2
src/ioctl.cpp

@ -82,7 +82,7 @@ _ioctl(const int fd,
#ifdef FUSE_IOCTL_DIR #ifdef FUSE_IOCTL_DIR
static static
int int
_ioctl_dir_base(const fs::find::Func searchFunc,
_ioctl_dir_base(const Policy::FuncPtr searchFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace, const size_t minfreespace,
const string &fusepath, const string &fusepath,

6
src/link.cpp

@ -41,7 +41,7 @@ using mergerfs::Policy;
static static
int int
_single_link(const fs::find::Func searchFunc,
_single_link(const Policy::FuncPtr searchFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace, const size_t minfreespace,
const string &base, const string &base,
@ -76,8 +76,8 @@ _single_link(const fs::find::Func searchFunc,
static static
int int
_link(const fs::find::Func searchFunc,
const fs::find::Func actionFunc,
_link(const Policy::FuncPtr searchFunc,
const Policy::FuncPtr actionFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace, const size_t minfreespace,
const string &oldpath, const string &oldpath,

2
src/listxattr.cpp

@ -69,7 +69,7 @@ _listxattr_controlfile(char *list,
static static
int int
_listxattr(const fs::find::Func searchFunc,
_listxattr(const Policy::FuncPtr searchFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace, const size_t minfreespace,
const string &fusepath, const string &fusepath,

5
src/mkdir.cpp

@ -38,11 +38,12 @@
using std::string; using std::string;
using std::vector; using std::vector;
using mergerfs::Policy;
static static
int int
_mkdir(const fs::find::Func searchFunc,
const fs::find::Func createFunc,
_mkdir(const Policy::FuncPtr searchFunc,
const Policy::FuncPtr createFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace, const size_t minfreespace,
const string &fusepath, const string &fusepath,

5
src/mknod.cpp

@ -40,11 +40,12 @@
using std::string; using std::string;
using std::vector; using std::vector;
using mergerfs::Policy;
static static
int int
_mknod(const fs::find::Func searchFunc,
const fs::find::Func createFunc,
_mknod(const Policy::FuncPtr searchFunc,
const Policy::FuncPtr createFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace, const size_t minfreespace,
const string &fusepath, const string &fusepath,

3
src/open.cpp

@ -38,10 +38,11 @@
using std::string; using std::string;
using std::vector; using std::vector;
using mergerfs::Policy;
static static
int int
_open(const fs::find::Func searchFunc,
_open(const Policy::FuncPtr searchFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace, const size_t minfreespace,
const string &fusepath, const string &fusepath,

20
src/policy.hpp

@ -26,8 +26,10 @@
#define __POLICY_HPP__ #define __POLICY_HPP__
#include <string> #include <string>
#include <vector>
#include <map> #include <map>
#include "path.hpp"
#include "fs.hpp" #include "fs.hpp"
namespace mergerfs namespace mergerfs
@ -35,6 +37,8 @@ namespace mergerfs
class Policy class Policy
{ {
public: public:
typedef int (*FuncPtr)(const std::vector<std::string>&,const std::string&,const std::size_t,Paths&);
struct Enum struct Enum
{ {
enum Type enum Type
@ -55,9 +59,9 @@ namespace mergerfs
}; };
private: private:
Enum::Type _enum;
std::string _str;
fs::find::Func _func;
Enum::Type _enum;
std::string _str;
FuncPtr _func;
public: public:
Policy() Policy()
@ -67,9 +71,9 @@ namespace mergerfs
{ {
} }
Policy(const Enum::Type enum_,
const std::string &str_,
const fs::find::Func func_)
Policy(const Enum::Type enum_,
const std::string &str_,
const FuncPtr func_)
: _enum(enum_), : _enum(enum_),
_str(str_), _str(str_),
_func(func_) _func(func_)
@ -79,14 +83,14 @@ namespace mergerfs
public: public:
operator const Enum::Type() const { return _enum; } operator const Enum::Type() const { return _enum; }
operator const std::string&() const { return _str; } operator const std::string&() const { return _str; }
operator const fs::find::Func() const { return _func; }
operator const FuncPtr() const { return _func; }
operator const Policy*() const { return this; } operator const Policy*() const { return this; }
bool operator==(const Enum::Type enum_) const bool operator==(const Enum::Type enum_) const
{ return _enum == enum_; } { return _enum == enum_; }
bool operator==(const std::string &str_) const bool operator==(const std::string &str_) const
{ return _str == str_; } { return _str == str_; }
bool operator==(const fs::find::Func func_) const
bool operator==(const FuncPtr func_) const
{ return _func == func_; } { return _func == func_; }
bool operator!=(const Policy &r) const bool operator!=(const Policy &r) const

12
src/readlink.cpp

@ -41,12 +41,12 @@ using mergerfs::Policy;
static static
int int
_readlink(const fs::find::Func searchFunc,
const vector<string> &srcmounts,
const size_t minfreespace,
const string &fusepath,
char *buf,
const size_t size)
_readlink(const Policy::FuncPtr searchFunc,
const vector<string> &srcmounts,
const size_t minfreespace,
const string &fusepath,
char *buf,
const size_t size)
{ {
int rv; int rv;
Paths path; Paths path;

3
src/removexattr.cpp

@ -38,10 +38,11 @@
using std::string; using std::string;
using std::vector; using std::vector;
using mergerfs::Policy;
static static
int int
_removexattr(const fs::find::Func actionFunc,
_removexattr(const Policy::FuncPtr actionFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace, const size_t minfreespace,
const string &fusepath, const string &fusepath,

7
src/rename.cpp

@ -38,10 +38,11 @@
using std::string; using std::string;
using std::vector; using std::vector;
using mergerfs::Policy;
static static
int int
_single_rename(const fs::find::Func searchFunc,
_single_rename(const Policy::FuncPtr searchFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace, const size_t minfreespace,
const Path &oldpath, const Path &oldpath,
@ -74,8 +75,8 @@ _single_rename(const fs::find::Func searchFunc,
static static
int int
_rename(const fs::find::Func searchFunc,
const fs::find::Func actionFunc,
_rename(const Policy::FuncPtr searchFunc,
const Policy::FuncPtr actionFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace, const size_t minfreespace,
const string &oldpath, const string &oldpath,

2
src/rmdir.cpp

@ -40,7 +40,7 @@ using mergerfs::Policy;
static static
int int
_rmdir(const fs::find::Func actionFunc,
_rmdir(const Policy::FuncPtr actionFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace, const size_t minfreespace,
const string &fusepath) const string &fusepath)

2
src/setxattr.cpp

@ -240,7 +240,7 @@ _setxattr_controlfile(config::Config &config,
static static
int int
_setxattr(const fs::find::Func actionFunc,
_setxattr(const Policy::FuncPtr actionFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace, const size_t minfreespace,
const string &fusepath, const string &fusepath,

3
src/symlink.cpp

@ -36,10 +36,11 @@
using std::string; using std::string;
using std::vector; using std::vector;
using mergerfs::Policy;
static static
int int
_symlink(const fs::find::Func createFunc,
_symlink(const Policy::FuncPtr createFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace, const size_t minfreespace,
const string &oldpath, const string &oldpath,

3
src/truncate.cpp

@ -38,10 +38,11 @@
using std::string; using std::string;
using std::vector; using std::vector;
using mergerfs::Policy;
static static
int int
_truncate(const fs::find::Func actionFunc,
_truncate(const Policy::FuncPtr actionFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace, const size_t minfreespace,
const string &fusepath, const string &fusepath,

3
src/unlink.cpp

@ -37,10 +37,11 @@
using std::string; using std::string;
using std::vector; using std::vector;
using mergerfs::Policy;
static static
int int
_unlink(const fs::find::Func actionFunc,
_unlink(const Policy::FuncPtr actionFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace, const size_t minfreespace,
const string &fusepath) const string &fusepath)

9
src/utimens.cpp

@ -38,13 +38,14 @@
using std::string; using std::string;
using std::vector; using std::vector;
using mergerfs::Policy;
static static
int int
_utimens(const fs::find::Func actionFunc,
const vector<string> &srcmounts,
const size_t minfreespace,
const string &fusepath,
_utimens(const Policy::FuncPtr actionFunc,
const vector<string> &srcmounts,
const size_t minfreespace,
const string &fusepath,
const struct timespec ts[2]) const struct timespec ts[2])
{ {
int rv; int rv;

Loading…
Cancel
Save