Browse Source

move size calculations to use uint64_t. fixes #287

pull/288/head
Antonio SJ Musumeci 9 years ago
parent
commit
43cbd9c670
  1. 2
      src/access.cpp
  2. 2
      src/chmod.cpp
  3. 2
      src/chown.cpp
  4. 2
      src/config.hpp
  5. 2
      src/create.cpp
  6. 13
      src/fs.cpp
  7. 13
      src/fs.hpp
  8. 1
      src/fs_xattr.hpp
  9. 2
      src/getattr.cpp
  10. 2
      src/ioctl.cpp
  11. 14
      src/link.cpp
  12. 2
      src/listxattr.cpp
  13. 2
      src/mkdir.cpp
  14. 2
      src/mknod.cpp
  15. 9
      src/num.cpp
  16. 4
      src/num.hpp
  17. 2
      src/open.cpp
  18. 4
      src/option_parser.cpp
  19. 35
      src/policy.hpp
  20. 9
      src/policy_all.cpp
  21. 21
      src/policy_eplfs.cpp
  22. 21
      src/policy_eplus.cpp
  23. 21
      src/policy_epmfs.cpp
  24. 2
      src/policy_erofs.cpp
  25. 9
      src/policy_ff.cpp
  26. 3
      src/policy_invalid.cpp
  27. 21
      src/policy_lfs.cpp
  28. 19
      src/policy_lus.cpp
  29. 13
      src/policy_mfs.cpp
  30. 3
      src/policy_newest.cpp
  31. 3
      src/policy_rand.cpp
  32. 2
      src/readlink.cpp
  33. 2
      src/removexattr.cpp
  34. 10
      src/rename.cpp
  35. 2
      src/rmdir.cpp
  36. 4
      src/setxattr.cpp
  37. 4
      src/statvfs_util.hpp
  38. 2
      src/symlink.cpp
  39. 2
      src/truncate.cpp
  40. 2
      src/unlink.cpp
  41. 2
      src/utimens.cpp
  42. 2
      src/write_buf.cpp

2
src/access.cpp

@ -34,7 +34,7 @@ static
int int
_access(Policy::Func::Search searchFunc, _access(Policy::Func::Search searchFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *fusepath, const char *fusepath,
const int mask) const int mask)
{ {

2
src/chmod.cpp

@ -68,7 +68,7 @@ static
int int
_chmod(Policy::Func::Action actionFunc, _chmod(Policy::Func::Action actionFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *fusepath, const char *fusepath,
const mode_t mode) const mode_t mode)
{ {

2
src/chown.cpp

@ -72,7 +72,7 @@ static
int int
_chown(Policy::Func::Action actionFunc, _chown(Policy::Func::Action actionFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *fusepath, const char *fusepath,
const uid_t uid, const uid_t uid,
const gid_t gid) const gid_t gid)

2
src/config.hpp

@ -45,7 +45,7 @@ namespace mergerfs
std::string destmount; std::string destmount;
std::vector<std::string> srcmounts; std::vector<std::string> srcmounts;
mutable pthread_rwlock_t srcmountslock; mutable pthread_rwlock_t srcmountslock;
size_t minfreespace;
uint64_t minfreespace;
bool moveonenospc; bool moveonenospc;
public: public:

2
src/create.cpp

@ -71,7 +71,7 @@ int
_create(Policy::Func::Search searchFunc, _create(Policy::Func::Search searchFunc,
Policy::Func::Create createFunc, Policy::Func::Create createFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *fusepath, const char *fusepath,
const mode_t mode, const mode_t mode,
const int flags, const int flags,

13
src/fs.cpp

@ -22,6 +22,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <glob.h> #include <glob.h>
#include <limits.h> #include <limits.h>
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/statvfs.h> #include <sys/statvfs.h>
@ -73,8 +74,8 @@ namespace fs
bool bool
info(const string &path, info(const string &path,
bool &readonly, bool &readonly,
size_t &spaceavail,
size_t &spaceused)
uint64_t &spaceavail,
uint64_t &spaceused)
{ {
bool rv; bool rv;
struct statvfs st; struct statvfs st;
@ -103,7 +104,7 @@ namespace fs
bool bool
spaceavail(const string &path, spaceavail(const string &path,
size_t &spaceavail)
uint64_t &spaceavail)
{ {
bool rv; bool rv;
struct statvfs st; struct statvfs st;
@ -117,7 +118,7 @@ namespace fs
bool bool
spaceused(const string &path, spaceused(const string &path,
size_t &spaceused)
uint64_t &spaceused)
{ {
bool rv; bool rv;
struct statvfs st; struct statvfs st;
@ -231,7 +232,7 @@ namespace fs
int int
mfs(const vector<string> &basepaths, mfs(const vector<string> &basepaths,
const size_t minfreespace,
const uint64_t minfreespace,
string &path) string &path)
{ {
fsblkcnt_t mfs; fsblkcnt_t mfs;
@ -241,7 +242,7 @@ namespace fs
mfsbasepath = NULL; mfsbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++) for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{ {
size_t spaceavail;
uint64_t spaceavail;
const string &basepath = basepaths[i]; const string &basepath = basepaths[i];
if(!fs::spaceavail(basepath,spaceavail)) if(!fs::spaceavail(basepath,spaceavail))

13
src/fs.hpp

@ -17,12 +17,13 @@
#ifndef __FS_HPP__ #ifndef __FS_HPP__
#define __FS_HPP__ #define __FS_HPP__
#include <stdint.h>
#include <string> #include <string>
#include <vector> #include <vector>
namespace fs namespace fs
{ {
using std::size_t;
using std::string; using std::string;
using std::vector; using std::vector;
@ -35,16 +36,16 @@ namespace fs
bool info(const string &path, bool info(const string &path,
bool &readonly, bool &readonly,
size_t &spaceavail,
size_t &spaceused);
uint64_t &spaceavail,
uint64_t &spaceused);
bool readonly(const string &path); bool readonly(const string &path);
bool spaceavail(const string &path, bool spaceavail(const string &path,
size_t &spaceavail);
uint64_t &spaceavail);
bool spaceused(const string &path, bool spaceused(const string &path,
size_t &spaceavail);
uint64_t &spaceavail);
void findallfiles(const vector<string> &srcmounts, void findallfiles(const vector<string> &srcmounts,
const char *fusepath, const char *fusepath,
@ -63,7 +64,7 @@ namespace fs
int getfl(const int fd); int getfl(const int fd);
int mfs(const vector<string> &srcs, int mfs(const vector<string> &srcs,
const size_t minfreespace,
const uint64_t minfreespace,
string &path); string &path);
}; };

1
src/fs_xattr.hpp

@ -25,7 +25,6 @@ namespace fs
{ {
namespace xattr namespace xattr
{ {
using std::size_t;
using std::string; using std::string;
using std::vector; using std::vector;
using std::map; using std::map;

2
src/getattr.cpp

@ -62,7 +62,7 @@ static
int int
_getattr(Policy::Func::Search searchFunc, _getattr(Policy::Func::Search searchFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *fusepath, const char *fusepath,
struct stat &buf) struct stat &buf)
{ {

2
src/ioctl.cpp

@ -58,7 +58,7 @@ static
int int
_ioctl_dir_base(Policy::Func::Search searchFunc, _ioctl_dir_base(Policy::Func::Search searchFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *fusepath, const char *fusepath,
const int cmd, const int cmd,
void *data) void *data)

14
src/link.cpp

@ -88,7 +88,7 @@ int
_link_create_path(Policy::Func::Search searchFunc, _link_create_path(Policy::Func::Search searchFunc,
Policy::Func::Action actionFunc, Policy::Func::Action actionFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *oldfusepath, const char *oldfusepath,
const char *newfusepath) const char *newfusepath)
{ {
@ -117,7 +117,7 @@ int
_clonepath_if_would_create(Policy::Func::Search searchFunc, _clonepath_if_would_create(Policy::Func::Search searchFunc,
Policy::Func::Create createFunc, Policy::Func::Create createFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const string &oldbasepath, const string &oldbasepath,
const char *oldfusepath, const char *oldfusepath,
const char *newfusepath) const char *newfusepath)
@ -158,7 +158,7 @@ int
_link_preserve_path_core(Policy::Func::Search searchFunc, _link_preserve_path_core(Policy::Func::Search searchFunc,
Policy::Func::Create createFunc, Policy::Func::Create createFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const string &oldbasepath, const string &oldbasepath,
const char *oldfusepath, const char *oldfusepath,
const char *newfusepath, const char *newfusepath,
@ -190,7 +190,7 @@ int
_link_preserve_path_loop(Policy::Func::Search searchFunc, _link_preserve_path_loop(Policy::Func::Search searchFunc,
Policy::Func::Create createFunc, Policy::Func::Create createFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *oldfusepath, const char *oldfusepath,
const char *newfusepath, const char *newfusepath,
const vector<const string*> &oldbasepaths) const vector<const string*> &oldbasepaths)
@ -216,9 +216,9 @@ _link_preserve_path(Policy::Func::Search searchFunc,
Policy::Func::Action actionFunc, Policy::Func::Action actionFunc,
Policy::Func::Create createFunc, Policy::Func::Create createFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const char *oldfusepath,
const char *newfusepath)
const uint64_t minfreespace,
const char *oldfusepath,
const char *newfusepath)
{ {
int rv; int rv;
vector<const string*> oldbasepaths; vector<const string*> oldbasepaths;

2
src/listxattr.cpp

@ -74,7 +74,7 @@ static
int int
_listxattr(Policy::Func::Search searchFunc, _listxattr(Policy::Func::Search searchFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *fusepath, const char *fusepath,
char *list, char *list,
const size_t size) const size_t size)

2
src/mkdir.cpp

@ -85,7 +85,7 @@ int
_mkdir(Policy::Func::Search searchFunc, _mkdir(Policy::Func::Search searchFunc,
Policy::Func::Create createFunc, Policy::Func::Create createFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *fusepath, const char *fusepath,
const mode_t mode) const mode_t mode)
{ {

2
src/mknod.cpp

@ -89,7 +89,7 @@ int
_mknod(Policy::Func::Search searchFunc, _mknod(Policy::Func::Search searchFunc,
Policy::Func::Create createFunc, Policy::Func::Create createFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *fusepath, const char *fusepath,
const mode_t mode, const mode_t mode,
const dev_t dev) const dev_t dev)

9
src/num.cpp

@ -14,6 +14,7 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string> #include <string>
@ -21,11 +22,11 @@
namespace num namespace num
{ {
int int
to_size_t(const std::string &str,
size_t &value)
to_uint64_t(const std::string &str,
uint64_t &value)
{ {
size_t tmp;
char *endptr;
char *endptr;
uint64_t tmp;
tmp = strtoll(str.c_str(),&endptr,10); tmp = strtoll(str.c_str(),&endptr,10);
switch(*endptr) switch(*endptr)

4
src/num.hpp

@ -14,9 +14,11 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#include <stdint.h>
#include <string> #include <string>
namespace num namespace num
{ {
int to_size_t(const std::string &str, size_t &value);
int to_uint64_t(const std::string &str, uint64_t &value);
} }

2
src/open.cpp

@ -58,7 +58,7 @@ static
int int
_open(Policy::Func::Search searchFunc, _open(Policy::Func::Search searchFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *fusepath, const char *fusepath,
const int flags, const int flags,
uint64_t &fh) uint64_t &fh)

4
src/option_parser.cpp

@ -107,11 +107,11 @@ set_default_options(fuse_args &args)
static static
int int
parse_and_process_minfreespace(const std::string &value, parse_and_process_minfreespace(const std::string &value,
size_t &minfreespace)
uint64_t &minfreespace)
{ {
int rv; int rv;
rv = num::to_size_t(value,minfreespace);
rv = num::to_uint64_t(value,minfreespace);
if(rv == -1) if(rv == -1)
return 1; return 1;

35
src/policy.hpp

@ -63,15 +63,14 @@ namespace mergerfs
struct Func struct Func
{ {
typedef std::string string; typedef std::string string;
typedef std::size_t size_t;
typedef std::vector<string> strvec; typedef std::vector<string> strvec;
typedef std::vector<const string*> cstrptrvec; typedef std::vector<const string*> cstrptrvec;
typedef const string cstring; typedef const string cstring;
typedef const size_t csize_t;
typedef const uint64_t cuint64_t;
typedef const strvec cstrvec; typedef const strvec cstrvec;
typedef const Category::Enum::Type CType; typedef const Category::Enum::Type CType;
typedef int (*Ptr)(CType,cstrvec &,const char *,csize_t,cstrptrvec &);
typedef int (*Ptr)(CType,cstrvec &,const char *,cuint64_t,cstrptrvec &);
template <CType T> template <CType T>
class Base class Base
@ -82,7 +81,7 @@ namespace mergerfs
{} {}
int int
operator()(cstrvec &b,const char *c,csize_t d,cstrptrvec &e)
operator()(cstrvec &b,const char *c,cuint64_t d,cstrptrvec &e)
{ {
return func(T,b,c,d,e); return func(T,b,c,d,e);
} }
@ -95,18 +94,18 @@ namespace mergerfs
typedef Base<Category::Enum::create> Create; typedef Base<Category::Enum::create> Create;
typedef Base<Category::Enum::search> Search; typedef Base<Category::Enum::search> Search;
static int invalid(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
static int all(CType,cstrvec&,const char*,csize_t,cstrptrvec&);
static int eplfs(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
static int eplus(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
static int epmfs(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
static int erofs(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
static int ff(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
static int lfs(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
static int lus(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
static int mfs(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
static int newest(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
static int rand(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
static int invalid(CType,cstrvec&,const char *,cuint64_t,cstrptrvec&);
static int all(CType,cstrvec&,const char*,cuint64_t,cstrptrvec&);
static int eplfs(CType,cstrvec&,const char *,cuint64_t,cstrptrvec&);
static int eplus(CType,cstrvec&,const char *,cuint64_t,cstrptrvec&);
static int epmfs(CType,cstrvec&,const char *,cuint64_t,cstrptrvec&);
static int erofs(CType,cstrvec&,const char *,cuint64_t,cstrptrvec&);
static int ff(CType,cstrvec&,const char *,cuint64_t,cstrptrvec&);
static int lfs(CType,cstrvec&,const char *,cuint64_t,cstrptrvec&);
static int lus(CType,cstrvec&,const char *,cuint64_t,cstrptrvec&);
static int mfs(CType,cstrvec&,const char *,cuint64_t,cstrptrvec&);
static int newest(CType,cstrvec&,const char *,cuint64_t,cstrptrvec&);
static int rand(CType,cstrvec&,const char *,cuint64_t,cstrptrvec&);
}; };
private: private:
@ -165,8 +164,8 @@ namespace mergerfs
static const Policy &find(const Enum::Type); static const Policy &find(const Enum::Type);
public: public:
static const std::vector<Policy> _policies_;
static const Policy * const policies;
static const std::vector<Policy> _policies_;
static const Policy * const policies;
static const Policy &invalid; static const Policy &invalid;
static const Policy &all; static const Policy &all;

9
src/policy_all.cpp

@ -25,19 +25,18 @@
using std::string; using std::string;
using std::vector; using std::vector;
using std::size_t;
static static
int int
_all_create(const vector<string> &basepaths, _all_create(const vector<string> &basepaths,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
for(size_t i = 0, ei = basepaths.size(); i != ei; i++) for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{ {
bool readonly; bool readonly;
size_t spaceavail;
size_t _spaceused;
uint64_t spaceavail;
uint64_t _spaceused;
const string *basepath = &basepaths[i]; const string *basepath = &basepaths[i];
if(!fs::info(*basepath,readonly,spaceavail,_spaceused)) if(!fs::info(*basepath,readonly,spaceavail,_spaceused))
@ -88,7 +87,7 @@ namespace mergerfs
Policy::Func::all(const Category::Enum::Type type, Policy::Func::all(const Category::Enum::Type type,
const vector<string> &basepaths, const vector<string> &basepaths,
const char *fusepath, const char *fusepath,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
if(type == Category::Enum::create) if(type == Category::Enum::create)

21
src/policy_eplfs.cpp

@ -26,27 +26,26 @@
using std::string; using std::string;
using std::vector; using std::vector;
using std::size_t;
using mergerfs::Category; using mergerfs::Category;
static static
int int
_eplfs_create(const vector<string> &basepaths, _eplfs_create(const vector<string> &basepaths,
const char *fusepath, const char *fusepath,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
string fullpath; string fullpath;
size_t eplfs;
uint64_t eplfs;
const string *eplfsbasepath; const string *eplfsbasepath;
eplfs = std::numeric_limits<size_t>::max();
eplfs = std::numeric_limits<uint64_t>::max();
eplfsbasepath = NULL; eplfsbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++) for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{ {
bool readonly; bool readonly;
size_t spaceavail;
size_t _spaceused;
uint64_t spaceavail;
uint64_t _spaceused;
const string *basepath = &basepaths[i]; const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath); fs::path::make(basepath,fusepath,fullpath);
@ -81,14 +80,14 @@ _eplfs_other(const vector<string> &basepaths,
vector<const string*> &paths) vector<const string*> &paths)
{ {
string fullpath; string fullpath;
size_t eplfs;
uint64_t eplfs;
const string *eplfsbasepath; const string *eplfsbasepath;
eplfs = std::numeric_limits<size_t>::max();
eplfs = std::numeric_limits<uint64_t>::max();
eplfsbasepath = NULL; eplfsbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++) for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{ {
size_t spaceavail;
uint64_t spaceavail;
const string *basepath = &basepaths[i]; const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath); fs::path::make(basepath,fusepath,fullpath);
@ -117,7 +116,7 @@ int
_eplfs(const Category::Enum::Type type, _eplfs(const Category::Enum::Type type,
const vector<string> &basepaths, const vector<string> &basepaths,
const char *fusepath, const char *fusepath,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
if(type == Category::Enum::create) if(type == Category::Enum::create)
@ -132,7 +131,7 @@ namespace mergerfs
Policy::Func::eplfs(const Category::Enum::Type type, Policy::Func::eplfs(const Category::Enum::Type type,
const vector<string> &basepaths, const vector<string> &basepaths,
const char *fusepath, const char *fusepath,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
int rv; int rv;

21
src/policy_eplus.cpp

@ -26,27 +26,26 @@
using std::string; using std::string;
using std::vector; using std::vector;
using std::size_t;
using mergerfs::Category; using mergerfs::Category;
static static
int int
_eplus_create(const vector<string> &basepaths, _eplus_create(const vector<string> &basepaths,
const char *fusepath, const char *fusepath,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
string fullpath; string fullpath;
size_t eplus;
uint64_t eplus;
const string *eplusbasepath; const string *eplusbasepath;
eplus = std::numeric_limits<size_t>::max();
eplus = std::numeric_limits<uint64_t>::max();
eplusbasepath = NULL; eplusbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++) for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{ {
bool readonly; bool readonly;
size_t spaceavail;
size_t spaceused;
uint64_t spaceavail;
uint64_t spaceused;
const string *basepath = &basepaths[i]; const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath); fs::path::make(basepath,fusepath,fullpath);
@ -81,14 +80,14 @@ _eplus_other(const vector<string> &basepaths,
vector<const string*> &paths) vector<const string*> &paths)
{ {
string fullpath; string fullpath;
size_t eplus;
uint64_t eplus;
const string *eplusbasepath; const string *eplusbasepath;
eplus = 0; eplus = 0;
eplusbasepath = NULL; eplusbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++) for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{ {
size_t spaceused;
uint64_t spaceused;
const string *basepath = &basepaths[i]; const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath); fs::path::make(basepath,fusepath,fullpath);
@ -117,7 +116,7 @@ int
_eplus(const Category::Enum::Type type, _eplus(const Category::Enum::Type type,
const vector<string> &basepaths, const vector<string> &basepaths,
const char *fusepath, const char *fusepath,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
if(type == Category::Enum::create) if(type == Category::Enum::create)
@ -132,8 +131,8 @@ namespace mergerfs
Policy::Func::eplus(const Category::Enum::Type type, Policy::Func::eplus(const Category::Enum::Type type,
const vector<string> &basepaths, const vector<string> &basepaths,
const char *fusepath, const char *fusepath,
const size_t minfreespace,
vector<const string*> &paths)
const uint64_t minfreespace,
vector<const string*> &paths)
{ {
int rv; int rv;

21
src/policy_epmfs.cpp

@ -26,27 +26,26 @@
using std::string; using std::string;
using std::vector; using std::vector;
using std::size_t;
using mergerfs::Category; using mergerfs::Category;
static static
int int
_epmfs_create(const vector<string> &basepaths, _epmfs_create(const vector<string> &basepaths,
const char *fusepath, const char *fusepath,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
string fullpath; string fullpath;
size_t epmfs;
uint64_t epmfs;
const string *epmfsbasepath; const string *epmfsbasepath;
epmfs = std::numeric_limits<size_t>::min();
epmfs = std::numeric_limits<uint64_t>::min();
epmfsbasepath = NULL; epmfsbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++) for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{ {
bool readonly; bool readonly;
size_t spaceavail;
size_t _spaceused;
uint64_t spaceavail;
uint64_t _spaceused;
const string *basepath = &basepaths[i]; const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath); fs::path::make(basepath,fusepath,fullpath);
@ -81,14 +80,14 @@ _epmfs_other(const vector<string> &basepaths,
vector<const string*> &paths) vector<const string*> &paths)
{ {
string fullpath; string fullpath;
size_t epmfs;
uint64_t epmfs;
const string *epmfsbasepath; const string *epmfsbasepath;
epmfs = 0; epmfs = 0;
epmfsbasepath = NULL; epmfsbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++) for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{ {
size_t spaceavail;
uint64_t spaceavail;
const string *basepath = &basepaths[i]; const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath); fs::path::make(basepath,fusepath,fullpath);
@ -117,7 +116,7 @@ int
_epmfs(const Category::Enum::Type type, _epmfs(const Category::Enum::Type type,
const vector<string> &basepaths, const vector<string> &basepaths,
const char *fusepath, const char *fusepath,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
if(type == Category::Enum::create) if(type == Category::Enum::create)
@ -132,8 +131,8 @@ namespace mergerfs
Policy::Func::epmfs(const Category::Enum::Type type, Policy::Func::epmfs(const Category::Enum::Type type,
const vector<string> &basepaths, const vector<string> &basepaths,
const char *fusepath, const char *fusepath,
const size_t minfreespace,
vector<const string*> &paths)
const uint64_t minfreespace,
vector<const string*> &paths)
{ {
int rv; int rv;

2
src/policy_erofs.cpp

@ -30,7 +30,7 @@ namespace mergerfs
Policy::Func::erofs(const Category::Enum::Type type, Policy::Func::erofs(const Category::Enum::Type type,
const vector<string> &basepaths, const vector<string> &basepaths,
const char *fusepath, const char *fusepath,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
return POLICY_FAIL_ERRNO(EROFS); return POLICY_FAIL_ERRNO(EROFS);

9
src/policy_ff.cpp

@ -25,12 +25,11 @@
using std::string; using std::string;
using std::vector; using std::vector;
using std::size_t;
static static
int int
_ff_create(const vector<string> &basepaths, _ff_create(const vector<string> &basepaths,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
const string *fallback; const string *fallback;
@ -39,8 +38,8 @@ _ff_create(const vector<string> &basepaths,
for(size_t i = 0, ei = basepaths.size(); i != ei; i++) for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{ {
bool readonly; bool readonly;
size_t spaceavail;
size_t _spaceused;
uint64_t spaceavail;
uint64_t _spaceused;
const string *basepath = &basepaths[i]; const string *basepath = &basepaths[i];
if(!fs::info(*basepath,readonly,spaceavail,_spaceused)) if(!fs::info(*basepath,readonly,spaceavail,_spaceused))
@ -96,7 +95,7 @@ namespace mergerfs
Policy::Func::ff(const Category::Enum::Type type, Policy::Func::ff(const Category::Enum::Type type,
const vector<string> &basepaths, const vector<string> &basepaths,
const char *fusepath, const char *fusepath,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
if(type == Category::Enum::create) if(type == Category::Enum::create)

3
src/policy_invalid.cpp

@ -23,7 +23,6 @@
using std::string; using std::string;
using std::vector; using std::vector;
using std::size_t;
namespace mergerfs namespace mergerfs
{ {
@ -31,7 +30,7 @@ namespace mergerfs
Policy::Func::invalid(const Category::Enum::Type type, Policy::Func::invalid(const Category::Enum::Type type,
const vector<string> &basepaths, const vector<string> &basepaths,
const char *fusepath, const char *fusepath,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
return POLICY_FAIL_ERRNO(EINVAL); return POLICY_FAIL_ERRNO(EINVAL);

21
src/policy_lfs.cpp

@ -26,26 +26,25 @@
using std::string; using std::string;
using std::vector; using std::vector;
using std::size_t;
using mergerfs::Category; using mergerfs::Category;
static static
int int
_lfs_create(const vector<string> &basepaths, _lfs_create(const vector<string> &basepaths,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
string fullpath; string fullpath;
size_t lfs;
uint64_t lfs;
const string *lfsbasepath; const string *lfsbasepath;
lfs = std::numeric_limits<size_t>::max();
lfs = std::numeric_limits<uint64_t>::max();
lfsbasepath = NULL; lfsbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++) for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{ {
bool readonly; bool readonly;
size_t spaceavail;
size_t _spaceused;
uint64_t spaceavail;
uint64_t _spaceused;
const string *basepath = &basepaths[i]; const string *basepath = &basepaths[i];
if(!fs::info(*basepath,readonly,spaceavail,_spaceused)) if(!fs::info(*basepath,readonly,spaceavail,_spaceused))
@ -76,14 +75,14 @@ _lfs_other(const vector<string> &basepaths,
vector<const string*> &paths) vector<const string*> &paths)
{ {
string fullpath; string fullpath;
size_t lfs;
uint64_t lfs;
const string *lfsbasepath; const string *lfsbasepath;
lfs = std::numeric_limits<size_t>::max();
lfs = std::numeric_limits<uint64_t>::max();
lfsbasepath = NULL; lfsbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++) for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{ {
size_t spaceavail;
uint64_t spaceavail;
const string *basepath = &basepaths[i]; const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath); fs::path::make(basepath,fusepath,fullpath);
@ -112,7 +111,7 @@ int
_lfs(const Category::Enum::Type type, _lfs(const Category::Enum::Type type,
const vector<string> &basepaths, const vector<string> &basepaths,
const char *fusepath, const char *fusepath,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
if(type == Category::Enum::create) if(type == Category::Enum::create)
@ -128,7 +127,7 @@ namespace mergerfs
Policy::Func::lfs(const Category::Enum::Type type, Policy::Func::lfs(const Category::Enum::Type type,
const vector<string> &basepaths, const vector<string> &basepaths,
const char *fusepath, const char *fusepath,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
int rv; int rv;

19
src/policy_lus.cpp

@ -26,26 +26,25 @@
using std::string; using std::string;
using std::vector; using std::vector;
using std::size_t;
using mergerfs::Category; using mergerfs::Category;
static static
int int
_lus_create(const vector<string> &basepaths, _lus_create(const vector<string> &basepaths,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
string fullpath; string fullpath;
size_t lus;
uint64_t lus;
const string *lusbasepath; const string *lusbasepath;
lus = std::numeric_limits<size_t>::max();
lus = std::numeric_limits<uint64_t>::max();
lusbasepath = NULL; lusbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++) for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{ {
bool readonly; bool readonly;
size_t spaceused;
size_t spaceavail;
uint64_t spaceused;
uint64_t spaceavail;
const string *basepath = &basepaths[i]; const string *basepath = &basepaths[i];
if(!fs::info(*basepath,readonly,spaceavail,spaceused)) if(!fs::info(*basepath,readonly,spaceavail,spaceused))
@ -76,14 +75,14 @@ _lus_other(const vector<string> &basepaths,
vector<const string*> &paths) vector<const string*> &paths)
{ {
string fullpath; string fullpath;
size_t lus;
uint64_t lus;
const string *lusbasepath; const string *lusbasepath;
lus = 0; lus = 0;
lusbasepath = NULL; lusbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++) for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{ {
size_t spaceused;
uint64_t spaceused;
const string *basepath = &basepaths[i]; const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath); fs::path::make(basepath,fusepath,fullpath);
@ -112,7 +111,7 @@ int
_lus(const Category::Enum::Type type, _lus(const Category::Enum::Type type,
const vector<string> &basepaths, const vector<string> &basepaths,
const char *fusepath, const char *fusepath,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
if(type == Category::Enum::create) if(type == Category::Enum::create)
@ -127,7 +126,7 @@ namespace mergerfs
Policy::Func::lus(const Category::Enum::Type type, Policy::Func::lus(const Category::Enum::Type type,
const vector<string> &basepaths, const vector<string> &basepaths,
const char *fusepath, const char *fusepath,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
int rv; int rv;

13
src/policy_mfs.cpp

@ -25,7 +25,6 @@
using std::string; using std::string;
using std::vector; using std::vector;
using std::size_t;
using mergerfs::Category; using mergerfs::Category;
static static
@ -34,7 +33,7 @@ _mfs_create(const vector<string> &basepaths,
vector<const string*> &paths) vector<const string*> &paths)
{ {
string fullpath; string fullpath;
size_t mfs;
uint64_t mfs;
const string *mfsbasepath; const string *mfsbasepath;
mfs = 0; mfs = 0;
@ -42,8 +41,8 @@ _mfs_create(const vector<string> &basepaths,
for(size_t i = 0, ei = basepaths.size(); i != ei; i++) for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{ {
bool readonly; bool readonly;
size_t spaceavail;
size_t _spaceused;
uint64_t spaceavail;
uint64_t _spaceused;
const string *basepath = &basepaths[i]; const string *basepath = &basepaths[i];
if(!fs::info(*basepath,readonly,spaceavail,_spaceused)) if(!fs::info(*basepath,readonly,spaceavail,_spaceused))
@ -72,14 +71,14 @@ _mfs_other(const vector<string> &basepaths,
vector<const string*> &paths) vector<const string*> &paths)
{ {
string fullpath; string fullpath;
size_t mfs;
uint64_t mfs;
const string *mfsbasepath; const string *mfsbasepath;
mfs = 0; mfs = 0;
mfsbasepath = NULL; mfsbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++) for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{ {
size_t spaceavail;
uint64_t spaceavail;
const string *basepath = &basepaths[i]; const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath); fs::path::make(basepath,fusepath,fullpath);
@ -122,7 +121,7 @@ namespace mergerfs
Policy::Func::mfs(const Category::Enum::Type type, Policy::Func::mfs(const Category::Enum::Type type,
const vector<string> &basepaths, const vector<string> &basepaths,
const char *fusepath, const char *fusepath,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
int rv; int rv;

3
src/policy_newest.cpp

@ -28,7 +28,6 @@
using std::string; using std::string;
using std::vector; using std::vector;
using std::size_t;
static static
int int
@ -111,7 +110,7 @@ namespace mergerfs
Policy::Func::newest(const Category::Enum::Type type, Policy::Func::newest(const Category::Enum::Type type,
const vector<string> &basepaths, const vector<string> &basepaths,
const char *fusepath, const char *fusepath,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
if(type == Category::Enum::create) if(type == Category::Enum::create)

3
src/policy_rand.cpp

@ -25,7 +25,6 @@
using std::string; using std::string;
using std::vector; using std::vector;
using std::size_t;
namespace mergerfs namespace mergerfs
{ {
@ -33,7 +32,7 @@ namespace mergerfs
Policy::Func::rand(const Category::Enum::Type type, Policy::Func::rand(const Category::Enum::Type type,
const vector<string> &basepaths, const vector<string> &basepaths,
const char *fusepath, const char *fusepath,
const size_t minfreespace,
const uint64_t minfreespace,
vector<const string*> &paths) vector<const string*> &paths)
{ {
int rv; int rv;

2
src/readlink.cpp

@ -56,7 +56,7 @@ static
int int
_readlink(Policy::Func::Search searchFunc, _readlink(Policy::Func::Search searchFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *fusepath, const char *fusepath,
char *buf, char *buf,
const size_t size) const size_t size)

2
src/removexattr.cpp

@ -73,7 +73,7 @@ static
int int
_removexattr(Policy::Func::Action actionFunc, _removexattr(Policy::Func::Action actionFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *fusepath, const char *fusepath,
const char *attrname) const char *attrname)
{ {

10
src/rename.cpp

@ -104,7 +104,7 @@ int
_rename_create_path(Policy::Func::Search searchFunc, _rename_create_path(Policy::Func::Search searchFunc,
Policy::Func::Action actionFunc, Policy::Func::Action actionFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *oldfusepath, const char *oldfusepath,
const char *newfusepath) const char *newfusepath)
{ {
@ -146,7 +146,7 @@ static
int int
_clonepath(Policy::Func::Search searchFunc, _clonepath(Policy::Func::Search searchFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const string &dstbasepath, const string &dstbasepath,
const string &fusedirpath) const string &fusedirpath)
{ {
@ -170,7 +170,7 @@ int
_clonepath_if_would_create(Policy::Func::Search searchFunc, _clonepath_if_would_create(Policy::Func::Search searchFunc,
Policy::Func::Create createFunc, Policy::Func::Create createFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const string &oldbasepath, const string &oldbasepath,
const char *oldfusepath, const char *oldfusepath,
const char *newfusepath) const char *newfusepath)
@ -196,7 +196,7 @@ void
_rename_preserve_path_core(Policy::Func::Search searchFunc, _rename_preserve_path_core(Policy::Func::Search searchFunc,
Policy::Func::Create createFunc, Policy::Func::Create createFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const vector<const string*> &oldbasepaths, const vector<const string*> &oldbasepaths,
const string &oldbasepath, const string &oldbasepath,
const char *oldfusepath, const char *oldfusepath,
@ -243,7 +243,7 @@ _rename_preserve_path(Policy::Func::Search searchFunc,
Policy::Func::Action actionFunc, Policy::Func::Action actionFunc,
Policy::Func::Create createFunc, Policy::Func::Create createFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *oldfusepath, const char *oldfusepath,
const char *newfusepath) const char *newfusepath)
{ {

2
src/rmdir.cpp

@ -68,7 +68,7 @@ static
int int
_rmdir(Policy::Func::Action actionFunc, _rmdir(Policy::Func::Action actionFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *fusepath) const char *fusepath)
{ {
int rv; int rv;

4
src/setxattr.cpp

@ -172,7 +172,7 @@ _setxattr_minfreespace(Config &config,
if((flags & XATTR_CREATE) == XATTR_CREATE) if((flags & XATTR_CREATE) == XATTR_CREATE)
return -EEXIST; return -EEXIST;
rv = num::to_size_t(attrval,config.minfreespace);
rv = num::to_uint64_t(attrval,config.minfreespace);
if(rv == -1) if(rv == -1)
return -EINVAL; return -EINVAL;
@ -335,7 +335,7 @@ static
int int
_setxattr(Policy::Func::Action actionFunc, _setxattr(Policy::Func::Action actionFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *fusepath, const char *fusepath,
const char *attrname, const char *attrname,
const char *attrval, const char *attrval,

4
src/statvfs_util.hpp

@ -47,7 +47,7 @@ namespace StatVFS
static static
inline inline
fsblkcnt_t
uint64_t
spaceavail(const struct statvfs &st) spaceavail(const struct statvfs &st)
{ {
return (st.f_frsize * st.f_bavail); return (st.f_frsize * st.f_bavail);
@ -55,7 +55,7 @@ namespace StatVFS
static static
inline inline
fsblkcnt_t
uint64_t
spaceused(const struct statvfs &st) spaceused(const struct statvfs &st)
{ {
return (st.f_frsize * (st.f_blocks - st.f_bavail)); return (st.f_frsize * (st.f_blocks - st.f_bavail));

2
src/symlink.cpp

@ -84,7 +84,7 @@ int
_symlink(Policy::Func::Search searchFunc, _symlink(Policy::Func::Search searchFunc,
Policy::Func::Create createFunc, Policy::Func::Create createFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *oldpath, const char *oldpath,
const char *newpath) const char *newpath)
{ {

2
src/truncate.cpp

@ -71,7 +71,7 @@ static
int int
_truncate(Policy::Func::Action actionFunc, _truncate(Policy::Func::Action actionFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *fusepath, const char *fusepath,
const off_t size) const off_t size)
{ {

2
src/unlink.cpp

@ -68,7 +68,7 @@ static
int int
_unlink(Policy::Func::Action actionFunc, _unlink(Policy::Func::Action actionFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *fusepath) const char *fusepath)
{ {
int rv; int rv;

2
src/utimens.cpp

@ -71,7 +71,7 @@ static
int int
_utimens(Policy::Func::Action actionFunc, _utimens(Policy::Func::Action actionFunc,
const vector<string> &srcmounts, const vector<string> &srcmounts,
const size_t minfreespace,
const uint64_t minfreespace,
const char *fusepath, const char *fusepath,
const timespec ts[2]) const timespec ts[2])
{ {

2
src/write_buf.cpp

@ -42,7 +42,7 @@ _write_buf(const int fd,
fuse_bufvec &src, fuse_bufvec &src,
const off_t offset) const off_t offset)
{ {
size_t size = fuse_buf_size(&src);
size_t size = fuse_buf_size(&src);
fuse_bufvec dst = FUSE_BUFVEC_INIT(size); fuse_bufvec dst = FUSE_BUFVEC_INIT(size);
const fuse_buf_copy_flags cpflags = const fuse_buf_copy_flags cpflags =
(fuse_buf_copy_flags)(FUSE_BUF_SPLICE_MOVE|FUSE_BUF_SPLICE_NONBLOCK); (fuse_buf_copy_flags)(FUSE_BUF_SPLICE_MOVE|FUSE_BUF_SPLICE_NONBLOCK);

Loading…
Cancel
Save