mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-02-21 15:20:27 +08:00
move size calculations to use uint64_t. fixes #287
This commit is contained in:
parent
30cdfa64b8
commit
43cbd9c670
@ -34,7 +34,7 @@ static
|
||||
int
|
||||
_access(Policy::Func::Search searchFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *fusepath,
|
||||
const int mask)
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ static
|
||||
int
|
||||
_chmod(Policy::Func::Action actionFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *fusepath,
|
||||
const mode_t mode)
|
||||
{
|
||||
|
@ -72,7 +72,7 @@ static
|
||||
int
|
||||
_chown(Policy::Func::Action actionFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *fusepath,
|
||||
const uid_t uid,
|
||||
const gid_t gid)
|
||||
|
@ -45,7 +45,7 @@ namespace mergerfs
|
||||
std::string destmount;
|
||||
std::vector<std::string> srcmounts;
|
||||
mutable pthread_rwlock_t srcmountslock;
|
||||
size_t minfreespace;
|
||||
uint64_t minfreespace;
|
||||
bool moveonenospc;
|
||||
|
||||
public:
|
||||
|
@ -71,7 +71,7 @@ int
|
||||
_create(Policy::Func::Search searchFunc,
|
||||
Policy::Func::Create createFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *fusepath,
|
||||
const mode_t mode,
|
||||
const int flags,
|
||||
|
13
src/fs.cpp
13
src/fs.cpp
@ -22,6 +22,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <glob.h>
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/statvfs.h>
|
||||
@ -73,8 +74,8 @@ namespace fs
|
||||
bool
|
||||
info(const string &path,
|
||||
bool &readonly,
|
||||
size_t &spaceavail,
|
||||
size_t &spaceused)
|
||||
uint64_t &spaceavail,
|
||||
uint64_t &spaceused)
|
||||
{
|
||||
bool rv;
|
||||
struct statvfs st;
|
||||
@ -103,7 +104,7 @@ namespace fs
|
||||
|
||||
bool
|
||||
spaceavail(const string &path,
|
||||
size_t &spaceavail)
|
||||
uint64_t &spaceavail)
|
||||
{
|
||||
bool rv;
|
||||
struct statvfs st;
|
||||
@ -117,7 +118,7 @@ namespace fs
|
||||
|
||||
bool
|
||||
spaceused(const string &path,
|
||||
size_t &spaceused)
|
||||
uint64_t &spaceused)
|
||||
{
|
||||
bool rv;
|
||||
struct statvfs st;
|
||||
@ -231,7 +232,7 @@ namespace fs
|
||||
|
||||
int
|
||||
mfs(const vector<string> &basepaths,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
string &path)
|
||||
{
|
||||
fsblkcnt_t mfs;
|
||||
@ -241,7 +242,7 @@ namespace fs
|
||||
mfsbasepath = NULL;
|
||||
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
|
||||
{
|
||||
size_t spaceavail;
|
||||
uint64_t spaceavail;
|
||||
const string &basepath = basepaths[i];
|
||||
|
||||
if(!fs::spaceavail(basepath,spaceavail))
|
||||
|
13
src/fs.hpp
13
src/fs.hpp
@ -17,12 +17,13 @@
|
||||
#ifndef __FS_HPP__
|
||||
#define __FS_HPP__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace fs
|
||||
{
|
||||
using std::size_t;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
@ -35,16 +36,16 @@ namespace fs
|
||||
|
||||
bool info(const string &path,
|
||||
bool &readonly,
|
||||
size_t &spaceavail,
|
||||
size_t &spaceused);
|
||||
uint64_t &spaceavail,
|
||||
uint64_t &spaceused);
|
||||
|
||||
bool readonly(const string &path);
|
||||
|
||||
bool spaceavail(const string &path,
|
||||
size_t &spaceavail);
|
||||
uint64_t &spaceavail);
|
||||
|
||||
bool spaceused(const string &path,
|
||||
size_t &spaceavail);
|
||||
uint64_t &spaceavail);
|
||||
|
||||
void findallfiles(const vector<string> &srcmounts,
|
||||
const char *fusepath,
|
||||
@ -63,7 +64,7 @@ namespace fs
|
||||
int getfl(const int fd);
|
||||
|
||||
int mfs(const vector<string> &srcs,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
string &path);
|
||||
};
|
||||
|
||||
|
@ -25,7 +25,6 @@ namespace fs
|
||||
{
|
||||
namespace xattr
|
||||
{
|
||||
using std::size_t;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::map;
|
||||
|
@ -62,7 +62,7 @@ static
|
||||
int
|
||||
_getattr(Policy::Func::Search searchFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *fusepath,
|
||||
struct stat &buf)
|
||||
{
|
||||
|
@ -58,7 +58,7 @@ static
|
||||
int
|
||||
_ioctl_dir_base(Policy::Func::Search searchFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *fusepath,
|
||||
const int cmd,
|
||||
void *data)
|
||||
|
14
src/link.cpp
14
src/link.cpp
@ -88,7 +88,7 @@ int
|
||||
_link_create_path(Policy::Func::Search searchFunc,
|
||||
Policy::Func::Action actionFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *oldfusepath,
|
||||
const char *newfusepath)
|
||||
{
|
||||
@ -117,7 +117,7 @@ int
|
||||
_clonepath_if_would_create(Policy::Func::Search searchFunc,
|
||||
Policy::Func::Create createFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const string &oldbasepath,
|
||||
const char *oldfusepath,
|
||||
const char *newfusepath)
|
||||
@ -158,7 +158,7 @@ int
|
||||
_link_preserve_path_core(Policy::Func::Search searchFunc,
|
||||
Policy::Func::Create createFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const string &oldbasepath,
|
||||
const char *oldfusepath,
|
||||
const char *newfusepath,
|
||||
@ -190,7 +190,7 @@ int
|
||||
_link_preserve_path_loop(Policy::Func::Search searchFunc,
|
||||
Policy::Func::Create createFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *oldfusepath,
|
||||
const char *newfusepath,
|
||||
const vector<const string*> &oldbasepaths)
|
||||
@ -216,9 +216,9 @@ _link_preserve_path(Policy::Func::Search searchFunc,
|
||||
Policy::Func::Action actionFunc,
|
||||
Policy::Func::Create createFunc,
|
||||
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;
|
||||
vector<const string*> oldbasepaths;
|
||||
|
@ -74,7 +74,7 @@ static
|
||||
int
|
||||
_listxattr(Policy::Func::Search searchFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *fusepath,
|
||||
char *list,
|
||||
const size_t size)
|
||||
|
@ -85,7 +85,7 @@ int
|
||||
_mkdir(Policy::Func::Search searchFunc,
|
||||
Policy::Func::Create createFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *fusepath,
|
||||
const mode_t mode)
|
||||
{
|
||||
|
@ -89,7 +89,7 @@ int
|
||||
_mknod(Policy::Func::Search searchFunc,
|
||||
Policy::Func::Create createFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *fusepath,
|
||||
const mode_t mode,
|
||||
const dev_t dev)
|
||||
|
@ -14,6 +14,7 @@
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <string>
|
||||
@ -21,11 +22,11 @@
|
||||
namespace num
|
||||
{
|
||||
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);
|
||||
switch(*endptr)
|
||||
|
@ -14,9 +14,11 @@
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace num
|
||||
{
|
||||
int to_size_t(const std::string &str, size_t &value);
|
||||
int to_uint64_t(const std::string &str, uint64_t &value);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ static
|
||||
int
|
||||
_open(Policy::Func::Search searchFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *fusepath,
|
||||
const int flags,
|
||||
uint64_t &fh)
|
||||
|
@ -107,11 +107,11 @@ set_default_options(fuse_args &args)
|
||||
static
|
||||
int
|
||||
parse_and_process_minfreespace(const std::string &value,
|
||||
size_t &minfreespace)
|
||||
uint64_t &minfreespace)
|
||||
{
|
||||
int rv;
|
||||
|
||||
rv = num::to_size_t(value,minfreespace);
|
||||
rv = num::to_uint64_t(value,minfreespace);
|
||||
if(rv == -1)
|
||||
return 1;
|
||||
|
||||
|
@ -63,15 +63,14 @@ namespace mergerfs
|
||||
struct Func
|
||||
{
|
||||
typedef std::string string;
|
||||
typedef std::size_t size_t;
|
||||
typedef std::vector<string> strvec;
|
||||
typedef std::vector<const string*> cstrptrvec;
|
||||
typedef const string cstring;
|
||||
typedef const size_t csize_t;
|
||||
typedef const uint64_t cuint64_t;
|
||||
typedef const strvec cstrvec;
|
||||
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>
|
||||
class Base
|
||||
@ -82,7 +81,7 @@ namespace mergerfs
|
||||
{}
|
||||
|
||||
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);
|
||||
}
|
||||
@ -95,18 +94,18 @@ namespace mergerfs
|
||||
typedef Base<Category::Enum::create> Create;
|
||||
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:
|
||||
@ -165,8 +164,8 @@ namespace mergerfs
|
||||
static const Policy &find(const Enum::Type);
|
||||
|
||||
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 &all;
|
||||
|
@ -25,19 +25,18 @@
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::size_t;
|
||||
|
||||
static
|
||||
int
|
||||
_all_create(const vector<string> &basepaths,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
|
||||
{
|
||||
bool readonly;
|
||||
size_t spaceavail;
|
||||
size_t _spaceused;
|
||||
uint64_t spaceavail;
|
||||
uint64_t _spaceused;
|
||||
const string *basepath = &basepaths[i];
|
||||
|
||||
if(!fs::info(*basepath,readonly,spaceavail,_spaceused))
|
||||
@ -88,7 +87,7 @@ namespace mergerfs
|
||||
Policy::Func::all(const Category::Enum::Type type,
|
||||
const vector<string> &basepaths,
|
||||
const char *fusepath,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
if(type == Category::Enum::create)
|
||||
|
@ -26,27 +26,26 @@
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::size_t;
|
||||
using mergerfs::Category;
|
||||
|
||||
static
|
||||
int
|
||||
_eplfs_create(const vector<string> &basepaths,
|
||||
const char *fusepath,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
string fullpath;
|
||||
size_t eplfs;
|
||||
uint64_t eplfs;
|
||||
const string *eplfsbasepath;
|
||||
|
||||
eplfs = std::numeric_limits<size_t>::max();
|
||||
eplfs = std::numeric_limits<uint64_t>::max();
|
||||
eplfsbasepath = NULL;
|
||||
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
|
||||
{
|
||||
bool readonly;
|
||||
size_t spaceavail;
|
||||
size_t _spaceused;
|
||||
uint64_t spaceavail;
|
||||
uint64_t _spaceused;
|
||||
const string *basepath = &basepaths[i];
|
||||
|
||||
fs::path::make(basepath,fusepath,fullpath);
|
||||
@ -81,14 +80,14 @@ _eplfs_other(const vector<string> &basepaths,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
string fullpath;
|
||||
size_t eplfs;
|
||||
uint64_t eplfs;
|
||||
const string *eplfsbasepath;
|
||||
|
||||
eplfs = std::numeric_limits<size_t>::max();
|
||||
eplfs = std::numeric_limits<uint64_t>::max();
|
||||
eplfsbasepath = NULL;
|
||||
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
|
||||
{
|
||||
size_t spaceavail;
|
||||
uint64_t spaceavail;
|
||||
const string *basepath = &basepaths[i];
|
||||
|
||||
fs::path::make(basepath,fusepath,fullpath);
|
||||
@ -117,7 +116,7 @@ int
|
||||
_eplfs(const Category::Enum::Type type,
|
||||
const vector<string> &basepaths,
|
||||
const char *fusepath,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
if(type == Category::Enum::create)
|
||||
@ -132,7 +131,7 @@ namespace mergerfs
|
||||
Policy::Func::eplfs(const Category::Enum::Type type,
|
||||
const vector<string> &basepaths,
|
||||
const char *fusepath,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
int rv;
|
||||
|
@ -26,27 +26,26 @@
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::size_t;
|
||||
using mergerfs::Category;
|
||||
|
||||
static
|
||||
int
|
||||
_eplus_create(const vector<string> &basepaths,
|
||||
const char *fusepath,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
string fullpath;
|
||||
size_t eplus;
|
||||
uint64_t eplus;
|
||||
const string *eplusbasepath;
|
||||
|
||||
eplus = std::numeric_limits<size_t>::max();
|
||||
eplus = std::numeric_limits<uint64_t>::max();
|
||||
eplusbasepath = NULL;
|
||||
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
|
||||
{
|
||||
bool readonly;
|
||||
size_t spaceavail;
|
||||
size_t spaceused;
|
||||
uint64_t spaceavail;
|
||||
uint64_t spaceused;
|
||||
const string *basepath = &basepaths[i];
|
||||
|
||||
fs::path::make(basepath,fusepath,fullpath);
|
||||
@ -81,14 +80,14 @@ _eplus_other(const vector<string> &basepaths,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
string fullpath;
|
||||
size_t eplus;
|
||||
uint64_t eplus;
|
||||
const string *eplusbasepath;
|
||||
|
||||
eplus = 0;
|
||||
eplusbasepath = NULL;
|
||||
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
|
||||
{
|
||||
size_t spaceused;
|
||||
uint64_t spaceused;
|
||||
const string *basepath = &basepaths[i];
|
||||
|
||||
fs::path::make(basepath,fusepath,fullpath);
|
||||
@ -117,7 +116,7 @@ int
|
||||
_eplus(const Category::Enum::Type type,
|
||||
const vector<string> &basepaths,
|
||||
const char *fusepath,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
if(type == Category::Enum::create)
|
||||
@ -132,8 +131,8 @@ namespace mergerfs
|
||||
Policy::Func::eplus(const Category::Enum::Type type,
|
||||
const vector<string> &basepaths,
|
||||
const char *fusepath,
|
||||
const size_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
int rv;
|
||||
|
||||
|
@ -26,27 +26,26 @@
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::size_t;
|
||||
using mergerfs::Category;
|
||||
|
||||
static
|
||||
int
|
||||
_epmfs_create(const vector<string> &basepaths,
|
||||
const char *fusepath,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
string fullpath;
|
||||
size_t epmfs;
|
||||
uint64_t epmfs;
|
||||
const string *epmfsbasepath;
|
||||
|
||||
epmfs = std::numeric_limits<size_t>::min();
|
||||
epmfs = std::numeric_limits<uint64_t>::min();
|
||||
epmfsbasepath = NULL;
|
||||
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
|
||||
{
|
||||
bool readonly;
|
||||
size_t spaceavail;
|
||||
size_t _spaceused;
|
||||
uint64_t spaceavail;
|
||||
uint64_t _spaceused;
|
||||
const string *basepath = &basepaths[i];
|
||||
|
||||
fs::path::make(basepath,fusepath,fullpath);
|
||||
@ -81,14 +80,14 @@ _epmfs_other(const vector<string> &basepaths,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
string fullpath;
|
||||
size_t epmfs;
|
||||
uint64_t epmfs;
|
||||
const string *epmfsbasepath;
|
||||
|
||||
epmfs = 0;
|
||||
epmfsbasepath = NULL;
|
||||
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
|
||||
{
|
||||
size_t spaceavail;
|
||||
uint64_t spaceavail;
|
||||
const string *basepath = &basepaths[i];
|
||||
|
||||
fs::path::make(basepath,fusepath,fullpath);
|
||||
@ -117,7 +116,7 @@ int
|
||||
_epmfs(const Category::Enum::Type type,
|
||||
const vector<string> &basepaths,
|
||||
const char *fusepath,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
if(type == Category::Enum::create)
|
||||
@ -132,8 +131,8 @@ namespace mergerfs
|
||||
Policy::Func::epmfs(const Category::Enum::Type type,
|
||||
const vector<string> &basepaths,
|
||||
const char *fusepath,
|
||||
const size_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
int rv;
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace mergerfs
|
||||
Policy::Func::erofs(const Category::Enum::Type type,
|
||||
const vector<string> &basepaths,
|
||||
const char *fusepath,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
return POLICY_FAIL_ERRNO(EROFS);
|
||||
|
@ -25,12 +25,11 @@
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::size_t;
|
||||
|
||||
static
|
||||
int
|
||||
_ff_create(const vector<string> &basepaths,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
const string *fallback;
|
||||
@ -39,8 +38,8 @@ _ff_create(const vector<string> &basepaths,
|
||||
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
|
||||
{
|
||||
bool readonly;
|
||||
size_t spaceavail;
|
||||
size_t _spaceused;
|
||||
uint64_t spaceavail;
|
||||
uint64_t _spaceused;
|
||||
const string *basepath = &basepaths[i];
|
||||
|
||||
if(!fs::info(*basepath,readonly,spaceavail,_spaceused))
|
||||
@ -96,7 +95,7 @@ namespace mergerfs
|
||||
Policy::Func::ff(const Category::Enum::Type type,
|
||||
const vector<string> &basepaths,
|
||||
const char *fusepath,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
if(type == Category::Enum::create)
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::size_t;
|
||||
|
||||
namespace mergerfs
|
||||
{
|
||||
@ -31,7 +30,7 @@ namespace mergerfs
|
||||
Policy::Func::invalid(const Category::Enum::Type type,
|
||||
const vector<string> &basepaths,
|
||||
const char *fusepath,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
return POLICY_FAIL_ERRNO(EINVAL);
|
||||
|
@ -26,26 +26,25 @@
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::size_t;
|
||||
using mergerfs::Category;
|
||||
|
||||
static
|
||||
int
|
||||
_lfs_create(const vector<string> &basepaths,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
string fullpath;
|
||||
size_t lfs;
|
||||
uint64_t lfs;
|
||||
const string *lfsbasepath;
|
||||
|
||||
lfs = std::numeric_limits<size_t>::max();
|
||||
lfs = std::numeric_limits<uint64_t>::max();
|
||||
lfsbasepath = NULL;
|
||||
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
|
||||
{
|
||||
bool readonly;
|
||||
size_t spaceavail;
|
||||
size_t _spaceused;
|
||||
uint64_t spaceavail;
|
||||
uint64_t _spaceused;
|
||||
const string *basepath = &basepaths[i];
|
||||
|
||||
if(!fs::info(*basepath,readonly,spaceavail,_spaceused))
|
||||
@ -76,14 +75,14 @@ _lfs_other(const vector<string> &basepaths,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
string fullpath;
|
||||
size_t lfs;
|
||||
uint64_t lfs;
|
||||
const string *lfsbasepath;
|
||||
|
||||
lfs = std::numeric_limits<size_t>::max();
|
||||
lfs = std::numeric_limits<uint64_t>::max();
|
||||
lfsbasepath = NULL;
|
||||
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
|
||||
{
|
||||
size_t spaceavail;
|
||||
uint64_t spaceavail;
|
||||
const string *basepath = &basepaths[i];
|
||||
|
||||
fs::path::make(basepath,fusepath,fullpath);
|
||||
@ -112,7 +111,7 @@ int
|
||||
_lfs(const Category::Enum::Type type,
|
||||
const vector<string> &basepaths,
|
||||
const char *fusepath,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
if(type == Category::Enum::create)
|
||||
@ -128,7 +127,7 @@ namespace mergerfs
|
||||
Policy::Func::lfs(const Category::Enum::Type type,
|
||||
const vector<string> &basepaths,
|
||||
const char *fusepath,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
int rv;
|
||||
|
@ -26,26 +26,25 @@
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::size_t;
|
||||
using mergerfs::Category;
|
||||
|
||||
static
|
||||
int
|
||||
_lus_create(const vector<string> &basepaths,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
string fullpath;
|
||||
size_t lus;
|
||||
uint64_t lus;
|
||||
const string *lusbasepath;
|
||||
|
||||
lus = std::numeric_limits<size_t>::max();
|
||||
lus = std::numeric_limits<uint64_t>::max();
|
||||
lusbasepath = NULL;
|
||||
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
|
||||
{
|
||||
bool readonly;
|
||||
size_t spaceused;
|
||||
size_t spaceavail;
|
||||
uint64_t spaceused;
|
||||
uint64_t spaceavail;
|
||||
const string *basepath = &basepaths[i];
|
||||
|
||||
if(!fs::info(*basepath,readonly,spaceavail,spaceused))
|
||||
@ -76,14 +75,14 @@ _lus_other(const vector<string> &basepaths,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
string fullpath;
|
||||
size_t lus;
|
||||
uint64_t lus;
|
||||
const string *lusbasepath;
|
||||
|
||||
lus = 0;
|
||||
lusbasepath = NULL;
|
||||
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
|
||||
{
|
||||
size_t spaceused;
|
||||
uint64_t spaceused;
|
||||
const string *basepath = &basepaths[i];
|
||||
|
||||
fs::path::make(basepath,fusepath,fullpath);
|
||||
@ -112,7 +111,7 @@ int
|
||||
_lus(const Category::Enum::Type type,
|
||||
const vector<string> &basepaths,
|
||||
const char *fusepath,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
if(type == Category::Enum::create)
|
||||
@ -127,7 +126,7 @@ namespace mergerfs
|
||||
Policy::Func::lus(const Category::Enum::Type type,
|
||||
const vector<string> &basepaths,
|
||||
const char *fusepath,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
int rv;
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::size_t;
|
||||
using mergerfs::Category;
|
||||
|
||||
static
|
||||
@ -34,7 +33,7 @@ _mfs_create(const vector<string> &basepaths,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
string fullpath;
|
||||
size_t mfs;
|
||||
uint64_t mfs;
|
||||
const string *mfsbasepath;
|
||||
|
||||
mfs = 0;
|
||||
@ -42,8 +41,8 @@ _mfs_create(const vector<string> &basepaths,
|
||||
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
|
||||
{
|
||||
bool readonly;
|
||||
size_t spaceavail;
|
||||
size_t _spaceused;
|
||||
uint64_t spaceavail;
|
||||
uint64_t _spaceused;
|
||||
const string *basepath = &basepaths[i];
|
||||
|
||||
if(!fs::info(*basepath,readonly,spaceavail,_spaceused))
|
||||
@ -72,14 +71,14 @@ _mfs_other(const vector<string> &basepaths,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
string fullpath;
|
||||
size_t mfs;
|
||||
uint64_t mfs;
|
||||
const string *mfsbasepath;
|
||||
|
||||
mfs = 0;
|
||||
mfsbasepath = NULL;
|
||||
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
|
||||
{
|
||||
size_t spaceavail;
|
||||
uint64_t spaceavail;
|
||||
const string *basepath = &basepaths[i];
|
||||
|
||||
fs::path::make(basepath,fusepath,fullpath);
|
||||
@ -122,7 +121,7 @@ namespace mergerfs
|
||||
Policy::Func::mfs(const Category::Enum::Type type,
|
||||
const vector<string> &basepaths,
|
||||
const char *fusepath,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
int rv;
|
||||
|
@ -28,7 +28,6 @@
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::size_t;
|
||||
|
||||
static
|
||||
int
|
||||
@ -111,7 +110,7 @@ namespace mergerfs
|
||||
Policy::Func::newest(const Category::Enum::Type type,
|
||||
const vector<string> &basepaths,
|
||||
const char *fusepath,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
if(type == Category::Enum::create)
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::size_t;
|
||||
|
||||
namespace mergerfs
|
||||
{
|
||||
@ -33,7 +32,7 @@ namespace mergerfs
|
||||
Policy::Func::rand(const Category::Enum::Type type,
|
||||
const vector<string> &basepaths,
|
||||
const char *fusepath,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
{
|
||||
int rv;
|
||||
|
@ -56,7 +56,7 @@ static
|
||||
int
|
||||
_readlink(Policy::Func::Search searchFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *fusepath,
|
||||
char *buf,
|
||||
const size_t size)
|
||||
|
@ -73,7 +73,7 @@ static
|
||||
int
|
||||
_removexattr(Policy::Func::Action actionFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *fusepath,
|
||||
const char *attrname)
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ int
|
||||
_rename_create_path(Policy::Func::Search searchFunc,
|
||||
Policy::Func::Action actionFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *oldfusepath,
|
||||
const char *newfusepath)
|
||||
{
|
||||
@ -146,7 +146,7 @@ static
|
||||
int
|
||||
_clonepath(Policy::Func::Search searchFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const string &dstbasepath,
|
||||
const string &fusedirpath)
|
||||
{
|
||||
@ -170,7 +170,7 @@ int
|
||||
_clonepath_if_would_create(Policy::Func::Search searchFunc,
|
||||
Policy::Func::Create createFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const string &oldbasepath,
|
||||
const char *oldfusepath,
|
||||
const char *newfusepath)
|
||||
@ -196,7 +196,7 @@ void
|
||||
_rename_preserve_path_core(Policy::Func::Search searchFunc,
|
||||
Policy::Func::Create createFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const vector<const string*> &oldbasepaths,
|
||||
const string &oldbasepath,
|
||||
const char *oldfusepath,
|
||||
@ -243,7 +243,7 @@ _rename_preserve_path(Policy::Func::Search searchFunc,
|
||||
Policy::Func::Action actionFunc,
|
||||
Policy::Func::Create createFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *oldfusepath,
|
||||
const char *newfusepath)
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ static
|
||||
int
|
||||
_rmdir(Policy::Func::Action actionFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *fusepath)
|
||||
{
|
||||
int rv;
|
||||
|
@ -172,7 +172,7 @@ _setxattr_minfreespace(Config &config,
|
||||
if((flags & XATTR_CREATE) == XATTR_CREATE)
|
||||
return -EEXIST;
|
||||
|
||||
rv = num::to_size_t(attrval,config.minfreespace);
|
||||
rv = num::to_uint64_t(attrval,config.minfreespace);
|
||||
if(rv == -1)
|
||||
return -EINVAL;
|
||||
|
||||
@ -335,7 +335,7 @@ static
|
||||
int
|
||||
_setxattr(Policy::Func::Action actionFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *fusepath,
|
||||
const char *attrname,
|
||||
const char *attrval,
|
||||
|
@ -47,7 +47,7 @@ namespace StatVFS
|
||||
|
||||
static
|
||||
inline
|
||||
fsblkcnt_t
|
||||
uint64_t
|
||||
spaceavail(const struct statvfs &st)
|
||||
{
|
||||
return (st.f_frsize * st.f_bavail);
|
||||
@ -55,7 +55,7 @@ namespace StatVFS
|
||||
|
||||
static
|
||||
inline
|
||||
fsblkcnt_t
|
||||
uint64_t
|
||||
spaceused(const struct statvfs &st)
|
||||
{
|
||||
return (st.f_frsize * (st.f_blocks - st.f_bavail));
|
||||
|
@ -84,7 +84,7 @@ int
|
||||
_symlink(Policy::Func::Search searchFunc,
|
||||
Policy::Func::Create createFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *oldpath,
|
||||
const char *newpath)
|
||||
{
|
||||
|
@ -71,7 +71,7 @@ static
|
||||
int
|
||||
_truncate(Policy::Func::Action actionFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *fusepath,
|
||||
const off_t size)
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ static
|
||||
int
|
||||
_unlink(Policy::Func::Action actionFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *fusepath)
|
||||
{
|
||||
int rv;
|
||||
|
@ -71,7 +71,7 @@ static
|
||||
int
|
||||
_utimens(Policy::Func::Action actionFunc,
|
||||
const vector<string> &srcmounts,
|
||||
const size_t minfreespace,
|
||||
const uint64_t minfreespace,
|
||||
const char *fusepath,
|
||||
const timespec ts[2])
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ _write_buf(const int fd,
|
||||
fuse_bufvec &src,
|
||||
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);
|
||||
const fuse_buf_copy_flags cpflags =
|
||||
(fuse_buf_copy_flags)(FUSE_BUF_SPLICE_MOVE|FUSE_BUF_SPLICE_NONBLOCK);
|
||||
|
Loading…
x
Reference in New Issue
Block a user