mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-01-28 11:16:31 +08:00
remove unnecessary policies
This commit is contained in:
parent
1bbe3a8879
commit
d4ec341c4f
|
@ -30,15 +30,10 @@ namespace mergerfs
|
||||||
buildvector<Policy,true>
|
buildvector<Policy,true>
|
||||||
(POLICY(invalid,DOESNT_PRESERVE_PATH))
|
(POLICY(invalid,DOESNT_PRESERVE_PATH))
|
||||||
(POLICY(all,DOESNT_PRESERVE_PATH))
|
(POLICY(all,DOESNT_PRESERVE_PATH))
|
||||||
(POLICY(einval,DOESNT_PRESERVE_PATH))
|
|
||||||
(POLICY(enosys,DOESNT_PRESERVE_PATH))
|
|
||||||
(POLICY(enotsup,DOESNT_PRESERVE_PATH))
|
|
||||||
(POLICY(eplfs,PRESERVES_PATH))
|
(POLICY(eplfs,PRESERVES_PATH))
|
||||||
(POLICY(epmfs,PRESERVES_PATH))
|
(POLICY(epmfs,PRESERVES_PATH))
|
||||||
(POLICY(erofs,DOESNT_PRESERVE_PATH))
|
(POLICY(erofs,DOESNT_PRESERVE_PATH))
|
||||||
(POLICY(exdev,DOESNT_PRESERVE_PATH))
|
|
||||||
(POLICY(ff,DOESNT_PRESERVE_PATH))
|
(POLICY(ff,DOESNT_PRESERVE_PATH))
|
||||||
(POLICY(ffwp,DOESNT_PRESERVE_PATH))
|
|
||||||
(POLICY(fwfs,DOESNT_PRESERVE_PATH))
|
(POLICY(fwfs,DOESNT_PRESERVE_PATH))
|
||||||
(POLICY(lfs,DOESNT_PRESERVE_PATH))
|
(POLICY(lfs,DOESNT_PRESERVE_PATH))
|
||||||
(POLICY(mfs,DOESNT_PRESERVE_PATH))
|
(POLICY(mfs,DOESNT_PRESERVE_PATH))
|
||||||
|
@ -51,15 +46,10 @@ namespace mergerfs
|
||||||
|
|
||||||
CONST_POLICY(invalid);
|
CONST_POLICY(invalid);
|
||||||
CONST_POLICY(all);
|
CONST_POLICY(all);
|
||||||
CONST_POLICY(einval);
|
|
||||||
CONST_POLICY(enosys);
|
|
||||||
CONST_POLICY(enotsup);
|
|
||||||
CONST_POLICY(eplfs);
|
CONST_POLICY(eplfs);
|
||||||
CONST_POLICY(epmfs);
|
CONST_POLICY(epmfs);
|
||||||
CONST_POLICY(erofs);
|
CONST_POLICY(erofs);
|
||||||
CONST_POLICY(exdev);
|
|
||||||
CONST_POLICY(ff);
|
CONST_POLICY(ff);
|
||||||
CONST_POLICY(ffwp);
|
|
||||||
CONST_POLICY(fwfs);
|
CONST_POLICY(fwfs);
|
||||||
CONST_POLICY(lfs);
|
CONST_POLICY(lfs);
|
||||||
CONST_POLICY(mfs);
|
CONST_POLICY(mfs);
|
||||||
|
|
|
@ -41,15 +41,10 @@ namespace mergerfs
|
||||||
invalid = -1,
|
invalid = -1,
|
||||||
BEGIN = 0,
|
BEGIN = 0,
|
||||||
all = BEGIN,
|
all = BEGIN,
|
||||||
einval,
|
|
||||||
enosys,
|
|
||||||
enotsup,
|
|
||||||
eplfs,
|
eplfs,
|
||||||
epmfs,
|
epmfs,
|
||||||
erofs,
|
erofs,
|
||||||
exdev,
|
|
||||||
ff,
|
ff,
|
||||||
ffwp,
|
|
||||||
fwfs,
|
fwfs,
|
||||||
lfs,
|
lfs,
|
||||||
mfs,
|
mfs,
|
||||||
|
@ -97,18 +92,13 @@ 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 all(CType,cstrvec&,const char*,csize_t,cstrptrvec&);
|
||||||
static int einval(CType,cstrvec&,const char*,csize_t,cstrptrvec&);
|
|
||||||
static int enosys(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
|
|
||||||
static int enotsup(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
|
|
||||||
static int eplfs(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
|
static int eplfs(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
|
||||||
static int epmfs(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 erofs(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
|
||||||
static int exdev(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
|
|
||||||
static int ff(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
|
static int ff(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
|
||||||
static int ffwp(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
|
|
||||||
static int fwfs(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
|
static int fwfs(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
|
||||||
static int invalid(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
|
|
||||||
static int lfs(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
|
static int lfs(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
|
||||||
static int mfs(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 newest(CType,cstrvec&,const char *,csize_t,cstrptrvec&);
|
||||||
|
@ -176,15 +166,10 @@ namespace mergerfs
|
||||||
|
|
||||||
static const Policy &invalid;
|
static const Policy &invalid;
|
||||||
static const Policy &all;
|
static const Policy &all;
|
||||||
static const Policy &einval;
|
|
||||||
static const Policy &enosys;
|
|
||||||
static const Policy &enotsup;
|
|
||||||
static const Policy &eplfs;
|
static const Policy &eplfs;
|
||||||
static const Policy &epmfs;
|
static const Policy &epmfs;
|
||||||
static const Policy &erofs;
|
static const Policy &erofs;
|
||||||
static const Policy &exdev;
|
|
||||||
static const Policy &ff;
|
static const Policy &ff;
|
||||||
static const Policy &ffwp;
|
|
||||||
static const Policy &fwfs;
|
static const Policy &fwfs;
|
||||||
static const Policy &lfs;
|
static const Policy &lfs;
|
||||||
static const Policy &mfs;
|
static const Policy &mfs;
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (c) 2016, Antonio SJ Musumeci <trapexit@spawn.link>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "policy.hpp"
|
|
||||||
|
|
||||||
using std::string;
|
|
||||||
using std::vector;
|
|
||||||
|
|
||||||
namespace mergerfs
|
|
||||||
{
|
|
||||||
int
|
|
||||||
Policy::Func::einval(const Category::Enum::Type type,
|
|
||||||
const vector<string> &basepaths,
|
|
||||||
const char *fusepath,
|
|
||||||
const size_t minfreespace,
|
|
||||||
vector<const string*> &paths)
|
|
||||||
{
|
|
||||||
return (errno=EINVAL,POLICY_FAIL);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (c) 2016, Antonio SJ Musumeci <trapexit@spawn.link>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "policy.hpp"
|
|
||||||
|
|
||||||
using std::string;
|
|
||||||
using std::vector;
|
|
||||||
|
|
||||||
namespace mergerfs
|
|
||||||
{
|
|
||||||
int
|
|
||||||
Policy::Func::enosys(const Category::Enum::Type type,
|
|
||||||
const vector<string> &basepaths,
|
|
||||||
const char *fusepath,
|
|
||||||
const size_t minfreespace,
|
|
||||||
vector<const string*> &paths)
|
|
||||||
{
|
|
||||||
return (errno=ENOSYS,POLICY_FAIL);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (c) 2016, Antonio SJ Musumeci <trapexit@spawn.link>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "policy.hpp"
|
|
||||||
|
|
||||||
using std::string;
|
|
||||||
using std::vector;
|
|
||||||
|
|
||||||
namespace mergerfs
|
|
||||||
{
|
|
||||||
int
|
|
||||||
Policy::Func::enotsup(const Category::Enum::Type type,
|
|
||||||
const vector<string> &basepaths,
|
|
||||||
const char *fusepath,
|
|
||||||
const size_t minfreespace,
|
|
||||||
vector<const string*> &paths)
|
|
||||||
{
|
|
||||||
return (errno=ENOTSUP,POLICY_FAIL);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (c) 2016, Antonio SJ Musumeci <trapexit@spawn.link>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "policy.hpp"
|
|
||||||
|
|
||||||
using std::string;
|
|
||||||
using std::vector;
|
|
||||||
|
|
||||||
namespace mergerfs
|
|
||||||
{
|
|
||||||
int
|
|
||||||
Policy::Func::exdev(const Category::Enum::Type type,
|
|
||||||
const vector<string> &basepaths,
|
|
||||||
const char *fusepath,
|
|
||||||
const size_t minfreespace,
|
|
||||||
vector<const string*> &paths)
|
|
||||||
{
|
|
||||||
return (errno=EXDEV,POLICY_FAIL);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,80 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (c) 2016, Antonio SJ Musumeci <trapexit@spawn.link>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "fs_path.hpp"
|
|
||||||
#include "policy.hpp"
|
|
||||||
#include "success_fail.hpp"
|
|
||||||
|
|
||||||
using std::string;
|
|
||||||
using std::vector;
|
|
||||||
using std::size_t;
|
|
||||||
|
|
||||||
static
|
|
||||||
int
|
|
||||||
_ffwp(const vector<string> &basepaths,
|
|
||||||
const char *fusepath,
|
|
||||||
vector<const string*> &paths)
|
|
||||||
{
|
|
||||||
int rv;
|
|
||||||
struct stat st;
|
|
||||||
string fullpath;
|
|
||||||
const string *fallback;
|
|
||||||
|
|
||||||
fallback = NULL;
|
|
||||||
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
|
|
||||||
{
|
|
||||||
const string *basepath = &basepaths[i];
|
|
||||||
|
|
||||||
fs::path::make(basepath,fusepath,fullpath);
|
|
||||||
|
|
||||||
rv = ::lstat(fullpath.c_str(),&st);
|
|
||||||
if(LSTAT_SUCCEEDED(rv))
|
|
||||||
{
|
|
||||||
paths.push_back(basepath);
|
|
||||||
return POLICY_SUCCESS;
|
|
||||||
}
|
|
||||||
else if(errno == EACCES)
|
|
||||||
{
|
|
||||||
fallback = basepath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fallback == NULL)
|
|
||||||
return (errno=ENOENT,POLICY_FAIL);
|
|
||||||
|
|
||||||
paths.push_back(fallback);
|
|
||||||
|
|
||||||
return POLICY_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace mergerfs
|
|
||||||
{
|
|
||||||
int
|
|
||||||
Policy::Func::ffwp(const Category::Enum::Type type,
|
|
||||||
const vector<string> &basepaths,
|
|
||||||
const char *fusepath,
|
|
||||||
const size_t minfreespace,
|
|
||||||
vector<const string*> &paths)
|
|
||||||
{
|
|
||||||
return _ffwp(basepaths,fusepath,paths);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user