Browse Source

Merge pull request #520 from trapexit/cleanups

misc cleanups
hidden_files
trapexit 6 years ago
committed by GitHub
parent
commit
9c16ab6999
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      .travis.yml
  2. 3
      src/create.cpp
  3. 94
      src/fs.cpp
  4. 20
      src/fs.hpp
  5. 6
      src/fs_acl.cpp
  6. 4
      src/fs_base_statvfs.hpp
  7. 3
      src/fs_clonepath.cpp
  8. 6
      src/fs_copy_file_range_linux.icpp
  9. 76
      src/fs_exists.hpp
  10. 68
      src/fs_info.cpp
  11. 35
      src/fs_info.hpp
  12. 31
      src/fs_info_t.hpp
  13. 4
      src/fs_movefile.cpp
  14. 31
      src/fs_path.cpp
  15. 20
      src/fs_path.hpp
  16. 6
      src/link.cpp
  17. 3
      src/mkdir.cpp
  18. 3
      src/mknod.cpp
  19. 33
      src/policy_all.cpp
  20. 36
      src/policy_epall.cpp
  21. 48
      src/policy_epff.cpp
  22. 48
      src/policy_eplfs.cpp
  23. 48
      src/policy_eplus.cpp
  24. 48
      src/policy_epmfs.cpp
  25. 7
      src/policy_eprand.cpp
  26. 6
      src/policy_erofs.cpp
  27. 31
      src/policy_ff.cpp
  28. 6
      src/policy_invalid.cpp
  29. 44
      src/policy_lfs.cpp
  30. 44
      src/policy_lus.cpp
  31. 40
      src/policy_mfs.cpp
  32. 41
      src/policy_newest.cpp
  33. 7
      src/policy_rand.cpp
  34. 2
      src/readdir.cpp
  35. 9
      src/rename.cpp
  36. 5
      src/statfs.cpp
  37. 4
      src/statvfs_util.hpp
  38. 8
      src/strset.hpp
  39. 43
      src/success_fail.hpp
  40. 3
      src/symlink.cpp

7
.travis.yml

@ -18,13 +18,6 @@ matrix:
dist: trusty
compiler: clang
sudo: required
- os: osx
compiler: clang
before_script:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew tap caskroom/cask; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew cask install osxfuse; fi
script:
- sudo -E make install-build-pkgs

3
src/create.cpp

@ -87,8 +87,7 @@ _create(Policy::Func::Search searchFunc,
vector<const string*> createpaths;
vector<const string*> existingpaths;
fusedirpath = fusepath;
fs::path::dirname(fusedirpath);
fusedirpath = fs::path::dirname(fusepath);
rv = searchFunc(srcmounts,fusedirpath,minfreespace,existingpaths);
if(rv == -1)

94
src/fs.cpp

@ -27,93 +27,57 @@
#include "fs_base_realpath.hpp"
#include "fs_base_stat.hpp"
#include "fs_base_statvfs.hpp"
#include "fs_exists.hpp"
#include "fs_path.hpp"
#include "fs_xattr.hpp"
#include "statvfs_util.hpp"
#include "str.hpp"
#include "success_fail.hpp"
using std::string;
using std::vector;
namespace fs
{
bool
exists(const string &path,
struct stat &st)
{
int rv;
rv = fs::lstat(path,st);
return LSTAT_SUCCEEDED(rv);
}
bool
exists(const string &path)
{
struct stat st;
return exists(path,st);
}
bool
info(const string &path,
bool &readonly,
uint64_t &spaceavail,
uint64_t &spaceused)
{
int rv;
struct statvfs st;
rv = fs::statvfs(path,st);
if(STATVFS_SUCCEEDED(rv))
{
readonly = StatVFS::readonly(st);
spaceavail = StatVFS::spaceavail(st);
spaceused = StatVFS::spaceused(st);
}
return STATVFS_SUCCEEDED(rv);
}
bool
readonly(const string &path)
int
readonly(const string *path_,
bool *readonly_)
{
int rv;
struct statvfs st;
rv = fs::statvfs(path,st);
rv = fs::statvfs(*path_,st);
if(rv == 0)
*readonly_ = StatVFS::readonly(st);
return (STATVFS_SUCCEEDED(rv) && StatVFS::readonly(st));
return rv;
}
bool
spaceavail(const string &path,
uint64_t &spaceavail)
int
spaceavail(const string *path_,
uint64_t *spaceavail_)
{
int rv;
struct statvfs st;
rv = fs::statvfs(path,st);
if(STATVFS_SUCCEEDED(rv))
spaceavail = StatVFS::spaceavail(st);
rv = fs::statvfs(*path_,st);
if(rv == 0)
*spaceavail_ = StatVFS::spaceavail(st);
return STATVFS_SUCCEEDED(rv);
return rv;
}
bool
spaceused(const string &path,
uint64_t &spaceused)
int
spaceused(const string *path_,
uint64_t *spaceused_)
{
int rv;
struct statvfs st;
rv = fs::statvfs(path,st);
if(STATVFS_SUCCEEDED(rv))
spaceused = StatVFS::spaceused(st);
rv = fs::statvfs(*path_,st);
if(rv == 0)
*spaceused_ = StatVFS::spaceused(st);
return STATVFS_SUCCEEDED(rv);
return rv;
}
void
@ -146,7 +110,7 @@ namespace fs
struct stat st;
rv = fs::fstat(fd,st);
if(FSTAT_FAILED(rv))
if(rv == -1)
return -1;
dev = st.st_dev;
@ -155,7 +119,7 @@ namespace fs
fs::path::make(&srcmounts[i],fusepath,fullpath);
rv = fs::lstat(fullpath,st);
if(FSTAT_FAILED(rv))
if(rv == -1)
continue;
if(st.st_dev != dev)
@ -204,19 +168,21 @@ namespace fs
const uint64_t minfreespace,
string &path)
{
int rv;
uint64_t mfs;
uint64_t spaceavail;
const string *basepath;
const string *mfsbasepath;
mfs = 0;
mfsbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
uint64_t spaceavail;
const string &basepath = basepaths[i];
basepath = &basepaths[i];
if(!fs::spaceavail(basepath,spaceavail))
rv = fs::spaceavail(basepath,&spaceavail);
if(rv == -1)
continue;
if(spaceavail < minfreespace)
continue;
if(spaceavail <= mfs)

20
src/fs.hpp

@ -27,22 +27,14 @@ namespace fs
using std::string;
using std::vector;
bool exists(const string &path,
struct stat &st);
bool exists(const string &path);
int readonly(const string *path_,
bool *readonly_);
bool info(const string &path,
bool &readonly,
uint64_t &spaceavail,
uint64_t &spaceused);
int spaceavail(const string *path_,
uint64_t *spaceavail_);
bool readonly(const string &path);
bool spaceavail(const string &path,
uint64_t &spaceavail);
bool spaceused(const string &path,
uint64_t &spaceavail);
int spaceused(const string *path_,
uint64_t *spaceavail_);
void findallfiles(const vector<string> &srcmounts,
const char *fusepath,

6
src/fs_acl.cpp

@ -28,12 +28,12 @@ namespace fs
namespace acl
{
bool
dir_has_defaults(const std::string &fullpath)
dir_has_defaults(const std::string &fullpath_)
{
int rv;
std::string dirpath = fullpath;
std::string dirpath;
fs::path::dirname(dirpath);
dirpath = fs::path::dirname(&fullpath_);
rv = fs::lgetxattr(dirpath,POSIX_ACL_DEFAULT_XATTR,NULL,0);

4
src/fs_base_statvfs.hpp

@ -18,10 +18,12 @@
#pragma once
#include <string>
#include "errno.hpp"
#include <sys/statvfs.h>
#include <string>
namespace fs
{
static

3
src/fs_clonepath.cpp

@ -70,8 +70,7 @@ namespace fs
if((relative == NULL) || (relative[0] == '\0'))
return 0;
dirname = relative;
fs::path::dirname(dirname);
dirname = fs::path::dirname(relative);
if(!dirname.empty())
{
rv = fs::clonepath(fromsrc,tosrc,dirname);

6
src/fs_copy_file_range_linux.icpp

@ -16,13 +16,15 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#define _GNU_SOURCE
#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif
#include "errno.hpp"
#include <stdio.h>
#include <sys/types.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
static

76
src/fs_exists.hpp

@ -0,0 +1,76 @@
/*
ISC License
Copyright (c) 2018, 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.
*/
#pragma once
#include "fs_base_stat.hpp"
#include "fs_path.hpp"
#include <string>
namespace fs
{
static
inline
bool
exists(const std::string &path_,
struct stat &st_)
{
int rv;
rv = fs::lstat(path_,st_);
return (rv == 0);
}
static
inline
bool
exists(const std::string &path_)
{
struct stat st;
return fs::exists(path_,st);
}
static
inline
bool
exists(const std::string &basepath_,
const char *relpath_,
struct stat &st_)
{
std::string fullpath;
fullpath = fs::path::make(&basepath_,relpath_);
return fs::exists(fullpath,st_);
}
static
inline
bool
exists(const std::string &basepath_,
const char *relpath_)
{
struct stat st;
return fs::exists(basepath_,relpath_,st);
}
}

68
src/fs_info.cpp

@ -0,0 +1,68 @@
/*
ISC License
Copyright (c) 2018, 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 "fs_base_stat.hpp"
#include "fs_base_statvfs.hpp"
#include "fs_info_t.hpp"
#include "fs_path.hpp"
#include "statvfs_util.hpp"
#include <stdint.h>
#include <string>
using std::string;
namespace fs
{
int
info(const string *path_,
fs::info_t *info_)
{
int rv;
struct statvfs st;
rv = fs::statvfs(*path_,st);
if(rv == 0)
{
info_->readonly = StatVFS::readonly(st);
info_->spaceavail = StatVFS::spaceavail(st);
info_->spaceused = StatVFS::spaceused(st);
}
return rv;
}
int
info(const string *basepath_,
const char *relpath_,
fs::info_t *info_)
{
int rv;
string fullpath;
struct stat st;
fullpath = fs::path::make(basepath_,relpath_);
rv = fs::lstat(fullpath,st);
if(rv == -1)
return -1;
return fs::info(basepath_,info_);
}
}

35
src/fs_info.hpp

@ -0,0 +1,35 @@
/*
ISC License
Copyright (c) 2018, 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.
*/
#pragma once
#include "fs_info_t.hpp"
#include <string>
namespace fs
{
int
info(const std::string *basepath_,
const char *relpath_,
fs::info_t *info_);
int
info(const std::string *path_,
fs::info_t *info_);
}

31
src/fs_info_t.hpp

@ -0,0 +1,31 @@
/*
ISC License
Copyright (c) 2018, 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.
*/
#pragma once
#include <stdint.h>
namespace fs
{
struct info_t
{
bool readonly;
uint64_t spaceavail;
uint64_t spaceused;
};
}

4
src/fs_movefile.cpp

@ -75,8 +75,8 @@ namespace fs
if(rv == -1)
return -1;
fusedir = fusepath;
fs::path::dirname(fusedir);
fusedir = fs::path::dirname(&fusepath);
rv = fs::clonepath(fdin_path,fdout_path,fusedir);
if(rv == -1)
return -1;

31
src/fs_path.cpp

@ -29,24 +29,37 @@ namespace fs
{
namespace path
{
void
dirname(string &path)
string
dirname(const char *path_)
{
string path(path_);
return fs::path::dirname(&path);
}
string
dirname(const string *path_)
{
string rv;
string::reverse_iterator i;
string::reverse_iterator bi;
string::reverse_iterator ei;
bi = path.rend();
i = path.rbegin();
while(*i == '/' && i != bi)
rv = *path_;
i = rv.rbegin();
ei = rv.rend();
while(*i == '/' && i != ei)
i++;
while(*i != '/' && i != bi)
while(*i != '/' && i != ei)
i++;
while(*i == '/' && i != bi)
while(*i == '/' && i != ei)
i++;
path.erase(i.base(),path.end());
rv.erase(i.base(),rv.end());
return rv;
}
string

20
src/fs_path.hpp

@ -25,7 +25,8 @@ namespace fs
{
using std::string;
void dirname(string &path);
string dirname(const char *path_);
string dirname(const string *path_);
string basename(const string &path);
@ -64,5 +65,22 @@ namespace fs
output = *base;
output += suffix;
}
inline
string
make(const string *base_,
const char *suffix_)
{
return (*base_ + suffix_);
}
static
inline
string
make(const string *base_,
const string *suffix_)
{
return (*base_ + *suffix_);
}
}
};

6
src/link.cpp

@ -97,8 +97,7 @@ _link_create_path(Policy::Func::Search searchFunc,
if(rv == -1)
return -errno;
newfusedirpath = newfusepath;
fs::path::dirname(newfusedirpath);
newfusedirpath = fs::path::dirname(newfusepath);
rv = searchFunc(srcmounts,newfusedirpath,minfreespace,newbasepaths);
if(rv == -1)
@ -123,8 +122,7 @@ _clonepath_if_would_create(Policy::Func::Search searchFunc,
string newfusedirpath;
vector<const string*> newbasepath;
newfusedirpath = newfusepath;
fs::path::dirname(newfusedirpath);
newfusedirpath = fs::path::dirname(newfusepath);
rv = createFunc(srcmounts,newfusedirpath,minfreespace,newbasepath);
if(rv == -1)

3
src/mkdir.cpp

@ -105,8 +105,7 @@ _mkdir(Policy::Func::Search searchFunc,
vector<const string*> createpaths;
vector<const string*> existingpaths;
fusedirpath = fusepath;
fs::path::dirname(fusedirpath);
fusedirpath = fs::path::dirname(fusepath);
rv = searchFunc(srcmounts,fusedirpath,minfreespace,existingpaths);
if(rv == -1)

3
src/mknod.cpp

@ -110,8 +110,7 @@ _mknod(Policy::Func::Search searchFunc,
vector<const string*> createpaths;
vector<const string*> existingpaths;
fusedirpath = fusepath;
fs::path::dirname(fusedirpath);
fusedirpath = fs::path::dirname(fusepath);
rv = searchFunc(srcmounts,fusedirpath,minfreespace,existingpaths);
if(rv == -1)

33
src/policy_all.cpp

@ -14,14 +14,15 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <string>
#include <vector>
#include "errno.hpp"
#include "fs.hpp"
#include "fs_exists.hpp"
#include "fs_info.hpp"
#include "fs_path.hpp"
#include "policy.hpp"
#include <string>
#include <vector>
using std::string;
using std::vector;
@ -31,18 +32,20 @@ _all_create(const vector<string> &basepaths,
const uint64_t minfreespace,
vector<const string*> &paths)
{
int rv;
fs::info_t info;
const string *basepath;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
bool readonly;
uint64_t spaceavail;
uint64_t _spaceused;
const string *basepath = &basepaths[i];
basepath = &basepaths[i];
if(!fs::info(*basepath,readonly,spaceavail,_spaceused))
rv = fs::info(basepath,&info);
if(rv == -1)
continue;
if(readonly)
if(info.readonly)
continue;
if(spaceavail < minfreespace)
if(info.spaceavail < minfreespace)
continue;
paths.push_back(basepath);
@ -60,15 +63,13 @@ _all_other(const vector<string> &basepaths,
const char *fusepath,
vector<const string*> &paths)
{
string fullpath;
const string *basepath;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath);
basepath = &basepaths[i];
if(!fs::exists(fullpath))
if(!fs::exists(*basepath,fusepath))
continue;
paths.push_back(basepath);

36
src/policy_epall.cpp

@ -14,14 +14,16 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <string>
#include <vector>
#include "errno.hpp"
#include "fs.hpp"
#include "fs_exists.hpp"
#include "fs_info.hpp"
#include "fs_path.hpp"
#include "policy.hpp"
#include <string>
#include <vector>
using std::string;
using std::vector;
@ -32,24 +34,20 @@ _epall_create(const vector<string> &basepaths,
const uint64_t minfreespace,
vector<const string*> &paths)
{
string fullpath;
int rv;
fs::info_t info;
const string *basepath;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
bool readonly;
uint64_t spaceavail;
uint64_t _spaceused;
const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath);
basepath = &basepaths[i];
if(!fs::exists(fullpath))
rv = fs::info(basepath,fusepath,&info);
if(rv == -1)
continue;
if(!fs::info(*basepath,readonly,spaceavail,_spaceused))
if(info.readonly)
continue;
if(readonly)
continue;
if(spaceavail < minfreespace)
if(info.spaceavail < minfreespace)
continue;
paths.push_back(basepath);
@ -67,15 +65,13 @@ _epall_other(const vector<string> &basepaths,
const char *fusepath,
vector<const string*> &paths)
{
string fullpath;
const string *basepath;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath);
basepath = &basepaths[i];
if(!fs::exists(fullpath))
if(!fs::exists(*basepath,fusepath))
continue;
paths.push_back(basepath);

48
src/policy_epff.cpp

@ -14,14 +14,16 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <string>
#include <vector>
#include "errno.hpp"
#include "fs.hpp"
#include "fs_exists.hpp"
#include "fs_info.hpp"
#include "fs_path.hpp"
#include "policy.hpp"
#include <string>
#include <vector>
using std::string;
using std::vector;
using mergerfs::Category;
@ -33,28 +35,20 @@ _epff_create(const vector<string> &basepaths,
const uint64_t minfreespace,
vector<const string*> &paths)
{
string fullpath;
const string *fallback;
int rv;
fs::info_t info;
const string *basepath;
fallback = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
bool readonly;
uint64_t spaceavail;
uint64_t _spaceused;
const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath);
basepath = &basepaths[i];
if(!fs::exists(fullpath))
rv = fs::info(basepath,fusepath,&info);
if(rv == -1)
continue;
if(!fs::info(*basepath,readonly,spaceavail,_spaceused))
if(info.readonly)
continue;
if(readonly)
continue;
if(fallback == NULL)
fallback = basepath;
if(spaceavail < minfreespace)
if(info.spaceavail < minfreespace)
continue;
paths.push_back(basepath);
@ -62,12 +56,7 @@ _epff_create(const vector<string> &basepaths,
return 0;
}
if(fallback == NULL)
return (errno=ENOENT,-1);
paths.push_back(fallback);
return 0;
return (errno=ENOENT,-1);
}
static
@ -76,15 +65,13 @@ _epff_other(const vector<string> &basepaths,
const char *fusepath,
vector<const string*> &paths)
{
string fullpath;
const string *basepath;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath);
basepath = &basepaths[i];
if(!fs::exists(fullpath))
if(!fs::exists(*basepath,fusepath))
continue;
paths.push_back(basepath);
@ -109,7 +96,6 @@ _epff(const Category::Enum::Type type,
return _epff_other(basepaths,fusepath,paths);
}
namespace mergerfs
{
int

48
src/policy_eplfs.cpp

@ -14,15 +14,17 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <limits>
#include <string>
#include <vector>
#include "errno.hpp"
#include "fs.hpp"
#include "fs_exists.hpp"
#include "fs_info.hpp"
#include "fs_path.hpp"
#include "policy.hpp"
#include <limits>
#include <string>
#include <vector>
using std::string;
using std::vector;
using mergerfs::Category;
@ -34,33 +36,29 @@ _eplfs_create(const vector<string> &basepaths,
const uint64_t minfreespace,
vector<const string*> &paths)
{
string fullpath;
int rv;
uint64_t eplfs;
fs::info_t info;
const string *basepath;
const string *eplfsbasepath;
eplfs = std::numeric_limits<uint64_t>::max();
eplfsbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
bool readonly;
uint64_t spaceavail;
uint64_t _spaceused;
const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath);
basepath = &basepaths[i];
if(!fs::exists(fullpath))
continue;
if(!fs::info(*basepath,readonly,spaceavail,_spaceused))
rv = fs::info(basepath,fusepath,&info);
if(rv == -1)
continue;
if(readonly)
if(info.readonly)
continue;
if(spaceavail < minfreespace)
if(info.spaceavail < minfreespace)
continue;
if(spaceavail > eplfs)
if(info.spaceavail > eplfs)
continue;
eplfs = spaceavail;
eplfs = info.spaceavail;
eplfsbasepath = basepath;
}
@ -78,22 +76,22 @@ _eplfs_other(const vector<string> &basepaths,
const char *fusepath,
vector<const string*> &paths)
{
string fullpath;
int rv;
uint64_t eplfs;
uint64_t spaceavail;
const string *basepath;
const string *eplfsbasepath;
eplfs = std::numeric_limits<uint64_t>::max();
eplfsbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
uint64_t spaceavail;
const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath);
basepath = &basepaths[i];
if(!fs::exists(fullpath))
if(!fs::exists(*basepath,fusepath))
continue;
if(!fs::spaceavail(*basepath,spaceavail))
rv = fs::spaceavail(basepath,&spaceavail);
if(rv == -1)
continue;
if(spaceavail > eplfs)
continue;

48
src/policy_eplus.cpp

@ -14,15 +14,17 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <limits>
#include <string>
#include <vector>
#include "errno.hpp"
#include "fs.hpp"
#include "fs_exists.hpp"
#include "fs_info.hpp"
#include "fs_path.hpp"
#include "policy.hpp"
#include <limits>
#include <string>
#include <vector>
using std::string;
using std::vector;
using mergerfs::Category;
@ -34,33 +36,29 @@ _eplus_create(const vector<string> &basepaths,
const uint64_t minfreespace,
vector<const string*> &paths)
{
string fullpath;
int rv;
uint64_t eplus;
fs::info_t info;
const string *basepath;
const string *eplusbasepath;
eplus = std::numeric_limits<uint64_t>::max();
eplusbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
bool readonly;
uint64_t spaceavail;
uint64_t spaceused;
const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath);
basepath = &basepaths[i];
if(!fs::exists(fullpath))
continue;
if(!fs::info(*basepath,readonly,spaceavail,spaceused))
rv = fs::info(basepath,fusepath,&info);
if(rv == -1)
continue;
if(readonly)
if(info.readonly)
continue;
if(spaceavail < minfreespace)
if(info.spaceavail < minfreespace)
continue;
if(spaceused >= eplus)
if(info.spaceused >= eplus)
continue;
eplus = spaceused;
eplus = info.spaceused;
eplusbasepath = basepath;
}
@ -78,22 +76,22 @@ _eplus_other(const vector<string> &basepaths,
const char *fusepath,
vector<const string*> &paths)
{
string fullpath;
int rv;
uint64_t eplus;
uint64_t spaceused;
const string *basepath;
const string *eplusbasepath;
eplus = 0;
eplusbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
uint64_t spaceused;
const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath);
basepath = &basepaths[i];
if(!fs::exists(fullpath))
if(!fs::exists(*basepath,fusepath))
continue;
if(!fs::spaceused(*basepath,spaceused))
rv = fs::spaceused(basepath,&spaceused);
if(rv == -1)
continue;
if(spaceused >= eplus)
continue;

48
src/policy_epmfs.cpp

@ -14,15 +14,17 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <limits>
#include <string>
#include <vector>
#include "errno.hpp"
#include "fs.hpp"
#include "fs_exists.hpp"
#include "fs_info.hpp"
#include "fs_path.hpp"
#include "policy.hpp"
#include <limits>
#include <string>
#include <vector>
using std::string;
using std::vector;
using mergerfs::Category;
@ -34,33 +36,29 @@ _epmfs_create(const vector<string> &basepaths,
const uint64_t minfreespace,
vector<const string*> &paths)
{
string fullpath;
int rv;
uint64_t epmfs;
fs::info_t info;
const string *basepath;
const string *epmfsbasepath;
epmfs = std::numeric_limits<uint64_t>::min();
epmfsbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
bool readonly;
uint64_t spaceavail;
uint64_t _spaceused;
const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath);
basepath = &basepaths[i];
if(!fs::exists(fullpath))
continue;
if(!fs::info(*basepath,readonly,spaceavail,_spaceused))
rv = fs::info(basepath,fusepath,&info);
if(rv == -1)
continue;
if(readonly)
if(info.readonly)
continue;
if(spaceavail < minfreespace)
if(info.spaceavail < minfreespace)
continue;
if(spaceavail < epmfs)
if(info.spaceavail < epmfs)
continue;
epmfs = spaceavail;
epmfs = info.spaceavail;
epmfsbasepath = basepath;
}
@ -78,22 +76,22 @@ _epmfs_other(const vector<string> &basepaths,
const char *fusepath,
vector<const string*> &paths)
{
string fullpath;
int rv;
uint64_t epmfs;
uint64_t spaceavail;
const string *basepath;
const string *epmfsbasepath;
epmfs = 0;
epmfsbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
uint64_t spaceavail;
const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath);
basepath = &basepaths[i];
if(!fs::exists(fullpath))
if(!fs::exists(*basepath,fusepath))
continue;
if(!fs::spaceavail(*basepath,spaceavail))
rv = fs::spaceavail(basepath,&spaceavail);
if(rv == -1)
continue;
if(spaceavail < epmfs)
continue;

7
src/policy_eprand.cpp

@ -14,14 +14,13 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "errno.hpp"
#include "policy.hpp"
#include <algorithm>
#include <string>
#include <vector>
#include "errno.hpp"
#include "policy.hpp"
#include "success_fail.hpp"
using std::string;
using std::vector;

6
src/policy_erofs.cpp

@ -14,12 +14,12 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <string>
#include <vector>
#include "errno.hpp"
#include "policy.hpp"
#include <string>
#include <vector>
using std::string;
using std::vector;

31
src/policy_ff.cpp

@ -14,14 +14,16 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <string>
#include <vector>
#include "errno.hpp"
#include "fs.hpp"
#include "fs_exists.hpp"
#include "fs_info.hpp"
#include "fs_path.hpp"
#include "policy.hpp"
#include <string>
#include <vector>
using std::string;
using std::vector;
@ -31,23 +33,24 @@ _ff_create(const vector<string> &basepaths,
const uint64_t minfreespace,
vector<const string*> &paths)
{
int rv;
fs::info_t info;
const string *basepath;
const string *fallback;
fallback = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
bool readonly;
uint64_t spaceavail;
uint64_t _spaceused;
const string *basepath = &basepaths[i];
basepath = &basepaths[i];
if(!fs::info(*basepath,readonly,spaceavail,_spaceused))
rv = fs::info(basepath,&info);
if(rv == -1)
continue;
if(readonly)
if(info.readonly)
continue;
if(fallback == NULL)
fallback = basepath;
if(spaceavail < minfreespace)
if(info.spaceavail < minfreespace)
continue;
paths.push_back(basepath);
@ -69,15 +72,13 @@ _ff_other(const vector<string> &basepaths,
const char *fusepath,
vector<const string*> &paths)
{
string fullpath;
const string *basepath;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath);
basepath = &basepaths[i];
if(!fs::exists(fullpath))
if(!fs::exists(*basepath,fusepath))
continue;
paths.push_back(basepath);

6
src/policy_invalid.cpp

@ -14,12 +14,12 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <string>
#include <vector>
#include "errno.hpp"
#include "policy.hpp"
#include <string>
#include <vector>
using std::string;
using std::vector;

44
src/policy_lfs.cpp

@ -14,15 +14,17 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <limits>
#include <string>
#include <vector>
#include "errno.hpp"
#include "fs.hpp"
#include "fs_exists.hpp"
#include "fs_info.hpp"
#include "fs_path.hpp"
#include "policy.hpp"
#include <limits>
#include <string>
#include <vector>
using std::string;
using std::vector;
using mergerfs::Category;
@ -33,29 +35,29 @@ _lfs_create(const vector<string> &basepaths,
const uint64_t minfreespace,
vector<const string*> &paths)
{
string fullpath;
int rv;
uint64_t lfs;
fs::info_t info;
const string *basepath;
const string *lfsbasepath;
lfs = std::numeric_limits<uint64_t>::max();
lfsbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
bool readonly;
uint64_t spaceavail;
uint64_t _spaceused;
const string *basepath = &basepaths[i];
basepath = &basepaths[i];
if(!fs::info(*basepath,readonly,spaceavail,_spaceused))
rv = fs::info(basepath,&info);
if(rv == -1)
continue;
if(readonly)
if(info.readonly)
continue;
if(spaceavail < minfreespace)
if(info.spaceavail < minfreespace)
continue;
if(spaceavail > lfs)
if(info.spaceavail > lfs)
continue;
lfs = spaceavail;
lfs = info.spaceavail;
lfsbasepath = basepath;
}
@ -73,22 +75,22 @@ _lfs_other(const vector<string> &basepaths,
const char *fusepath,
vector<const string*> &paths)
{
string fullpath;
int rv;
uint64_t lfs;
uint64_t spaceavail;
const string *basepath;
const string *lfsbasepath;
lfs = std::numeric_limits<uint64_t>::max();
lfsbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
uint64_t spaceavail;
const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath);
basepath = &basepaths[i];
if(!fs::exists(fullpath))
if(!fs::exists(*basepath,fusepath))
continue;
if(!fs::spaceavail(*basepath,spaceavail))
rv = fs::spaceavail(basepath,&spaceavail);
if(rv == -1)
continue;
if(spaceavail > lfs)
continue;

44
src/policy_lus.cpp

@ -14,15 +14,17 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <limits>
#include <string>
#include <vector>
#include "errno.hpp"
#include "fs.hpp"
#include "fs_exists.hpp"
#include "fs_info.hpp"
#include "fs_path.hpp"
#include "policy.hpp"
#include <limits>
#include <string>
#include <vector>
using std::string;
using std::vector;
using mergerfs::Category;
@ -33,29 +35,29 @@ _lus_create(const vector<string> &basepaths,
const uint64_t minfreespace,
vector<const string*> &paths)
{
string fullpath;
int rv;
uint64_t lus;
fs::info_t info;
const string *basepath;
const string *lusbasepath;
lus = std::numeric_limits<uint64_t>::max();
lusbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
bool readonly;
uint64_t spaceused;
uint64_t spaceavail;
const string *basepath = &basepaths[i];
basepath = &basepaths[i];
if(!fs::info(*basepath,readonly,spaceavail,spaceused))
rv = fs::info(basepath,&info);
if(rv == -1)
continue;
if(readonly)
if(info.readonly)
continue;
if(spaceavail < minfreespace)
if(info.spaceavail < minfreespace)
continue;
if(spaceused >= lus)
if(info.spaceused >= lus)
continue;
lus = spaceused;
lus = info.spaceused;
lusbasepath = basepath;
}
@ -73,22 +75,22 @@ _lus_other(const vector<string> &basepaths,
const char *fusepath,
vector<const string*> &paths)
{
string fullpath;
int rv;
uint64_t lus;
uint64_t spaceused;
const string *basepath;
const string *lusbasepath;
lus = 0;
lusbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
uint64_t spaceused;
const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath);
basepath = &basepaths[i];
if(!fs::exists(fullpath))
if(!fs::exists(*basepath,fusepath))
continue;
if(!fs::spaceused(*basepath,spaceused))
rv = fs::spaceused(basepath,&spaceused);
if(rv == -1)
continue;
if(spaceused >= lus)
continue;

40
src/policy_mfs.cpp

@ -14,14 +14,16 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <string>
#include <vector>
#include "errno.hpp"
#include "fs.hpp"
#include "fs_exists.hpp"
#include "fs_info.hpp"
#include "fs_path.hpp"
#include "policy.hpp"
#include <string>
#include <vector>
using std::string;
using std::vector;
using mergerfs::Category;
@ -31,27 +33,27 @@ int
_mfs_create(const vector<string> &basepaths,
vector<const string*> &paths)
{
string fullpath;
int rv;
uint64_t mfs;
fs::info_t info;
const string *basepath;
const string *mfsbasepath;
mfs = 0;
mfsbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
bool readonly;
uint64_t spaceavail;
uint64_t _spaceused;
const string *basepath = &basepaths[i];
basepath = &basepaths[i];
if(!fs::info(*basepath,readonly,spaceavail,_spaceused))
rv = fs::info(basepath,&info);
if(rv == -1)
continue;
if(readonly)
if(info.readonly)
continue;
if(spaceavail < mfs)
if(info.spaceavail < mfs)
continue;
mfs = spaceavail;
mfs = info.spaceavail;
mfsbasepath = basepath;
}
@ -69,22 +71,22 @@ _mfs_other(const vector<string> &basepaths,
const char *fusepath,
vector<const string*> &paths)
{
string fullpath;
int rv;
uint64_t mfs;
uint64_t spaceavail;
const string *basepath;
const string *mfsbasepath;
mfs = 0;
mfsbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
uint64_t spaceavail;
const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath);
basepath = &basepaths[i];
if(!fs::exists(fullpath))
if(!fs::exists(*basepath,fusepath))
continue;
if(!fs::spaceavail(*basepath,spaceavail))
rv = fs::spaceavail(basepath,&spaceavail);
if(rv == -1)
continue;
if(spaceavail < mfs)
continue;

41
src/policy_newest.cpp

@ -14,17 +14,18 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/stat.h>
#include <string>
#include <vector>
#include <limits>
#include "errno.hpp"
#include "fs.hpp"
#include "fs_exists.hpp"
#include "fs_path.hpp"
#include "policy.hpp"
#include "success_fail.hpp"
#include <string>
#include <vector>
#include <limits>
#include <sys/stat.h>
using std::string;
using std::vector;
@ -35,25 +36,27 @@ _newest_create(const vector<string> &basepaths,
const char *fusepath,
vector<const string*> &paths)
{
int rv;
bool readonly;
time_t newest;
string fullpath;
struct stat st;
const string *basepath;
const string *newestbasepath;
newest = std::numeric_limits<time_t>::min();
newestbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
basepath = &basepaths[i];
struct stat st;
const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath);
if(!fs::exists(fullpath,st))
if(!fs::exists(*basepath,fusepath,st))
continue;
if(st.st_mtime < newest)
continue;
if(fs::readonly(*basepath))
rv = fs::readonly(basepath,&readonly);
if(rv == -1)
continue;
if(readonly)
continue;
newest = st.st_mtime;
@ -75,19 +78,17 @@ _newest_other(const vector<string> &basepaths,
vector<const string*> &paths)
{
time_t newest;
string fullpath;
struct stat st;
const string *basepath;
const string *newestbasepath;
newest = std::numeric_limits<time_t>::min();
newestbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
struct stat st;
const string *basepath = &basepaths[i];
fs::path::make(basepath,fusepath,fullpath);
basepath = &basepaths[i];
if(!fs::exists(fullpath,st))
if(!fs::exists(*basepath,fusepath,st))
continue;
if(st.st_mtime < newest)
continue;

7
src/policy_rand.cpp

@ -14,14 +14,13 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "errno.hpp"
#include "policy.hpp"
#include <algorithm>
#include <string>
#include <vector>
#include "errno.hpp"
#include "policy.hpp"
#include "success_fail.hpp"
using std::string;
using std::vector;

2
src/readdir.cpp

@ -14,7 +14,7 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#define _BSD_SOURCE
#define _DEFAULT_SOURCE
#include <fuse.h>

9
src/rename.cpp

@ -107,6 +107,7 @@ _rename_create_path(Policy::Func::Search searchFunc,
{
int rv;
int error;
string newfusedirpath;
vector<string> toremove;
vector<const string*> newbasepath;
vector<const string*> oldbasepaths;
@ -115,8 +116,8 @@ _rename_create_path(Policy::Func::Search searchFunc,
if(rv == -1)
return -errno;
string newfusedirpath = newfusepath;
fs::path::dirname(newfusedirpath);
newfusedirpath = fs::path::dirname(newfusepath);
rv = searchFunc(srcmounts,newfusedirpath,minfreespace,newbasepath);
if(rv == -1)
return -errno;
@ -174,8 +175,8 @@ _clonepath_if_would_create(Policy::Func::Search searchFunc,
string newfusedirpath;
vector<const string*> newbasepath;
newfusedirpath = newfusepath;
fs::path::dirname(newfusedirpath);
newfusedirpath = fs::path::dirname(newfusepath);
rv = createFunc(srcmounts,newfusedirpath,minfreespace,newbasepath);
if(rv == -1)
return rv;

5
src/statfs.cpp

@ -27,7 +27,6 @@
#include "fs_base_stat.hpp"
#include "fs_base_statvfs.hpp"
#include "rwlock.hpp"
#include "success_fail.hpp"
#include "ugid.hpp"
using std::string;
@ -76,11 +75,11 @@ _statfs_core(const char *srcmount,
struct statvfs fsstat;
rv = fs::statvfs(srcmount,fsstat);
if(STATVFS_FAILED(rv))
if(rv == -1)
return;
rv = fs::stat(srcmount,st);
if(STAT_FAILED(rv))
if(rv == -1)
return;
if(fsstat.f_bsize && (min_bsize > fsstat.f_bsize))

4
src/statvfs_util.hpp

@ -16,11 +16,9 @@
#pragma once
#include <string>
#include <sys/statvfs.h>
#include "success_fail.hpp"
#include <string>
namespace StatVFS
{

8
src/strset.hpp

@ -18,10 +18,10 @@
#pragma once
#include <string.h>
#include "khash.h"
#include <string.h>
KHASH_SET_INIT_STR(strset);
class StrSet
@ -36,7 +36,7 @@ public:
{
for(khint_t k = kh_begin(_set), ek = kh_end(_set); k != ek; k++)
if(kh_exist(_set,k))
free((char*)kh_key(_set,k));
::free((char*)kh_key(_set,k));
kh_destroy(strset,_set);
}
@ -52,7 +52,7 @@ public:
if(rv == 0)
return 0;
kh_key(_set,key) = strdup(str);
kh_key(_set,key) = ::strdup(str);
return rv;
}

43
src/success_fail.hpp

@ -1,43 +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.
*/
#pragma once
#define STATVFS_SUCCESS 0
#define STATVFS_SUCCEEDED(RV) ((RV) == STATVFS_SUCCESS)
#define STATVFS_FAIL -1
#define STATVFS_FAILED(RV) ((RV) == STATVFS_FAIL)
#define STAT_SUCCESS 0
#define STAT_SUCCEEDED(RV) ((RV) == STAT_SUCCESS)
#define STAT_FAIL -1
#define STAT_FAILED(RV) ((RV) == STAT_FAIL)
#define LSTAT_SUCCESS 0
#define LSTAT_SUCCEEDED(RV) ((RV) == LSTAT_SUCCESS)
#define LSTAT_FAIL -1
#define LSTAT_FAILED(RV) ((RV) == LSTAT_FAIL)
#define FSTAT_SUCCESS 0
#define FSTAT_SUCCEEDED(RV) ((RV) == FSTAT_SUCCESS)
#define FSTAT_FAIL -1
#define FSTAT_FAILED(RV) ((RV) == FSTAT_FAIL)
#define RENAME_SUCCESS 0
#define RENAME_SUCCEEDED(RV) ((RV) == RENAME_SUCCESS)
#define RENAME_FAIL -1
#define RENAME_FAILED(RV) ((RV) == RENAME_FAIL)
#define RENAME_FAILED_WITH(RV,ERRNO) (((RV) == RENAME_FAIL) && (errno == ERRNO))

3
src/symlink.cpp

@ -92,8 +92,7 @@ _symlink(Policy::Func::Search searchFunc,
vector<const string*> newbasepaths;
vector<const string*> existingpaths;
newdirpath = newpath;
fs::path::dirname(newdirpath);
newdirpath = fs::path::dirname(newpath);
rv = searchFunc(srcmounts,newdirpath,minfreespace,existingpaths);
if(rv == -1)

Loading…
Cancel
Save