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
int
_access(const fs::find::Func searchFunc,
_access(const Policy::FuncPtr searchFunc,
const vector<string> &srcmounts,
const size_t minfreespace,
const string &fusepath,

2
src/chmod.cpp

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

2
src/chown.cpp

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

4
src/create.cpp

@ -43,8 +43,8 @@ using mergerfs::Policy;
static
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 size_t minfreespace,
const string &fusepath,

2
src/fs.hpp

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

3
src/getattr.cpp

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

2
src/getxattr.cpp

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

2
src/ioctl.cpp

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

6
src/link.cpp

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

2
src/listxattr.cpp

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

5
src/mkdir.cpp

@ -38,11 +38,12 @@
using std::string;
using std::vector;
using mergerfs::Policy;
static
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 size_t minfreespace,
const string &fusepath,

5
src/mknod.cpp

@ -40,11 +40,12 @@
using std::string;
using std::vector;
using mergerfs::Policy;
static
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 size_t minfreespace,
const string &fusepath,

3
src/open.cpp

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

20
src/policy.hpp

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

12
src/readlink.cpp

@ -41,12 +41,12 @@ using mergerfs::Policy;
static
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;
Paths path;

3
src/removexattr.cpp

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

7
src/rename.cpp

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

2
src/rmdir.cpp

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

2
src/setxattr.cpp

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

3
src/symlink.cpp

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

3
src/truncate.cpp

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

3
src/unlink.cpp

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

9
src/utimens.cpp

@ -38,13 +38,14 @@
using std::string;
using std::vector;
using mergerfs::Policy;
static
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])
{
int rv;

Loading…
Cancel
Save