mergerfs-2.21.0/0000775000175000017500000000000013103514237012017 5ustar bilebilemergerfs-2.21.0/src/0000775000175000017500000000000013103514237012606 5ustar bilebilemergerfs-2.21.0/src/fs_clonepath.cpp0000664000175000017500000000533413072271026015765 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include "errno.h" #include "fs_attr.hpp" #include "fs_base_chmod.hpp" #include "fs_base_chown.hpp" #include "fs_base_mkdir.hpp" #include "fs_base_stat.hpp" #include "fs_base_utime.hpp" #include "fs_clonepath.hpp" #include "fs_path.hpp" #include "fs_xattr.hpp" using std::string; static bool ignorable_error(const int err) { switch(err) { case ENOTTY: case ENOTSUP: #if ENOTSUP != EOPNOTSUPP case EOPNOTSUPP: #endif return true; } return false; } namespace fs { int clonepath(const string &fromsrc, const string &tosrc, const char *relative) { int rv; struct stat st; string topath; string frompath; string dirname; dirname = relative; fs::path::dirname(dirname); if(!dirname.empty()) { rv = fs::clonepath(fromsrc,tosrc,dirname); if(rv == -1) return -1; } fs::path::make(&fromsrc,relative,frompath); rv = fs::stat(frompath,st); if(rv == -1) return -1; else if(!S_ISDIR(st.st_mode)) return (errno=ENOTDIR,-1); fs::path::make(&tosrc,relative,topath); rv = fs::mkdir(topath,st.st_mode); if(rv == -1) { if(errno != EEXIST) return -1; rv = fs::chmod_check_on_error(topath,st.st_mode); if(rv == -1) return -1; } // It may not support it... it's fine... rv = fs::attr::copy(frompath,topath); if((rv == -1) && !ignorable_error(errno)) return -1; rv = fs::xattr::copy(frompath,topath); if((rv == -1) && !ignorable_error(errno)) return -1; rv = fs::lchown_check_on_error(topath,st); if(rv == -1) return -1; rv = fs::utime(topath,st); if(rv == -1) return -1; return 0; } int clonepath(const std::string &from, const std::string &to, const std::string &relative) { return fs::clonepath(from,to,relative.c_str()); } } mergerfs-2.21.0/src/policy_mfs.cpp0000664000175000017500000000632113101725025015455 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include "errno.hpp" #include "fs.hpp" #include "fs_path.hpp" #include "policy.hpp" using std::string; using std::vector; using mergerfs::Category; static int _mfs_create(const vector &basepaths, vector &paths) { string fullpath; uint64_t mfs; 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]; if(!fs::info(*basepath,readonly,spaceavail,_spaceused)) continue; if(readonly) continue; if(spaceavail < mfs) continue; mfs = spaceavail; mfsbasepath = basepath; } if(mfsbasepath == NULL) return POLICY_FAIL_ENOENT; paths.push_back(mfsbasepath); return POLICY_SUCCESS; } static int _mfs_other(const vector &basepaths, const char *fusepath, vector &paths) { string fullpath; uint64_t mfs; 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); if(!fs::exists(fullpath)) continue; if(!fs::spaceavail(*basepath,spaceavail)) continue; if(spaceavail < mfs) continue; mfs = spaceavail; mfsbasepath = basepath; } if(mfsbasepath == NULL) return POLICY_FAIL_ENOENT; paths.push_back(mfsbasepath); return POLICY_SUCCESS; } static int _mfs(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, vector &paths) { if(type == Category::Enum::create) return _mfs_create(basepaths,paths); return _mfs_other(basepaths,fusepath,paths); } namespace mergerfs { int Policy::Func::mfs(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { int rv; rv = _mfs(type,basepaths,fusepath,paths); if(POLICY_FAILED(rv)) rv = Policy::Func::ff(type,basepaths,fusepath,minfreespace,paths); return rv; } } mergerfs-2.21.0/src/fs_base_write.hpp0000664000175000017500000000235213040040376016133 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_WRITE_HPP__ #define __FS_BASE_WRITE_HPP__ #include namespace fs { static inline ssize_t write(const int fd, const void *buf, const size_t count) { return ::write(fd,buf,count); } static inline ssize_t pwrite(const int fd, const void *buf, const size_t count, const off_t offset) { return ::pwrite(fd,buf,count,offset); } } #endif mergerfs-2.21.0/src/fusefunc.cpp0000664000175000017500000000756513035712542015150 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include "buildvector.hpp" #include "category.hpp" #include "fusefunc.hpp" #define FUSEFUNC(X,Y) FuseFunc(FuseFunc::Enum::X,#X,Category::Enum::Y) namespace mergerfs { const std::vector FuseFunc::_fusefuncs_ = buildvector (FUSEFUNC(invalid,invalid)) (FUSEFUNC(access,search)) (FUSEFUNC(chmod,action)) (FUSEFUNC(chown,action)) (FUSEFUNC(create,create)) (FUSEFUNC(getattr,search)) (FUSEFUNC(getxattr,search)) (FUSEFUNC(link,action)) (FUSEFUNC(listxattr,search)) (FUSEFUNC(mkdir,create)) (FUSEFUNC(mknod,create)) (FUSEFUNC(open,search)) (FUSEFUNC(readlink,search)) (FUSEFUNC(removexattr,action)) (FUSEFUNC(rename,action)) (FUSEFUNC(rmdir,action)) (FUSEFUNC(setxattr,action)) (FUSEFUNC(symlink,create)) (FUSEFUNC(truncate,action)) (FUSEFUNC(unlink,action)) (FUSEFUNC(utimens,action)) ; const FuseFunc * const FuseFunc::fusefuncs = &_fusefuncs_[1]; const FuseFunc &FuseFunc::invalid = FuseFunc::fusefuncs[FuseFunc::Enum::invalid]; const FuseFunc &FuseFunc::access = FuseFunc::fusefuncs[FuseFunc::Enum::access]; const FuseFunc &FuseFunc::chmod = FuseFunc::fusefuncs[FuseFunc::Enum::chmod]; const FuseFunc &FuseFunc::chown = FuseFunc::fusefuncs[FuseFunc::Enum::chown]; const FuseFunc &FuseFunc::create = FuseFunc::fusefuncs[FuseFunc::Enum::create]; const FuseFunc &FuseFunc::getattr = FuseFunc::fusefuncs[FuseFunc::Enum::getattr]; const FuseFunc &FuseFunc::getxattr = FuseFunc::fusefuncs[FuseFunc::Enum::getxattr]; const FuseFunc &FuseFunc::link = FuseFunc::fusefuncs[FuseFunc::Enum::link]; const FuseFunc &FuseFunc::listxattr = FuseFunc::fusefuncs[FuseFunc::Enum::listxattr]; const FuseFunc &FuseFunc::mkdir = FuseFunc::fusefuncs[FuseFunc::Enum::mkdir]; const FuseFunc &FuseFunc::mknod = FuseFunc::fusefuncs[FuseFunc::Enum::mknod]; const FuseFunc &FuseFunc::open = FuseFunc::fusefuncs[FuseFunc::Enum::open]; const FuseFunc &FuseFunc::readlink = FuseFunc::fusefuncs[FuseFunc::Enum::readlink]; const FuseFunc &FuseFunc::removexattr = FuseFunc::fusefuncs[FuseFunc::Enum::removexattr]; const FuseFunc &FuseFunc::rmdir = FuseFunc::fusefuncs[FuseFunc::Enum::rmdir]; const FuseFunc &FuseFunc::setxattr = FuseFunc::fusefuncs[FuseFunc::Enum::setxattr]; const FuseFunc &FuseFunc::symlink = FuseFunc::fusefuncs[FuseFunc::Enum::symlink]; const FuseFunc &FuseFunc::truncate = FuseFunc::fusefuncs[FuseFunc::Enum::truncate]; const FuseFunc &FuseFunc::unlink = FuseFunc::fusefuncs[FuseFunc::Enum::unlink]; const FuseFunc &FuseFunc::utimens = FuseFunc::fusefuncs[FuseFunc::Enum::utimens]; const FuseFunc& FuseFunc::find(const std::string &str) { for(int i = Enum::BEGIN; i != Enum::END; ++i) { if(fusefuncs[i] == str) return fusefuncs[i]; } return invalid; } const FuseFunc& FuseFunc::find(const FuseFunc::Enum::Type i) { if(i >= FuseFunc::Enum::BEGIN && i < FuseFunc::Enum::END) return fusefuncs[i]; return invalid; } } mergerfs-2.21.0/src/flush.cpp0000664000175000017500000000243013101724730014431 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include "errno.hpp" #include "fileinfo.hpp" #include "fs_base_close.hpp" #include "fs_base_dup.hpp" static int _flush(const int fd) { int rv; rv = fs::dup(fd); if(rv == -1) errno = EIO; else rv = fs::close(rv); return ((rv == -1) ? -errno : 0); } namespace mergerfs { namespace fuse { int flush(const char *fusepath, fuse_file_info *ffi) { FileInfo *fi = reinterpret_cast(ffi->fh); return ::_flush(fi->fd); } } } mergerfs-2.21.0/src/fs_base_fallocate_osx.icpp0000664000175000017500000000275113101724730017774 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include "errno.hpp" static int _fallocate_core(const int fd, const off_t offset, const off_t len) { int rv; fstore_t store = {F_ALLOCATECONTIG,F_PEOFPOSMODE,offset,len,0}; rv = ::fcntl(fd,F_PREALLOCATE,&store); if(rv == -1) { store.fst_flags = F_ALLOCATEALL; rv = ::fcntl(fd,F_PREALLOCATE,&store); } if(rv == -1) return rv; return ::ftruncate(fd,(offset+len)); } namespace fs { int fallocate(const int fd, const int mode, const off_t offset, const off_t len) { if(mode) return (errno=EOPNOTSUPP,-1); return ::_fallocate_core(fd,offset,len); } } mergerfs-2.21.0/src/fs_base_fallocate_linux.icpp0000664000175000017500000000200113101724730020306 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include "errno.hpp" namespace fs { int fallocate(const int fd, const int mode, const off_t offset, const off_t len) { return ::fallocate(fd,mode,offset,len); } } mergerfs-2.21.0/src/fs_base_stat.hpp0000664000175000017500000000405313072271045015760 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_STAT_HPP__ #define __FS_BASE_STAT_HPP__ #include #include #include #include namespace fs { static inline int stat(const char *path, struct stat &st) { return ::stat(path,&st); } static inline int stat(const std::string &path, struct stat &st) { return fs::stat(path.c_str(),st); } static inline int lstat(const std::string &path, struct stat &st) { return ::lstat(path.c_str(),&st); } static inline int fstat(const int fd, struct stat &st) { return ::fstat(fd,&st); } static inline timespec * stat_atime(struct stat &st) { #if __APPLE__ return &st.st_atimespec; #else return &st.st_atim; #endif } static inline const timespec * stat_atime(const struct stat &st) { #if __APPLE__ return &st.st_atimespec; #else return &st.st_atim; #endif } static inline timespec * stat_mtime(struct stat &st) { #if __APPLE__ return &st.st_mtimespec; #else return &st.st_mtim; #endif } static inline const timespec * stat_mtime(const struct stat &st) { #if __APPLE__ return &st.st_mtimespec; #else return &st.st_mtim; #endif } } #endif mergerfs-2.21.0/src/fs_base_close.hpp0000664000175000017500000000173513040040376016112 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_CLOSE_HPP__ #define __FS_BASE_CLOSE_HPP__ #include namespace fs { static inline int close(const int fd) { return ::close(fd); } } #endif mergerfs-2.21.0/src/fs_base_closedir.hpp0000664000175000017500000000177713040040376016617 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_CLOSEDIR_HPP__ #define __FS_BASE_CLOSEDIR_HPP__ #include #include namespace fs { static inline int closedir(DIR *dirp) { return ::closedir(dirp); } } #endif mergerfs-2.21.0/src/policy_eplfs.cpp0000664000175000017500000000730013101725025015777 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include "errno.hpp" #include "fs.hpp" #include "fs_path.hpp" #include "policy.hpp" using std::string; using std::vector; using mergerfs::Category; static int _eplfs_create(const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { string fullpath; uint64_t eplfs; const string *eplfsbasepath; eplfs = std::numeric_limits::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); if(!fs::exists(fullpath)) continue; if(!fs::info(*basepath,readonly,spaceavail,_spaceused)) continue; if(readonly) continue; if(spaceavail < minfreespace) continue; if(spaceavail > eplfs) continue; eplfs = spaceavail; eplfsbasepath = basepath; } if(eplfsbasepath == NULL) return POLICY_FAIL_ENOENT; paths.push_back(eplfsbasepath); return POLICY_SUCCESS; } static int _eplfs_other(const vector &basepaths, const char *fusepath, vector &paths) { string fullpath; uint64_t eplfs; const string *eplfsbasepath; eplfs = std::numeric_limits::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); if(!fs::exists(fullpath)) continue; if(!fs::spaceavail(*basepath,spaceavail)) continue; if(spaceavail > eplfs) continue; eplfs = spaceavail; eplfsbasepath = basepath; } if(eplfsbasepath == NULL) return POLICY_FAIL_ENOENT; paths.push_back(eplfsbasepath); return POLICY_SUCCESS; } static int _eplfs(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { if(type == Category::Enum::create) return _eplfs_create(basepaths,fusepath,minfreespace,paths); return _eplfs_other(basepaths,fusepath,paths); } namespace mergerfs { int Policy::Func::eplfs(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { int rv; rv = _eplfs(type,basepaths,fusepath,minfreespace,paths); if(POLICY_FAILED(rv)) rv = Policy::Func::lfs(type,basepaths,fusepath,minfreespace,paths); return rv; } } mergerfs-2.21.0/src/chown.hpp0000664000175000017500000000173113040040376014435 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __CHOWN_HPP__ #define __CHOWN_HPP__ namespace mergerfs { namespace fuse { int chown(const char *fusepath, uid_t uid, gid_t gid); } } #endif mergerfs-2.21.0/src/category.hpp0000664000175000017500000000443013003720476015140 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __CATEGORY_HPP__ #define __CATEGORY_HPP__ #include #include namespace mergerfs { class Category { public: struct Enum { enum Type { invalid = -1, BEGIN = 0, action = BEGIN, create, search, END }; }; private: Enum::Type _enum; std::string _str; public: Category() : _enum(invalid), _str(invalid) { } Category(const Enum::Type enum_, const std::string &str_) : _enum(enum_), _str(str_) { } public: operator const Enum::Type() const { return _enum; } operator const std::string&() const { return _str; } operator const Category*() const { return this; } bool operator==(const std::string &str_) const { return _str == str_; } bool operator==(const Enum::Type enum_) const { return _enum == enum_; } bool operator!=(const Category &r) const { return _enum != r._enum; } bool operator<(const Category &r) const { return _enum < r._enum; } public: static const Category &find(const std::string&); static const Category &find(const Enum::Type); public: static const std::vector _categories_; static const Category * const categories; static const Category &invalid; static const Category &action; static const Category &create; static const Category &search; }; } #endif mergerfs-2.21.0/src/open.cpp0000664000175000017500000000463513101724730014262 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include "config.hpp" #include "errno.hpp" #include "fileinfo.hpp" #include "fs_base_open.hpp" #include "fs_path.hpp" #include "rwlock.hpp" #include "ugid.hpp" using std::string; using std::vector; using mergerfs::Policy; static int _open_core(const string *basepath, const char *fusepath, const int flags, uint64_t &fh) { int fd; string fullpath; fs::path::make(basepath,fusepath,fullpath); fd = fs::open(fullpath,flags); if(fd == -1) return -errno; fh = reinterpret_cast(new FileInfo(fd,fusepath)); return 0; } static int _open(Policy::Func::Search searchFunc, const vector &srcmounts, const uint64_t minfreespace, const char *fusepath, const int flags, uint64_t &fh) { int rv; vector basepaths; rv = searchFunc(srcmounts,fusepath,minfreespace,basepaths); if(rv == -1) return -errno; return _open_core(basepaths[0],fusepath,flags,fh); } namespace mergerfs { namespace fuse { int open(const char *fusepath, fuse_file_info *ffi) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); return _open(config.open, config.srcmounts, config.minfreespace, fusepath, ffi->flags, ffi->fh); } } } mergerfs-2.21.0/src/rmdir.cpp0000664000175000017500000000467013040040376014434 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include "config.hpp" #include "errno.hpp" #include "fs_base_rmdir.hpp" #include "fs_path.hpp" #include "rv.hpp" #include "rwlock.hpp" #include "ugid.hpp" using std::string; using std::vector; using mergerfs::Policy; static int _rmdir_loop_core(const string *basepath, const char *fusepath, const int error) { int rv; string fullpath; fs::path::make(basepath,fusepath,fullpath); rv = fs::rmdir(fullpath); return error::calc(rv,error,errno); } static int _rmdir_loop(const vector &basepaths, const char *fusepath) { int error; error = -1; for(size_t i = 0, ei = basepaths.size(); i != ei; i++) { error = _rmdir_loop_core(basepaths[i],fusepath,error); } return -error; } static int _rmdir(Policy::Func::Action actionFunc, const vector &srcmounts, const uint64_t minfreespace, const char *fusepath) { int rv; vector basepaths; rv = actionFunc(srcmounts,fusepath,minfreespace,basepaths); if(rv == -1) return -errno; return _rmdir_loop(basepaths,fusepath); } namespace mergerfs { namespace fuse { int rmdir(const char *fusepath) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readguard(&config.srcmountslock); return _rmdir(config.rmdir, config.srcmounts, config.minfreespace, fusepath); } } } mergerfs-2.21.0/src/fs_sendfile_linux.icpp0000664000175000017500000000201513035712542017164 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include "errno.hpp" namespace fs { ssize_t sendfile(const int fdin, const int fdout, const size_t count) { off_t offset = 0; return ::sendfile(fdout,fdin,&offset,count); } } mergerfs-2.21.0/src/xattr.hpp0000664000175000017500000000175713101724730014472 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __XATTR_HPP__ #define __XATTR_HPP__ #ifndef WITHOUT_XATTR #include #endif #ifndef XATTR_CREATE # define XATTR_CREATE 0x1 #endif #ifndef XATTR_REPLACE # define XATTR_REPLACE 0x2 #endif #endif mergerfs-2.21.0/src/fs_base_readlink.hpp0000664000175000017500000000214513071441761016601 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_READLINK_HPP__ #define __FS_BASE_READLINK_HPP__ #include #include namespace fs { static inline int readlink(const std::string &path, char *buf, const size_t bufsiz) { return ::readlink(path.c_str(),buf,bufsiz); } } #endif mergerfs-2.21.0/src/policy_rand.cpp0000664000175000017500000000270013101725025015611 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include "errno.hpp" #include "policy.hpp" #include "success_fail.hpp" using std::string; using std::vector; namespace mergerfs { int Policy::Func::rand(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { int rv; rv = Policy::Func::all(type,basepaths,fusepath,minfreespace,paths); if(POLICY_SUCCEEDED(rv)) std::random_shuffle(paths.begin(),paths.end()); return rv; } } mergerfs-2.21.0/src/getattr.hpp0000664000175000017500000000201213040040376014762 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __GETATTR_HPP__ #define __GETATTR_HPP__ #include #include #include namespace mergerfs { namespace fuse { int getattr(const char *fusepath, struct stat *buf); } } #endif mergerfs-2.21.0/src/access.hpp0000664000175000017500000000170313040040376014557 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __ACCESS_HPP__ #define __ACCESS_HPP__ namespace mergerfs { namespace fuse { int access(const char *fusepath, int mask); } } #endif mergerfs-2.21.0/src/ftruncate.hpp0000664000175000017500000000207013040040376015307 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FTRUNCATE_HPP__ #define __FTRUNCATE_HPP__ #include #include #include namespace mergerfs { namespace fuse { int ftruncate(const char *fusepath, off_t size, fuse_file_info *fi); } } #endif mergerfs-2.21.0/src/opendir.hpp0000664000175000017500000000174113040040376014760 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __OPENDIR_HPP__ #define __OPENDIR_HPP__ #include namespace mergerfs { namespace fuse { int opendir(const char *fusepath, fuse_file_info *ffi); } } #endif mergerfs-2.21.0/src/fs_base_readdir.hpp0000664000175000017500000000176013040040376016415 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_READDIR_HPP__ #define __FS_BASE_READDIR_HPP__ #include namespace fs { static inline struct dirent * readdir(DIR *dirp) { return ::readdir(dirp); } } #endif mergerfs-2.21.0/src/policy.cpp0000664000175000017500000000477313101725025014621 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include "buildvector.hpp" #include "fs.hpp" #include "policy.hpp" #define POLICY(X,PP) (Policy(Policy::Enum::X,#X,Policy::Func::X,PP)) #define PRESERVES_PATH true #define DOESNT_PRESERVE_PATH false namespace mergerfs { const std::vector Policy::_policies_ = buildvector (POLICY(invalid,DOESNT_PRESERVE_PATH)) (POLICY(all,DOESNT_PRESERVE_PATH)) (POLICY(epall,PRESERVES_PATH)) (POLICY(epff,PRESERVES_PATH)) (POLICY(eplfs,PRESERVES_PATH)) (POLICY(eplus,PRESERVES_PATH)) (POLICY(epmfs,PRESERVES_PATH)) (POLICY(eprand,PRESERVES_PATH)) (POLICY(erofs,DOESNT_PRESERVE_PATH)) (POLICY(ff,DOESNT_PRESERVE_PATH)) (POLICY(lfs,DOESNT_PRESERVE_PATH)) (POLICY(lus,DOESNT_PRESERVE_PATH)) (POLICY(mfs,DOESNT_PRESERVE_PATH)) (POLICY(newest,DOESNT_PRESERVE_PATH)) (POLICY(rand,DOESNT_PRESERVE_PATH)); const Policy * const Policy::policies = &_policies_[1]; #define CONST_POLICY(X) const Policy &Policy::X = Policy::policies[Policy::Enum::X] CONST_POLICY(invalid); CONST_POLICY(all); CONST_POLICY(epall); CONST_POLICY(epff); CONST_POLICY(eplfs); CONST_POLICY(eplus); CONST_POLICY(epmfs); CONST_POLICY(eprand); CONST_POLICY(erofs); CONST_POLICY(ff); CONST_POLICY(lfs); CONST_POLICY(lus); CONST_POLICY(mfs); CONST_POLICY(newest); CONST_POLICY(rand); const Policy& Policy::find(const std::string &str) { for(int i = Enum::BEGIN; i != Enum::END; ++i) { if(policies[i] == str) return policies[i]; } return invalid; } const Policy& Policy::find(const Policy::Enum::Type i) { if(i >= Policy::Enum::BEGIN && i < Policy::Enum::END) return policies[i]; return invalid; } } mergerfs-2.21.0/src/ugid_rwlock.icpp0000664000175000017500000000254613035712542016006 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include namespace mergerfs { namespace ugid { uid_t currentuid; gid_t currentgid; pthread_rwlock_t rwlock; void init() { pthread_rwlockattr_t attr; pthread_rwlockattr_init(&attr); # if defined PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP pthread_rwlockattr_setkind_np(&attr,PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); # endif pthread_rwlock_init(&rwlock,&attr); currentuid = ::geteuid(); currentgid = ::getegid(); } } } mergerfs-2.21.0/src/category.cpp0000664000175000017500000000363713003720476015143 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include "category.hpp" #include "buildvector.hpp" #define CATEGORY(X) Category(Category::Enum::X,#X) namespace mergerfs { const std::vector Category::_categories_ = buildvector (CATEGORY(invalid)) (CATEGORY(action)) (CATEGORY(create)) (CATEGORY(search)); const Category * const Category::categories = &_categories_[1]; const Category &Category::invalid = Category::categories[Category::Enum::invalid]; const Category &Category::action = Category::categories[Category::Enum::action]; const Category &Category::create = Category::categories[Category::Enum::create]; const Category &Category::search = Category::categories[Category::Enum::search]; const Category& Category::find(const std::string &str) { for(int i = Enum::BEGIN; i != Enum::END; ++i) { if(categories[i] == str) return categories[i]; } return invalid; } const Category& Category::find(const Category::Enum::Type i) { if(i >= Category::Enum::BEGIN && i < Category::Enum::END) return categories[i]; return invalid; } } mergerfs-2.21.0/src/ugid_linux.hpp0000664000175000017500000000423413040040376015467 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __UGID_LINUX_HPP__ #define __UGID_LINUX_HPP__ #include #include #include #include #include #include #include #include namespace mergerfs { namespace ugid { extern __thread uid_t currentuid; extern __thread gid_t currentgid; extern __thread bool initialized; struct Set { Set(const uid_t newuid, const gid_t newgid) { if(!initialized) { currentuid = ::syscall(SYS_geteuid); currentgid = ::syscall(SYS_getegid); initialized = true; } if(newuid == currentuid && newgid == currentgid) return; if(currentuid != 0) { ::syscall(SYS_setreuid,-1,0); ::syscall(SYS_setregid,-1,0); } if(newgid) { ::syscall(SYS_setregid,-1,newgid); initgroups(newuid,newgid); } if(newuid) ::syscall(SYS_setreuid,-1,newuid); currentuid = newuid; currentgid = newgid; } }; struct SetRootGuard { SetRootGuard() : prevuid(currentuid), prevgid(currentgid) { Set(0,0); } ~SetRootGuard() { Set(prevuid,prevgid); } const uid_t prevuid; const gid_t prevgid; }; } } #endif mergerfs-2.21.0/src/read.hpp0000664000175000017500000000237313040040376014235 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __READ_HPP__ #define __READ_HPP__ namespace mergerfs { namespace fuse { int read(const char *fusepath, char *buf, size_t count, off_t offset, fuse_file_info *fi); int read_direct_io(const char *fusepath, char *buf, size_t count, off_t offset, fuse_file_info *fi); } } #endif mergerfs-2.21.0/src/fs_base_chmod.hpp0000664000175000017500000000442113072271026016075 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_CHMOD_HPP__ #define __FS_BASE_CHMOD_HPP__ #include #include "fs_base_stat.hpp" #define MODE_BITS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) namespace fs { static inline int chmod(const std::string &path, const mode_t mode) { return ::chmod(path.c_str(),mode); } static inline int fchmod(const int fd, const mode_t mode) { return ::fchmod(fd,mode); } static inline int fchmod(const int fd, const struct stat &st) { return ::fchmod(fd,st.st_mode); } static inline int chmod_check_on_error(const std::string &path, const mode_t mode) { int rv; rv = fs::chmod(path,mode); if(rv == -1) { int error; struct stat st; error = errno; rv = fs::stat(path,st); if(rv == -1) return -1; if((st.st_mode & MODE_BITS) != (mode & MODE_BITS)) return (errno=error,-1); } return 0; } static inline int fchmod_check_on_error(const int fd, const struct stat &st) { int rv; rv = fs::fchmod(fd,st); if(rv == -1) { int error; struct stat tmpst; error = errno; rv = fs::fstat(fd,tmpst); if(rv == -1) return -1; if((st.st_mode & MODE_BITS) != (tmpst.st_mode & MODE_BITS)) return (errno=error,-1); } return 0; } } #endif mergerfs-2.21.0/src/fs_acl.hpp0000664000175000017500000000163413037445067014564 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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 namespace fs { namespace acl { bool dir_has_defaults(const std::string &fullpath); } } mergerfs-2.21.0/src/fs_base_utime_utimensat.hpp0000664000175000017500000000251113040040376020212 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_UTIME_UTIMENSAT_HPP__ #define __FS_BASE_UTIME_UTIMENSAT_HPP__ #include #include #include namespace fs { static inline int utime(const int dirfd, const std::string &path, const struct timespec times[2], const int flags) { return ::utimensat(dirfd,path.c_str(),times,flags); } static inline int utime(const int fd, const struct timespec times[2]) { return ::futimens(fd,times); } } #endif mergerfs-2.21.0/src/policy_ff.cpp0000664000175000017500000000516413101725025015267 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include "errno.hpp" #include "fs.hpp" #include "fs_path.hpp" #include "policy.hpp" using std::string; using std::vector; static int _ff_create(const vector &basepaths, const uint64_t minfreespace, vector &paths) { 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]; if(!fs::info(*basepath,readonly,spaceavail,_spaceused)) continue; if(readonly) continue; if(fallback == NULL) fallback = basepath; if(spaceavail < minfreespace) continue; paths.push_back(basepath); return POLICY_SUCCESS; } if(fallback == NULL) return POLICY_FAIL_ENOENT; paths.push_back(fallback); return POLICY_SUCCESS; } static int _ff_other(const vector &basepaths, const char *fusepath, vector &paths) { string fullpath; for(size_t i = 0, ei = basepaths.size(); i != ei; i++) { const string *basepath = &basepaths[i]; fs::path::make(basepath,fusepath,fullpath); if(!fs::exists(fullpath)) continue; paths.push_back(basepath); return POLICY_SUCCESS; } return POLICY_FAIL_ENOENT; } namespace mergerfs { int Policy::Func::ff(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { if(type == Category::Enum::create) return _ff_create(basepaths,minfreespace,paths); return _ff_other(basepaths,fusepath,paths); } } mergerfs-2.21.0/src/fs_base_realpath.hpp0000664000175000017500000000231713040040376016602 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_REALPATH_HPP__ #define __FS_BASE_REALPATH_HPP__ #include #include #include namespace fs { static inline char * realpath(const std::string &path, char *resolved_path) { return ::realpath(path.c_str(),resolved_path); } static inline char * realpath(const std::string &path) { return fs::realpath(path,NULL); } } #endif mergerfs-2.21.0/src/resources.hpp0000664000175000017500000000207113040040376015327 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __RESOURCES_HPP__ #define __RESOURCES_HPP__ namespace mergerfs { namespace resources { int reset_umask(void); int maxout_rlimit(const int resource); int maxout_rlimit_nofile(void); int maxout_rlimit_fsize(void); int setpriority(const int prio); } } #endif mergerfs-2.21.0/src/#fs_inode.hpp#0000664000175000017500000000210413072022143015203 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_INODE_HPP__ #define __FS_INODE_HPP__ #include namespace fs { namespace inode { enum { MAGIC = 0x7472617065786974 }; inline void recompute(struct stat &st) { st.st_ino |= (st.st_dev << 32); } } } #endif mergerfs-2.21.0/src/dirinfo.hpp0000664000175000017500000000174013101724730014752 0ustar bilebile/* Copyright (c) 2017, Antonio SJ Musumeci 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. */ #ifndef __DIRINFO_HPP__ #define __DIRINFO_HPP__ #include class DirInfo { public: DirInfo(const char *fusepath_) : fusepath(fusepath_) { } public: std::string fusepath; }; #endif mergerfs-2.21.0/src/fs_clonefile.hpp0000664000175000017500000000201713040040376015745 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_CLONEFILE_HPP__ #define __FS_CLONEFILE_HPP__ #include namespace fs { int clonefile(const int fdin, const int fdout); int clonefile(const std::string &from, const std::string &to); } #endif mergerfs-2.21.0/src/rmdir.hpp0000664000175000017500000000164313040040376014436 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __RMDIR_HPP__ #define __RMDIR_HPP__ namespace mergerfs { namespace fuse { int rmdir(const char *fusepath); } } #endif mergerfs-2.21.0/src/readlink.hpp0000664000175000017500000000175113040040376015112 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __READLINK_HPP__ #define __READLINK_HPP__ namespace mergerfs { namespace fuse { int readlink(const char *fusepath, char *buf, size_t size); } } #endif mergerfs-2.21.0/src/policy_epmfs.cpp0000664000175000017500000000723613101725025016010 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include "errno.hpp" #include "fs.hpp" #include "fs_path.hpp" #include "policy.hpp" using std::string; using std::vector; using mergerfs::Category; static int _epmfs_create(const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { string fullpath; uint64_t epmfs; const string *epmfsbasepath; epmfs = std::numeric_limits::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); if(!fs::exists(fullpath)) continue; if(!fs::info(*basepath,readonly,spaceavail,_spaceused)) continue; if(readonly) continue; if(spaceavail < minfreespace) continue; if(spaceavail < epmfs) continue; epmfs = spaceavail; epmfsbasepath = basepath; } if(epmfsbasepath == NULL) return POLICY_FAIL_ENOENT; paths.push_back(epmfsbasepath); return POLICY_SUCCESS; } static int _epmfs_other(const vector &basepaths, const char *fusepath, vector &paths) { string fullpath; uint64_t epmfs; 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); if(!fs::exists(fullpath)) continue; if(!fs::spaceavail(*basepath,spaceavail)) continue; if(spaceavail < epmfs) continue; epmfs = spaceavail; epmfsbasepath = basepath; } if(epmfsbasepath == NULL) return POLICY_FAIL_ENOENT; paths.push_back(epmfsbasepath); return POLICY_SUCCESS; } static int _epmfs(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { if(type == Category::Enum::create) return _epmfs_create(basepaths,fusepath,minfreespace,paths); return _epmfs_other(basepaths,fusepath,paths); } namespace mergerfs { int Policy::Func::epmfs(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { int rv; rv = _epmfs(type,basepaths,fusepath,minfreespace,paths); if(POLICY_FAILED(rv)) rv = Policy::Func::mfs(type,basepaths,fusepath,minfreespace,paths); return rv; } } mergerfs-2.21.0/src/fs_sendfile.hpp0000664000175000017500000000174513035712542015612 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_SENDFILE_HPP__ #define __FS_SENDFILE_HPP__ namespace fs { ssize_t sendfile(const int fdin, const int fdout, const size_t count); } #endif // __FS_SENDFILE_HPP__ mergerfs-2.21.0/src/fs_path.hpp0000664000175000017500000000246113035712526014753 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_PATH_HPP__ #define __FS_PATH_HPP__ #include #include namespace fs { namespace path { using std::string; void dirname(string &path); string basename(const string &path); inline void append(string &base, const char *suffix) { base += suffix; } inline void make(const string *base, const char *suffix, string &output) { output = *base; output += suffix; } } }; #endif // __FS_PATH_HPP__ mergerfs-2.21.0/src/mknod.hpp0000664000175000017500000000173413040040376014432 0ustar bilebile /* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __MKNOD_HPP__ #define __MKNOD_HPP__ namespace mergerfs { namespace fuse { int mknod(const char *fusepath, mode_t mode, dev_t rdev); } } #endif mergerfs-2.21.0/src/ftruncate.cpp0000664000175000017500000000244513101724730015311 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include "errno.hpp" #include "fileinfo.hpp" #include "fs_base_ftruncate.hpp" static int _ftruncate(const int fd, const off_t size) { int rv; rv = fs::ftruncate(fd,size); return ((rv == -1) ? -errno : 0); } namespace mergerfs { namespace fuse { int ftruncate(const char *fusepath, off_t size, fuse_file_info *ffi) { FileInfo *fi = reinterpret_cast(ffi->fh); return ::_ftruncate(fi->fd,size); } } } mergerfs-2.21.0/src/fs_base_rename.hpp0000664000175000017500000000206013040040376016244 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_RENAME_HPP__ #define __FS_BASE_RENAME_HPP__ #include namespace fs { static inline int rename(const std::string &oldpath, const std::string &newpath) { return ::rename(oldpath.c_str(),newpath.c_str()); } } #endif mergerfs-2.21.0/src/policy_invalid.cpp0000664000175000017500000000241413101725025016315 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include "errno.hpp" #include "policy.hpp" using std::string; using std::vector; namespace mergerfs { int Policy::Func::invalid(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { return POLICY_FAIL_ERRNO(EINVAL); } } mergerfs-2.21.0/src/fs_base_setxattr.hpp0000664000175000017500000000243413101724730016661 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_SETXATTR_HPP__ #define __FS_BASE_SETXATTR_HPP__ #include #include "errno.hpp" #include "xattr.hpp" namespace fs { static inline int lsetxattr(const std::string &path, const char *name, const void *value, const size_t size, const int flags) { #ifndef WITHOUT_XATTR return ::lsetxattr(path.c_str(),name,value,size,flags); #else return (errno=ENOTSUP,-1); #endif } } #endif mergerfs-2.21.0/src/destroy.cpp0000664000175000017500000000155713003720476015016 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ namespace mergerfs { namespace fuse { void destroy(void *) { } } } mergerfs-2.21.0/src/init.hpp0000664000175000017500000000164313040040376014264 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __INIT_HPP__ #define __INIT_HPP__ namespace mergerfs { namespace fuse { void * init(fuse_conn_info *conn); } } #endif mergerfs-2.21.0/src/statfs.cpp0000664000175000017500000001004113037445067014624 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include #include #include "config.hpp" #include "errno.hpp" #include "fs_base_stat.hpp" #include "fs_base_statvfs.hpp" #include "rwlock.hpp" #include "success_fail.hpp" #include "ugid.hpp" using std::string; using std::map; using std::vector; static void _normalize_statvfs(struct statvfs *fsstat, const unsigned long min_bsize, const unsigned long min_frsize, const unsigned long min_namemax) { fsstat->f_blocks = (fsblkcnt_t)((fsstat->f_blocks * fsstat->f_frsize) / min_frsize); fsstat->f_bfree = (fsblkcnt_t)((fsstat->f_bfree * fsstat->f_frsize) / min_frsize); fsstat->f_bavail = (fsblkcnt_t)((fsstat->f_bavail * fsstat->f_frsize) / min_frsize); fsstat->f_bsize = min_bsize; fsstat->f_frsize = min_frsize; fsstat->f_namemax = min_namemax; } static void _merge_statvfs(struct statvfs * const out, const struct statvfs * const in) { out->f_blocks += in->f_blocks; out->f_bfree += in->f_bfree; out->f_bavail += in->f_bavail; out->f_files += in->f_files; out->f_ffree += in->f_ffree; out->f_favail += in->f_favail; } static void _statfs_core(const char *srcmount, unsigned long &min_bsize, unsigned long &min_frsize, unsigned long &min_namemax, map &fsstats) { int rv; struct stat st; struct statvfs fsstat; rv = fs::statvfs(srcmount,fsstat); if(STATVFS_FAILED(rv)) return; rv = fs::stat(srcmount,st); if(STAT_FAILED(rv)) return; if(fsstat.f_bsize && (min_bsize > fsstat.f_bsize)) min_bsize = fsstat.f_bsize; if(fsstat.f_frsize && (min_frsize > fsstat.f_frsize)) min_frsize = fsstat.f_frsize; if(fsstat.f_namemax && (min_namemax > fsstat.f_namemax)) min_namemax = fsstat.f_namemax; fsstats.insert(std::make_pair(st.st_dev,fsstat)); } static int _statfs(const vector &srcmounts, struct statvfs &fsstat) { map fsstats; unsigned long min_bsize = ULONG_MAX; unsigned long min_frsize = ULONG_MAX; unsigned long min_namemax = ULONG_MAX; for(size_t i = 0, ei = srcmounts.size(); i < ei; i++) { _statfs_core(srcmounts[i].c_str(),min_bsize,min_frsize,min_namemax,fsstats); } map::iterator iter = fsstats.begin(); map::iterator enditer = fsstats.end(); if(iter != enditer) { fsstat = iter->second; _normalize_statvfs(&fsstat,min_bsize,min_frsize,min_namemax); for(++iter; iter != enditer; ++iter) { _normalize_statvfs(&iter->second,min_bsize,min_frsize,min_namemax); _merge_statvfs(&fsstat,&iter->second); } } return 0; } namespace mergerfs { namespace fuse { int statfs(const char *fusepath, struct statvfs *stat) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); return _statfs(config.srcmounts, *stat); } } } mergerfs-2.21.0/src/fs_base_mkdir.hpp0000664000175000017500000000210413040040376016102 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_MKDIR_HPP__ #define __FS_BASE_MKDIR_HPP__ #include #include #include namespace fs { static inline int mkdir(const std::string &path, const mode_t mode) { return ::mkdir(path.c_str(),mode); } } #endif mergerfs-2.21.0/src/fs_base_opendir.hpp0000664000175000017500000000204613040040376016441 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_OPENDIR_HPP__ #define __FS_BASE_OPENDIR_HPP__ #include #include #include namespace fs { static inline DIR * opendir(const std::string &name) { return ::opendir(name.c_str()); } } #endif mergerfs-2.21.0/src/ugid_linux.icpp0000664000175000017500000000210213035712542015630 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include namespace mergerfs { namespace ugid { __thread uid_t currentuid = 0; __thread gid_t currentgid = 0; __thread bool initialized = false; void init() { } } } mergerfs-2.21.0/src/fs_base_open.hpp0000664000175000017500000000240213040040376015736 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_OPEN_HPP__ #define __FS_BASE_OPEN_HPP__ #include #include #include #include namespace fs { static inline int open(const std::string &path, const int flags) { return ::open(path.c_str(),flags); } static inline int open(const std::string &path, const int flags, const mode_t mode) { return ::open(path.c_str(),flags,mode); } } #endif mergerfs-2.21.0/src/fs_base_utime_generic.hpp0000664000175000017500000001521413101724730017622 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_UTIME_GENERIC_HPP__ #define __FS_BASE_UTIME_GENERIC_HPP__ #include #include #include #include #include "fs_base_futimesat.hpp" #include "fs_base_stat.hpp" #ifndef UTIME_NOW # define UTIME_NOW ((1l << 30) - 1l) #endif #ifndef UTIME_OMIT # define UTIME_OMIT ((1l << 30) - 2l) #endif static inline bool _can_call_lutimes(const int dirfd, const std::string &path, const int flags) { return ((flags == AT_SYMLINK_NOFOLLOW) && ((dirfd == AT_FDCWD) || (path[0] == '/'))); } static inline bool _should_ignore(const struct timespec ts[2]) { return ((ts != NULL) && (ts[0].tv_nsec == UTIME_OMIT) && (ts[1].tv_nsec == UTIME_OMIT)); } static inline bool _should_be_set_to_now(const struct timespec ts[2]) { return ((ts == NULL) || ((ts[0].tv_nsec == UTIME_NOW) && (ts[1].tv_nsec == UTIME_NOW))); } static inline bool _timespec_invalid(const struct timespec &ts) { return (((ts.tv_nsec < 0) || (ts.tv_nsec > 999999999)) && ((ts.tv_nsec != UTIME_NOW) && (ts.tv_nsec != UTIME_OMIT))); } static inline bool _timespec_invalid(const struct timespec ts[2]) { return ((ts != NULL) && (_timespec_invalid(ts[0]) || _timespec_invalid(ts[1]))); } static inline bool _flags_invalid(const int flags) { return ((flags & ~AT_SYMLINK_NOFOLLOW) != 0); } static inline bool _any_timespec_is_utime_omit(const struct timespec ts[2]) { return ((ts[0].tv_nsec == UTIME_OMIT) || (ts[1].tv_nsec == UTIME_OMIT)); } static inline bool _any_timespec_is_utime_now(const struct timespec ts[2]) { return ((ts[0].tv_nsec == UTIME_NOW) || (ts[1].tv_nsec == UTIME_NOW)); } static inline int _set_utime_omit_to_current_value(const int dirfd, const std::string &path, const struct timespec ts[2], struct timeval tv[2], const int flags) { int rv; struct stat st; timespec *atime; timespec *mtime; if(!_any_timespec_is_utime_omit(ts)) return 0; rv = ::fstatat(dirfd,path.c_str(),&st,flags); if(rv == -1) return -1; atime = fs::stat_atime(st); mtime = fs::stat_mtime(st); if(ts[0].tv_nsec == UTIME_OMIT) TIMESPEC_TO_TIMEVAL(&tv[0],atime); if(ts[1].tv_nsec == UTIME_OMIT) TIMESPEC_TO_TIMEVAL(&tv[1],mtime); return 0; } static inline int _set_utime_omit_to_current_value(const int fd, const struct timespec ts[2], struct timeval tv[2]) { int rv; struct stat st; timespec *atime; timespec *mtime; if(!_any_timespec_is_utime_omit(ts)) return 0; rv = ::fstat(fd,&st); if(rv == -1) return -1; atime = fs::stat_atime(st); mtime = fs::stat_mtime(st); if(ts[0].tv_nsec == UTIME_OMIT) TIMESPEC_TO_TIMEVAL(&tv[0],atime); if(ts[1].tv_nsec == UTIME_OMIT) TIMESPEC_TO_TIMEVAL(&tv[1],mtime); return 0; } static inline int _set_utime_now_to_now(const struct timespec ts[2], struct timeval tv[2]) { int rv; struct timeval now; if(_any_timespec_is_utime_now(ts)) return 0; rv = ::gettimeofday(&now,NULL); if(rv == -1) return -1; if(ts[0].tv_nsec == UTIME_NOW) tv[0] = now; if(ts[1].tv_nsec == UTIME_NOW) tv[1] = now; return 0; } static inline int _convert_timespec_to_timeval(const int dirfd, const std::string &path, const struct timespec ts[2], struct timeval tv[2], struct timeval *&tvp, const int flags) { int rv; if(_should_be_set_to_now(ts)) return (tvp=NULL,0); TIMESPEC_TO_TIMEVAL(&tv[0],&ts[0]); TIMESPEC_TO_TIMEVAL(&tv[1],&ts[1]); rv = _set_utime_omit_to_current_value(dirfd,path,ts,tv,flags); if(rv == -1) return -1; rv = _set_utime_now_to_now(ts,tv); if(rv == -1) return -1; return (tvp=tv,0); } static inline int _convert_timespec_to_timeval(const int fd, const struct timespec ts[2], struct timeval tv[2], struct timeval *&tvp) { int rv; if(_should_be_set_to_now(ts)) return (tvp=NULL,0); TIMESPEC_TO_TIMEVAL(&tv[0],&ts[0]); TIMESPEC_TO_TIMEVAL(&tv[1],&ts[1]); rv = _set_utime_omit_to_current_value(fd,ts,tv); if(rv == -1) return -1; rv = _set_utime_now_to_now(ts,tv); if(rv == -1) return -1; return (tvp=tv,0); } namespace fs { static inline int utime(const int dirfd, const std::string &path, const struct timespec ts[2], const int flags) { int rv; struct timeval tv[2]; struct timeval *tvp; if(_flags_invalid(flags)) return (errno=EINVAL,-1); if(_timespec_invalid(ts)) return (errno=EINVAL,-1); if(_should_ignore(ts)) return 0; rv = _convert_timespec_to_timeval(dirfd,path,ts,tv,tvp,flags); if(rv == -1) return -1; if((flags & AT_SYMLINK_NOFOLLOW) == 0) return fs::futimesat(dirfd,path.c_str(),tvp); if(_can_call_lutimes(dirfd,path,flags)) return ::lutimes(path.c_str(),tvp); return (errno=ENOTSUP,-1); } static inline int utime(const int fd, const struct timespec ts[2]) { int rv; struct timeval tv[2]; struct timeval *tvp; if(_timespec_invalid(ts)) return (errno=EINVAL,-1); if(_should_ignore(ts)) return 0; rv = _convert_timespec_to_timeval(fd,ts,tv,tvp); if(rv == -1) return -1; return ::futimes(fd,tvp); } } #endif mergerfs-2.21.0/src/policy_all.cpp0000664000175000017500000000475613101725025015452 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include "errno.hpp" #include "fs.hpp" #include "fs_path.hpp" #include "policy.hpp" using std::string; using std::vector; static int _all_create(const vector &basepaths, const uint64_t minfreespace, vector &paths) { for(size_t i = 0, ei = basepaths.size(); i != ei; i++) { bool readonly; uint64_t spaceavail; uint64_t _spaceused; const string *basepath = &basepaths[i]; if(!fs::info(*basepath,readonly,spaceavail,_spaceused)) continue; if(readonly) continue; if(spaceavail < minfreespace) continue; paths.push_back(basepath); } if(paths.empty()) return POLICY_FAIL_ENOENT; return POLICY_SUCCESS; } static int _all_other(const vector &basepaths, const char *fusepath, vector &paths) { string fullpath; for(size_t i = 0, ei = basepaths.size(); i != ei; i++) { const string *basepath = &basepaths[i]; fs::path::make(basepath,fusepath,fullpath); if(!fs::exists(fullpath)) continue; paths.push_back(basepath); } if(paths.empty()) return POLICY_FAIL_ENOENT; return POLICY_SUCCESS; } namespace mergerfs { int Policy::Func::all(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { if(type == Category::Enum::create) return _all_create(basepaths,minfreespace,paths); return _all_other(basepaths,fusepath,paths); } } mergerfs-2.21.0/src/mergerfs.cpp0000664000175000017500000001222113103454507015125 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include "fs_path.hpp" #include "mergerfs.hpp" #include "option_parser.hpp" #include "resources.hpp" #include "access.hpp" #include "chmod.hpp" #include "chown.hpp" #include "create.hpp" #include "destroy.hpp" #include "fallocate.hpp" #include "fgetattr.hpp" #include "flock.hpp" #include "flush.hpp" #include "fsync.hpp" #include "fsyncdir.hpp" #include "ftruncate.hpp" #include "getattr.hpp" #include "getxattr.hpp" #include "init.hpp" #include "ioctl.hpp" #include "link.hpp" #include "listxattr.hpp" #include "mkdir.hpp" #include "mknod.hpp" #include "open.hpp" #include "opendir.hpp" #include "read.hpp" #include "read_buf.hpp" #include "readdir.hpp" #include "readlink.hpp" #include "release.hpp" #include "releasedir.hpp" #include "removexattr.hpp" #include "rename.hpp" #include "rmdir.hpp" #include "setxattr.hpp" #include "statfs.hpp" #include "symlink.hpp" #include "truncate.hpp" #include "unlink.hpp" #include "utimens.hpp" #include "write.hpp" #include "write_buf.hpp" namespace local { static void get_fuse_operations(struct fuse_operations &ops, const bool direct_io) { ops.flag_nullpath_ok = true; #if FLAG_NOPATH ops.flag_nopath = true; #endif #if FLAG_UTIME ops.flag_utime_omit_ok = true; #endif ops.access = mergerfs::fuse::access; ops.bmap = NULL; ops.chmod = mergerfs::fuse::chmod; ops.chown = mergerfs::fuse::chown; ops.create = mergerfs::fuse::create; ops.destroy = mergerfs::fuse::destroy; #if FALLOCATE ops.fallocate = mergerfs::fuse::fallocate; #endif ops.fgetattr = mergerfs::fuse::fgetattr; #if FLOCK ops.flock = mergerfs::fuse::flock; #endif ops.flush = mergerfs::fuse::flush; ops.fsync = mergerfs::fuse::fsync; ops.fsyncdir = mergerfs::fuse::fsyncdir; ops.ftruncate = mergerfs::fuse::ftruncate; ops.getattr = mergerfs::fuse::getattr; ops.getdir = NULL; /* deprecated; use readdir */ ops.getxattr = mergerfs::fuse::getxattr; ops.init = mergerfs::fuse::init; ops.ioctl = mergerfs::fuse::ioctl; ops.link = mergerfs::fuse::link; ops.listxattr = mergerfs::fuse::listxattr; ops.lock = NULL; ops.mkdir = mergerfs::fuse::mkdir; ops.mknod = mergerfs::fuse::mknod; ops.open = mergerfs::fuse::open; ops.opendir = mergerfs::fuse::opendir; ops.poll = NULL; ops.read = direct_io ? mergerfs::fuse::read_direct_io : mergerfs::fuse::read; #if READ_BUF ops.read_buf = mergerfs::fuse::read_buf; #endif ops.readdir = mergerfs::fuse::readdir; ops.readlink = mergerfs::fuse::readlink; ops.release = mergerfs::fuse::release; ops.releasedir = mergerfs::fuse::releasedir; ops.removexattr = mergerfs::fuse::removexattr; ops.rename = mergerfs::fuse::rename; ops.rmdir = mergerfs::fuse::rmdir; ops.setxattr = mergerfs::fuse::setxattr; ops.statfs = mergerfs::fuse::statfs; ops.symlink = mergerfs::fuse::symlink; ops.truncate = mergerfs::fuse::truncate; ops.unlink = mergerfs::fuse::unlink; ops.utime = NULL; /* deprecated; use utimens() */ ops.utimens = mergerfs::fuse::utimens; ops.write = direct_io ? mergerfs::fuse::write_direct_io : mergerfs::fuse::write; #if WRITE_BUF ops.write_buf = mergerfs::fuse::write_buf; #endif return; } static void setup_resources(void) { const int prio = -10; std::srand(time(NULL)); mergerfs::resources::reset_umask(); mergerfs::resources::maxout_rlimit_nofile(); mergerfs::resources::maxout_rlimit_fsize(); mergerfs::resources::setpriority(prio); } } namespace mergerfs { int main(const int argc, char **argv) { fuse_args args; fuse_operations ops = {0}; Config config; args.argc = argc; args.argv = argv; args.allocated = 0; mergerfs::options::parse(args,config); local::setup_resources(); local::get_fuse_operations(ops,config.direct_io); return fuse_main(args.argc, args.argv, &ops, &config); } } int main(int argc, char **argv) { return mergerfs::main(argc,argv); } mergerfs-2.21.0/src/khash.h0000664000175000017500000005204613035712542014067 0ustar bilebile/* The MIT License Copyright (c) 2008, 2009, 2011 by Attractive Chaos Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* An example: #include "khash.h" KHASH_MAP_INIT_INT(32, char) int main() { int ret, is_missing; khiter_t k; khash_t(32) *h = kh_init(32); k = kh_put(32, h, 5, &ret); kh_value(h, k) = 10; k = kh_get(32, h, 10); is_missing = (k == kh_end(h)); k = kh_get(32, h, 5); kh_del(32, h, k); for (k = kh_begin(h); k != kh_end(h); ++k) if (kh_exist(h, k)) kh_value(h, k) = 1; kh_destroy(32, h); return 0; } */ /* 2013-05-02 (0.2.8): * Use quadratic probing. When the capacity is power of 2, stepping function i*(i+1)/2 guarantees to traverse each bucket. It is better than double hashing on cache performance and is more robust than linear probing. In theory, double hashing should be more robust than quadratic probing. However, my implementation is probably not for large hash tables, because the second hash function is closely tied to the first hash function, which reduce the effectiveness of double hashing. Reference: http://research.cs.vt.edu/AVresearch/hashing/quadratic.php 2011-12-29 (0.2.7): * Minor code clean up; no actual effect. 2011-09-16 (0.2.6): * The capacity is a power of 2. This seems to dramatically improve the speed for simple keys. Thank Zilong Tan for the suggestion. Reference: - http://code.google.com/p/ulib/ - http://nothings.org/computer/judy/ * Allow to optionally use linear probing which usually has better performance for random input. Double hashing is still the default as it is more robust to certain non-random input. * Added Wang's integer hash function (not used by default). This hash function is more robust to certain non-random input. 2011-02-14 (0.2.5): * Allow to declare global functions. 2009-09-26 (0.2.4): * Improve portability 2008-09-19 (0.2.3): * Corrected the example * Improved interfaces 2008-09-11 (0.2.2): * Improved speed a little in kh_put() 2008-09-10 (0.2.1): * Added kh_clear() * Fixed a compiling error 2008-09-02 (0.2.0): * Changed to token concatenation which increases flexibility. 2008-08-31 (0.1.2): * Fixed a bug in kh_get(), which has not been tested previously. 2008-08-31 (0.1.1): * Added destructor */ #ifndef __AC_KHASH_H #define __AC_KHASH_H /*! @header Generic hash table library. */ #define AC_VERSION_KHASH_H "0.2.8" #include #include #include /* compiler specific configuration */ #if UINT_MAX == 0xffffffffu typedef unsigned int khint32_t; #elif ULONG_MAX == 0xffffffffu typedef unsigned long khint32_t; #endif #if ULONG_MAX == ULLONG_MAX typedef unsigned long khint64_t; #else typedef unsigned long long khint64_t; #endif #ifndef kh_inline #ifdef _MSC_VER #define kh_inline __inline #else #define kh_inline inline #endif #endif /* kh_inline */ #ifndef klib_unused #if (defined __clang__ && __clang_major__ >= 3) || (defined __GNUC__ && __GNUC__ >= 3) #define klib_unused __attribute__ ((__unused__)) #else #define klib_unused #endif #endif /* klib_unused */ typedef khint32_t khint_t; typedef khint_t khiter_t; #define __ac_isempty(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&2) #define __ac_isdel(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&1) #define __ac_iseither(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&3) #define __ac_set_isdel_false(flag, i) (flag[i>>4]&=~(1ul<<((i&0xfU)<<1))) #define __ac_set_isempty_false(flag, i) (flag[i>>4]&=~(2ul<<((i&0xfU)<<1))) #define __ac_set_isboth_false(flag, i) (flag[i>>4]&=~(3ul<<((i&0xfU)<<1))) #define __ac_set_isdel_true(flag, i) (flag[i>>4]|=1ul<<((i&0xfU)<<1)) #define __ac_fsize(m) ((m) < 16? 1 : (m)>>4) #ifndef kroundup32 #define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x)) #endif #ifndef kcalloc #define kcalloc(N,Z) calloc(N,Z) #endif #ifndef kmalloc #define kmalloc(Z) malloc(Z) #endif #ifndef krealloc #define krealloc(P,Z) realloc(P,Z) #endif #ifndef kfree #define kfree(P) free(P) #endif static const double __ac_HASH_UPPER = 0.77; #define __KHASH_TYPE(name, khkey_t, khval_t) \ typedef struct kh_##name##_s { \ khint_t n_buckets, size, n_occupied, upper_bound; \ khint32_t *flags; \ khkey_t *keys; \ khval_t *vals; \ } kh_##name##_t; #define __KHASH_PROTOTYPES(name, khkey_t, khval_t) \ extern kh_##name##_t *kh_init_##name(void); \ extern void kh_destroy_##name(kh_##name##_t *h); \ extern void kh_clear_##name(kh_##name##_t *h); \ extern khint_t kh_get_##name(const kh_##name##_t *h, khkey_t key); \ extern int kh_resize_##name(kh_##name##_t *h, khint_t new_n_buckets); \ extern khint_t kh_put_##name(kh_##name##_t *h, khkey_t key, int *ret); \ extern void kh_del_##name(kh_##name##_t *h, khint_t x); #define __KHASH_IMPL(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \ SCOPE kh_##name##_t *kh_init_##name(void) { \ return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \ } \ SCOPE void kh_destroy_##name(kh_##name##_t *h) \ { \ if (h) { \ kfree((void *)h->keys); kfree(h->flags); \ kfree((void *)h->vals); \ kfree(h); \ } \ } \ SCOPE void kh_clear_##name(kh_##name##_t *h) \ { \ if (h && h->flags) { \ memset(h->flags, 0xaa, __ac_fsize(h->n_buckets) * sizeof(khint32_t)); \ h->size = h->n_occupied = 0; \ } \ } \ SCOPE khint_t kh_get_##name(const kh_##name##_t *h, khkey_t key) \ { \ if (h->n_buckets) { \ khint_t k, i, last, mask, step = 0; \ mask = h->n_buckets - 1; \ k = __hash_func(key); i = k & mask; \ last = i; \ while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \ i = (i + (++step)) & mask; \ if (i == last) return h->n_buckets; \ } \ return __ac_iseither(h->flags, i)? h->n_buckets : i; \ } else return 0; \ } \ SCOPE int kh_resize_##name(kh_##name##_t *h, khint_t new_n_buckets) \ { /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \ khint32_t *new_flags = 0; \ khint_t j = 1; \ { \ kroundup32(new_n_buckets); \ if (new_n_buckets < 4) new_n_buckets = 4; \ if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 0; /* requested size is too small */ \ else { /* hash table size to be changed (shrink or expand); rehash */ \ new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ if (!new_flags) return -1; \ memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ if (h->n_buckets < new_n_buckets) { /* expand */ \ khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ if (!new_keys) { kfree(new_flags); return -1; } \ h->keys = new_keys; \ if (kh_is_map) { \ khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ if (!new_vals) { kfree(new_flags); return -1; } \ h->vals = new_vals; \ } \ } /* otherwise shrink */ \ } \ } \ if (j) { /* rehashing is needed */ \ for (j = 0; j != h->n_buckets; ++j) { \ if (__ac_iseither(h->flags, j) == 0) { \ khkey_t key = h->keys[j]; \ khval_t val; \ khint_t new_mask; \ new_mask = new_n_buckets - 1; \ if (kh_is_map) val = h->vals[j]; \ __ac_set_isdel_true(h->flags, j); \ while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \ khint_t k, i, step = 0; \ k = __hash_func(key); \ i = k & new_mask; \ while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask; \ __ac_set_isempty_false(new_flags, i); \ if (i < h->n_buckets && __ac_iseither(h->flags, i) == 0) { /* kick out the existing element */ \ { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ __ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \ } else { /* write the element and jump out of the loop */ \ h->keys[i] = key; \ if (kh_is_map) h->vals[i] = val; \ break; \ } \ } \ } \ } \ if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \ h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ } \ kfree(h->flags); /* free the working space */ \ h->flags = new_flags; \ h->n_buckets = new_n_buckets; \ h->n_occupied = h->size; \ h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ } \ return 0; \ } \ SCOPE khint_t kh_put_##name(kh_##name##_t *h, khkey_t key, int *ret) \ { \ khint_t x; \ if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \ if (h->n_buckets > (h->size<<1)) { \ if (kh_resize_##name(h, h->n_buckets - 1) < 0) { /* clear "deleted" elements */ \ *ret = -1; return h->n_buckets; \ } \ } else if (kh_resize_##name(h, h->n_buckets + 1) < 0) { /* expand the hash table */ \ *ret = -1; return h->n_buckets; \ } \ } /* TODO: to implement automatically shrinking; resize() already support shrinking */ \ { \ khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \ x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \ if (__ac_isempty(h->flags, i)) x = i; /* for speed up */ \ else { \ last = i; \ while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \ if (__ac_isdel(h->flags, i)) site = i; \ i = (i + (++step)) & mask; \ if (i == last) { x = site; break; } \ } \ if (x == h->n_buckets) { \ if (__ac_isempty(h->flags, i) && site != h->n_buckets) x = site; \ else x = i; \ } \ } \ } \ if (__ac_isempty(h->flags, x)) { /* not present at all */ \ h->keys[x] = key; \ __ac_set_isboth_false(h->flags, x); \ ++h->size; ++h->n_occupied; \ *ret = 1; \ } else if (__ac_isdel(h->flags, x)) { /* deleted */ \ h->keys[x] = key; \ __ac_set_isboth_false(h->flags, x); \ ++h->size; \ *ret = 2; \ } else *ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \ return x; \ } \ SCOPE void kh_del_##name(kh_##name##_t *h, khint_t x) \ { \ if (x != h->n_buckets && !__ac_iseither(h->flags, x)) { \ __ac_set_isdel_true(h->flags, x); \ --h->size; \ } \ } #define KHASH_DECLARE(name, khkey_t, khval_t) \ __KHASH_TYPE(name, khkey_t, khval_t) \ __KHASH_PROTOTYPES(name, khkey_t, khval_t) #define KHASH_INIT2(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \ __KHASH_TYPE(name, khkey_t, khval_t) \ __KHASH_IMPL(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) #define KHASH_INIT(name, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \ KHASH_INIT2(name, static kh_inline klib_unused, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) /* --- BEGIN OF HASH FUNCTIONS --- */ /*! @function @abstract Integer hash function @param key The integer [khint32_t] @return The hash value [khint_t] */ #define kh_int_hash_func(key) (khint32_t)(key) /*! @function @abstract Integer comparison function */ #define kh_int_hash_equal(a, b) ((a) == (b)) /*! @function @abstract 64-bit integer hash function @param key The integer [khint64_t] @return The hash value [khint_t] */ #define kh_int64_hash_func(key) (khint32_t)((key)>>33^(key)^(key)<<11) /*! @function @abstract 64-bit integer comparison function */ #define kh_int64_hash_equal(a, b) ((a) == (b)) /*! @function @abstract const char* hash function @param s Pointer to a null terminated string @return The hash value */ static kh_inline khint_t __ac_X31_hash_string(const char *s) { khint_t h = (khint_t)*s; if (h) for (++s ; *s; ++s) h = (h << 5) - h + (khint_t)*s; return h; } /*! @function @abstract Another interface to const char* hash function @param key Pointer to a null terminated string [const char*] @return The hash value [khint_t] */ #define kh_str_hash_func(key) __ac_X31_hash_string(key) /*! @function @abstract Const char* comparison function */ #define kh_str_hash_equal(a, b) (strcmp(a, b) == 0) static kh_inline khint_t __ac_Wang_hash(khint_t key) { key += ~(key << 15); key ^= (key >> 10); key += (key << 3); key ^= (key >> 6); key += ~(key << 11); key ^= (key >> 16); return key; } #define kh_int_hash_func2(key) __ac_Wang_hash((khint_t)key) /* --- END OF HASH FUNCTIONS --- */ /* Other convenient macros... */ /*! @abstract Type of the hash table. @param name Name of the hash table [symbol] */ #define khash_t(name) kh_##name##_t /*! @function @abstract Initiate a hash table. @param name Name of the hash table [symbol] @return Pointer to the hash table [khash_t(name)*] */ #define kh_init(name) kh_init_##name() /*! @function @abstract Destroy a hash table. @param name Name of the hash table [symbol] @param h Pointer to the hash table [khash_t(name)*] */ #define kh_destroy(name, h) kh_destroy_##name(h) /*! @function @abstract Reset a hash table without deallocating memory. @param name Name of the hash table [symbol] @param h Pointer to the hash table [khash_t(name)*] */ #define kh_clear(name, h) kh_clear_##name(h) /*! @function @abstract Resize a hash table. @param name Name of the hash table [symbol] @param h Pointer to the hash table [khash_t(name)*] @param s New size [khint_t] */ #define kh_resize(name, h, s) kh_resize_##name(h, s) /*! @function @abstract Insert a key to the hash table. @param name Name of the hash table [symbol] @param h Pointer to the hash table [khash_t(name)*] @param k Key [type of keys] @param r Extra return code: -1 if the operation failed; 0 if the key is present in the hash table; 1 if the bucket is empty (never used); 2 if the element in the bucket has been deleted [int*] @return Iterator to the inserted element [khint_t] */ #define kh_put(name, h, k, r) kh_put_##name(h, k, r) /*! @function @abstract Retrieve a key from the hash table. @param name Name of the hash table [symbol] @param h Pointer to the hash table [khash_t(name)*] @param k Key [type of keys] @return Iterator to the found element, or kh_end(h) if the element is absent [khint_t] */ #define kh_get(name, h, k) kh_get_##name(h, k) /*! @function @abstract Remove a key from the hash table. @param name Name of the hash table [symbol] @param h Pointer to the hash table [khash_t(name)*] @param k Iterator to the element to be deleted [khint_t] */ #define kh_del(name, h, k) kh_del_##name(h, k) /*! @function @abstract Test whether a bucket contains data. @param h Pointer to the hash table [khash_t(name)*] @param x Iterator to the bucket [khint_t] @return 1 if containing data; 0 otherwise [int] */ #define kh_exist(h, x) (!__ac_iseither((h)->flags, (x))) /*! @function @abstract Get key given an iterator @param h Pointer to the hash table [khash_t(name)*] @param x Iterator to the bucket [khint_t] @return Key [type of keys] */ #define kh_key(h, x) ((h)->keys[x]) /*! @function @abstract Get value given an iterator @param h Pointer to the hash table [khash_t(name)*] @param x Iterator to the bucket [khint_t] @return Value [type of values] @discussion For hash sets, calling this results in segfault. */ #define kh_val(h, x) ((h)->vals[x]) /*! @function @abstract Alias of kh_val() */ #define kh_value(h, x) ((h)->vals[x]) /*! @function @abstract Get the start iterator @param h Pointer to the hash table [khash_t(name)*] @return The start iterator [khint_t] */ #define kh_begin(h) (khint_t)(0) /*! @function @abstract Get the end iterator @param h Pointer to the hash table [khash_t(name)*] @return The end iterator [khint_t] */ #define kh_end(h) ((h)->n_buckets) /*! @function @abstract Get the number of elements in the hash table @param h Pointer to the hash table [khash_t(name)*] @return Number of elements in the hash table [khint_t] */ #define kh_size(h) ((h)->size) /*! @function @abstract Get the number of buckets in the hash table @param h Pointer to the hash table [khash_t(name)*] @return Number of buckets in the hash table [khint_t] */ #define kh_n_buckets(h) ((h)->n_buckets) /*! @function @abstract Iterate over the entries in the hash table @param h Pointer to the hash table [khash_t(name)*] @param kvar Variable to which key will be assigned @param vvar Variable to which value will be assigned @param code Block of code to execute */ #define kh_foreach(h, kvar, vvar, code) { khint_t __i; \ for (__i = kh_begin(h); __i != kh_end(h); ++__i) { \ if (!kh_exist(h,__i)) continue; \ (kvar) = kh_key(h,__i); \ (vvar) = kh_val(h,__i); \ code; \ } } /*! @function @abstract Iterate over the values in the hash table @param h Pointer to the hash table [khash_t(name)*] @param vvar Variable to which value will be assigned @param code Block of code to execute */ #define kh_foreach_value(h, vvar, code) { khint_t __i; \ for (__i = kh_begin(h); __i != kh_end(h); ++__i) { \ if (!kh_exist(h,__i)) continue; \ (vvar) = kh_val(h,__i); \ code; \ } } /* More conenient interfaces */ /*! @function @abstract Instantiate a hash set containing integer keys @param name Name of the hash table [symbol] */ #define KHASH_SET_INIT_INT(name) \ KHASH_INIT(name, khint32_t, char, 0, kh_int_hash_func, kh_int_hash_equal) /*! @function @abstract Instantiate a hash map containing integer keys @param name Name of the hash table [symbol] @param khval_t Type of values [type] */ #define KHASH_MAP_INIT_INT(name, khval_t) \ KHASH_INIT(name, khint32_t, khval_t, 1, kh_int_hash_func, kh_int_hash_equal) /*! @function @abstract Instantiate a hash map containing 64-bit integer keys @param name Name of the hash table [symbol] */ #define KHASH_SET_INIT_INT64(name) \ KHASH_INIT(name, khint64_t, char, 0, kh_int64_hash_func, kh_int64_hash_equal) /*! @function @abstract Instantiate a hash map containing 64-bit integer keys @param name Name of the hash table [symbol] @param khval_t Type of values [type] */ #define KHASH_MAP_INIT_INT64(name, khval_t) \ KHASH_INIT(name, khint64_t, khval_t, 1, kh_int64_hash_func, kh_int64_hash_equal) typedef const char *kh_cstr_t; /*! @function @abstract Instantiate a hash map containing const char* keys @param name Name of the hash table [symbol] */ #define KHASH_SET_INIT_STR(name) \ KHASH_INIT(name, kh_cstr_t, char, 0, kh_str_hash_func, kh_str_hash_equal) /*! @function @abstract Instantiate a hash map containing const char* keys @param name Name of the hash table [symbol] @param khval_t Type of values [type] */ #define KHASH_MAP_INIT_STR(name, khval_t) \ KHASH_INIT(name, kh_cstr_t, khval_t, 1, kh_str_hash_func, kh_str_hash_equal) #endif /* __AC_KHASH_H */ mergerfs-2.21.0/src/ugid.hpp0000664000175000017500000000216113040040376014245 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __UGID_HPP__ #define __UGID_HPP__ #include #include #include namespace mergerfs { namespace ugid { void init(); void initgroups(const uid_t uid, const gid_t gid); } } #if defined __linux__ and UGID_USE_RWLOCK == 0 #include "ugid_linux.hpp" #else #include "ugid_rwlock.hpp" #endif #endif mergerfs-2.21.0/src/fs_base_flock.hpp0000664000175000017500000000200613040040376016073 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_FLOCK_HPP__ #define __FS_BASE_FLOCK_HPP__ #include namespace fs { static inline int flock(const int fd, const int operation) { return ::flock(fd,operation); } } #endif mergerfs-2.21.0/src/removexattr.cpp0000664000175000017500000000553113040040376015674 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include "config.hpp" #include "errno.hpp" #include "fs_base_removexattr.hpp" #include "fs_path.hpp" #include "rv.hpp" #include "rwlock.hpp" #include "ugid.hpp" using std::string; using std::vector; using mergerfs::Policy; static int _removexattr_loop_core(const string *basepath, const char *fusepath, const char *attrname, const int error) { int rv; string fullpath; fs::path::make(basepath,fusepath,fullpath); rv = fs::lremovexattr(fullpath,attrname); return error::calc(rv,error,errno); } static int _removexattr_loop(const vector &basepaths, const char *fusepath, const char *attrname) { int error; error = -1; for(size_t i = 0, ei = basepaths.size(); i != ei; i++) { error = _removexattr_loop_core(basepaths[i],fusepath,attrname,error); } return -error; } static int _removexattr(Policy::Func::Action actionFunc, const vector &srcmounts, const uint64_t minfreespace, const char *fusepath, const char *attrname) { int rv; vector basepaths; rv = actionFunc(srcmounts,fusepath,minfreespace,basepaths); if(rv == -1) return -errno; return _removexattr_loop(basepaths,fusepath,attrname); } namespace mergerfs { namespace fuse { int removexattr(const char *fusepath, const char *attrname) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); if(fusepath == config.controlfile) return -ENOTSUP; const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); return _removexattr(config.removexattr, config.srcmounts, config.minfreespace, fusepath, attrname); } } } mergerfs-2.21.0/src/fs_inode.hpp0000664000175000017500000000241213101724730015103 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_INODE_HPP__ #define __FS_INODE_HPP__ #include #include namespace fs { namespace inode { enum { MAGIC = 0x7472617065786974 }; inline void recompute(struct stat &st) { // not ideal to do this at runtime but usually gets optimized out if(sizeof(st.st_ino) == 4) st.st_ino |= ((uint32_t)st.st_dev << 16); else st.st_ino |= ((uint64_t)st.st_dev << 32); } } } #endif mergerfs-2.21.0/src/policy_lfs.cpp0000664000175000017500000000673313101725025015463 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include "errno.hpp" #include "fs.hpp" #include "fs_path.hpp" #include "policy.hpp" using std::string; using std::vector; using mergerfs::Category; static int _lfs_create(const vector &basepaths, const uint64_t minfreespace, vector &paths) { string fullpath; uint64_t lfs; const string *lfsbasepath; lfs = std::numeric_limits::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]; if(!fs::info(*basepath,readonly,spaceavail,_spaceused)) continue; if(readonly) continue; if(spaceavail < minfreespace) continue; if(spaceavail > lfs) continue; lfs = spaceavail; lfsbasepath = basepath; } if(lfsbasepath == NULL) return POLICY_FAIL_ENOENT; paths.push_back(lfsbasepath); return POLICY_SUCCESS; } static int _lfs_other(const vector &basepaths, const char *fusepath, vector &paths) { string fullpath; uint64_t lfs; const string *lfsbasepath; lfs = std::numeric_limits::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); if(!fs::exists(fullpath)) continue; if(!fs::spaceavail(*basepath,spaceavail)) continue; if(spaceavail > lfs) continue; lfs = spaceavail; lfsbasepath = basepath; } if(lfsbasepath == NULL) return POLICY_FAIL_ENOENT; paths.push_back(lfsbasepath); return POLICY_SUCCESS; } static int _lfs(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { if(type == Category::Enum::create) return _lfs_create(basepaths,minfreespace,paths); return _lfs_other(basepaths,fusepath,paths); } namespace mergerfs { int Policy::Func::lfs(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { int rv; rv = _lfs(type,basepaths,fusepath,minfreespace,paths); if(POLICY_FAILED(rv)) rv = Policy::Func::mfs(type,basepaths,fusepath,minfreespace,paths); return rv; } } mergerfs-2.21.0/src/link.cpp0000664000175000017500000002013013040040376014241 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include "config.hpp" #include "errno.hpp" #include "fs_base_link.hpp" #include "fs_clonepath.hpp" #include "fs_path.hpp" #include "rv.hpp" #include "rwlock.hpp" #include "ugid.hpp" using std::string; using std::vector; using mergerfs::Policy; using namespace mergerfs; static int _link_create_path_core(const string &oldbasepath, const string &newbasepath, const char *oldfusepath, const char *newfusepath, const string &newfusedirpath, const int error) { int rv; string oldfullpath; string newfullpath; if(oldbasepath != newbasepath) { const ugid::SetRootGuard ugidGuard; rv = fs::clonepath(newbasepath,oldbasepath,newfusedirpath); if(rv == -1) return errno; } fs::path::make(&oldbasepath,oldfusepath,oldfullpath); fs::path::make(&oldbasepath,newfusepath,newfullpath); rv = fs::link(oldfullpath,newfullpath); return error::calc(rv,error,errno); } static int _link_create_path_loop(const vector &oldbasepaths, const string &newbasepath, const char *oldfusepath, const char *newfusepath, const string &newfusedirpath) { int error; error = -1; for(size_t i = 0, ei = oldbasepaths.size(); i != ei; i++) { error = _link_create_path_core(*oldbasepaths[i],newbasepath, oldfusepath,newfusepath, newfusedirpath, error); } return -error; } static int _link_create_path(Policy::Func::Search searchFunc, Policy::Func::Action actionFunc, const vector &srcmounts, const uint64_t minfreespace, const char *oldfusepath, const char *newfusepath) { int rv; string newfusedirpath; vector oldbasepaths; vector newbasepaths; rv = actionFunc(srcmounts,oldfusepath,minfreespace,oldbasepaths); if(rv == -1) return -errno; newfusedirpath = newfusepath; fs::path::dirname(newfusedirpath); rv = searchFunc(srcmounts,newfusedirpath.c_str(),minfreespace,newbasepaths); if(rv == -1) return -errno; return _link_create_path_loop(oldbasepaths,*newbasepaths[0], oldfusepath,newfusepath, newfusedirpath); } static int _clonepath_if_would_create(Policy::Func::Search searchFunc, Policy::Func::Create createFunc, const vector &srcmounts, const uint64_t minfreespace, const string &oldbasepath, const char *oldfusepath, const char *newfusepath) { int rv; string newfusedirpath; const char *newfusedirpathcstr; vector newbasepath; newfusedirpath = newfusepath; fs::path::dirname(newfusedirpath); newfusedirpathcstr = newfusedirpath.c_str(); rv = createFunc(srcmounts,newfusedirpathcstr,minfreespace,newbasepath); if(rv == -1) return -1; if(oldbasepath != *newbasepath[0]) return (errno=EXDEV,-1); rv = searchFunc(srcmounts,newfusedirpathcstr,minfreespace,newbasepath); if(rv == -1) return -1; const ugid::SetRootGuard ugidGuard; return fs::clonepath(*newbasepath[0],oldbasepath,newfusedirpathcstr); } static int _link_preserve_path_core(Policy::Func::Search searchFunc, Policy::Func::Create createFunc, const vector &srcmounts, const uint64_t minfreespace, const string &oldbasepath, const char *oldfusepath, const char *newfusepath, const int error) { int rv; string oldfullpath; string newfullpath; fs::path::make(&oldbasepath,oldfusepath,oldfullpath); fs::path::make(&oldbasepath,newfusepath,newfullpath); rv = fs::link(oldfullpath,newfullpath); if((rv == -1) && (errno == ENOENT)) { rv = _clonepath_if_would_create(searchFunc,createFunc, srcmounts,minfreespace, oldbasepath, oldfusepath,newfusepath); if(rv != -1) rv = fs::link(oldfullpath,newfullpath); } return error::calc(rv,error,errno); } static int _link_preserve_path_loop(Policy::Func::Search searchFunc, Policy::Func::Create createFunc, const vector &srcmounts, const uint64_t minfreespace, const char *oldfusepath, const char *newfusepath, const vector &oldbasepaths) { int error; error = -1; for(size_t i = 0, ei = oldbasepaths.size(); i != ei; i++) { error = _link_preserve_path_core(searchFunc,createFunc, srcmounts,minfreespace, *oldbasepaths[i], oldfusepath,newfusepath, error); } return -error; } static int _link_preserve_path(Policy::Func::Search searchFunc, Policy::Func::Action actionFunc, Policy::Func::Create createFunc, const vector &srcmounts, const uint64_t minfreespace, const char *oldfusepath, const char *newfusepath) { int rv; vector oldbasepaths; rv = actionFunc(srcmounts,oldfusepath,minfreespace,oldbasepaths); if(rv == -1) return -errno; return _link_preserve_path_loop(searchFunc,createFunc, srcmounts,minfreespace, oldfusepath,newfusepath, oldbasepaths); } namespace mergerfs { namespace fuse { int link(const char *from, const char *to) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); if(config.create->path_preserving()) return _link_preserve_path(config.getattr, config.link, config.create, config.srcmounts, config.minfreespace, from, to); return _link_create_path(config.link, config.create, config.srcmounts, config.minfreespace, from, to); } } } mergerfs-2.21.0/src/readdir.cpp0000664000175000017500000000603113101724730014723 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #define _BSD_SOURCE #include #include #include #include #include "config.hpp" #include "dirinfo.hpp" #include "errno.hpp" #include "fs_base_closedir.hpp" #include "fs_base_dirfd.hpp" #include "fs_base_opendir.hpp" #include "fs_base_readdir.hpp" #include "fs_base_stat.hpp" #include "fs_devid.hpp" #include "fs_inode.hpp" #include "fs_path.hpp" #include "readdir.hpp" #include "rwlock.hpp" #include "strset.hpp" #include "ugid.hpp" using std::string; using std::vector; #define NO_OFFSET 0 static int _readdir(const vector &srcmounts, const char *dirname, void *buf, const fuse_fill_dir_t filler) { StrSet names; string basepath; struct stat st = {0}; for(size_t i = 0, ei = srcmounts.size(); i != ei; i++) { int rv; int dirfd; DIR *dh; fs::path::make(&srcmounts[i],dirname,basepath); dh = fs::opendir(basepath); if(!dh) continue; dirfd = fs::dirfd(dh); st.st_dev = fs::devid(dirfd); if(st.st_dev == (dev_t)-1) st.st_dev = i; rv = 0; for(struct dirent *de = fs::readdir(dh); de && !rv; de = fs::readdir(dh)) { rv = names.put(de->d_name); if(rv == 0) continue; st.st_ino = de->d_ino; st.st_mode = DTTOIF(de->d_type); fs::inode::recompute(st); rv = filler(buf,de->d_name,&st,NO_OFFSET); if(rv) return (fs::closedir(dh),-ENOMEM); } fs::closedir(dh); } return 0; } namespace mergerfs { namespace fuse { int readdir(const char *fusepath, void *buf, fuse_fill_dir_t filler, off_t offset, fuse_file_info *ffi) { DirInfo *di = reinterpret_cast(ffi->fh); const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); return ::_readdir(config.srcmounts, di->fusepath.c_str(), buf, filler); } } } mergerfs-2.21.0/src/read_buf.hpp0000664000175000017500000000217713003720477015101 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __READ_BUF_HPP__ #define __READ_BUF_HPP__ #include #include namespace mergerfs { namespace fuse { int read_buf(const char *fusepath, struct fuse_bufvec **buf, size_t size, off_t offset, fuse_file_info *fi); } } #endif mergerfs-2.21.0/src/setxattr.cpp0000664000175000017500000002513213103071706015172 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include #include "config.hpp" #include "errno.hpp" #include "fs_base_setxattr.hpp" #include "fs_path.hpp" #include "num.hpp" #include "rv.hpp" #include "rwlock.hpp" #include "str.hpp" #include "ugid.hpp" using std::string; using std::vector; using mergerfs::Policy; using mergerfs::FuseFunc; using namespace mergerfs; static int _add_srcmounts(vector &srcmounts, pthread_rwlock_t &srcmountslock, const string &destmount, const string &values, vector::iterator pos) { vector patterns; vector additions; str::split(patterns,values,':'); fs::glob(patterns,additions); fs::realpathize(additions); if(!additions.empty()) { const rwlock::WriteGuard wrg(&srcmountslock); srcmounts.insert(pos, additions.begin(), additions.end()); } return 0; } static int _erase_srcmounts(vector &srcmounts, pthread_rwlock_t &srcmountslock, const string &values) { if(srcmounts.empty()) return 0; vector patterns; str::split(patterns,values,':'); { const rwlock::WriteGuard wrg(&srcmountslock); str::erase_fnmatches(patterns,srcmounts); } return 0; } static int _replace_srcmounts(vector &srcmounts, pthread_rwlock_t &srcmountslock, const string &destmount, const string &values) { vector patterns; vector newmounts; str::split(patterns,values,':'); fs::glob(patterns,newmounts); fs::realpathize(newmounts); { const rwlock::WriteGuard wrg(&srcmountslock); srcmounts.swap(newmounts); } return 0; } static void _split_attrval(const string &attrval, string &instruction, string &values) { size_t offset; offset = attrval.find_first_of('/'); instruction = attrval.substr(0,offset); if(offset != string::npos) values = attrval.substr(offset); } static int _setxattr_srcmounts(const string &attrval, const int flags, vector &srcmounts, pthread_rwlock_t &srcmountslock, const string &destmount) { string instruction; string values; if((flags & XATTR_CREATE) == XATTR_CREATE) return -EEXIST; _split_attrval(attrval,instruction,values); if(instruction == "+") return _add_srcmounts(srcmounts,srcmountslock,destmount,values,srcmounts.end()); else if(instruction == "+<") return _add_srcmounts(srcmounts,srcmountslock,destmount,values,srcmounts.begin()); else if(instruction == "+>") return _add_srcmounts(srcmounts,srcmountslock,destmount,values,srcmounts.end()); else if(instruction == "-") return _erase_srcmounts(srcmounts,srcmountslock,values); else if(instruction == "-<") return _erase_srcmounts(srcmounts,srcmountslock,srcmounts.front()); else if(instruction == "->") return _erase_srcmounts(srcmounts,srcmountslock,srcmounts.back()); else if(instruction == "=") return _replace_srcmounts(srcmounts,srcmountslock,destmount,values); else if(instruction.empty()) return _replace_srcmounts(srcmounts,srcmountslock,destmount,values); return -EINVAL; } static int _setxattr_uint64_t(const string &attrval, const int flags, uint64_t &uint) { int rv; if((flags & XATTR_CREATE) == XATTR_CREATE) return -EEXIST; rv = num::to_uint64_t(attrval,uint); if(rv == -1) return -EINVAL; return 0; } static int _setxattr_time_t(const string &attrval, const int flags, time_t &time) { int rv; if((flags & XATTR_CREATE) == XATTR_CREATE) return -EEXIST; rv = num::to_time_t(attrval,time); if(rv == -1) return -EINVAL; return 0; } static int _setxattr_bool(const string &attrval, const int flags, bool &value) { if((flags & XATTR_CREATE) == XATTR_CREATE) return -EEXIST; if(attrval == "false") value = false; else if(attrval == "true") value = true; else return -EINVAL; return 0; } static int _setxattr_controlfile_func_policy(Config &config, const string &funcname, const string &attrval, const int flags) { int rv; if((flags & XATTR_CREATE) == XATTR_CREATE) return -EEXIST; rv = config.set_func_policy(funcname,attrval); if(rv == -1) return -errno; return 0; } static int _setxattr_controlfile_category_policy(Config &config, const string &categoryname, const string &attrval, const int flags) { int rv; if((flags & XATTR_CREATE) == XATTR_CREATE) return -EEXIST; rv = config.set_category_policy(categoryname,attrval); if(rv == -1) return -errno; return 0; } static int _setxattr_controlfile(Config &config, const string &attrname, const string &attrval, const int flags) { vector attr; str::split(attr,attrname,'.'); switch(attr.size()) { case 3: if(attr[2] == "srcmounts") return _setxattr_srcmounts(attrval, flags, config.srcmounts, config.srcmountslock, config.destmount); else if(attr[2] == "minfreespace") return _setxattr_uint64_t(attrval, flags, config.minfreespace); else if(attr[2] == "moveonenospc") return _setxattr_bool(attrval, flags, config.moveonenospc); else if(attr[2] == "dropcacheonclose") return _setxattr_bool(attrval, flags, config.dropcacheonclose); else if(attr[2] == "symlinkify") return _setxattr_bool(attrval, flags, config.symlinkify); else if(attr[2] == "symlinkify_timeout") return _setxattr_time_t(attrval, flags, config.symlinkify_timeout); break; case 4: if(attr[2] == "category") return _setxattr_controlfile_category_policy(config, attr[3], attrval, flags); else if(attr[2] == "func") return _setxattr_controlfile_func_policy(config, attr[3], attrval, flags); break; default: break; } return -EINVAL; } static int _setxattr_loop_core(const string *basepath, const char *fusepath, const char *attrname, const char *attrval, const size_t attrvalsize, const int flags, const int error) { int rv; string fullpath; fs::path::make(basepath,fusepath,fullpath); rv = fs::lsetxattr(fullpath,attrname,attrval,attrvalsize,flags); return error::calc(rv,error,errno); } static int _setxattr_loop(const vector &basepaths, const char *fusepath, const char *attrname, const char *attrval, const size_t attrvalsize, const int flags) { int error; error = -1; for(size_t i = 0, ei = basepaths.size(); i != ei; i++) { error = _setxattr_loop_core(basepaths[i],fusepath, attrname,attrval,attrvalsize,flags, error); } return -error; } static int _setxattr(Policy::Func::Action actionFunc, const vector &srcmounts, const uint64_t minfreespace, const char *fusepath, const char *attrname, const char *attrval, const size_t attrvalsize, const int flags) { int rv; vector basepaths; rv = actionFunc(srcmounts,fusepath,minfreespace,basepaths); if(rv == -1) return -errno; return _setxattr_loop(basepaths,fusepath,attrname,attrval,attrvalsize,flags); } namespace mergerfs { namespace fuse { int setxattr(const char *fusepath, const char *attrname, const char *attrval, size_t attrvalsize, int flags) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); if(fusepath == config.controlfile) return _setxattr_controlfile(Config::get_writable(), attrname, string(attrval,attrvalsize), flags); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); return _setxattr(config.setxattr, config.srcmounts, config.minfreespace, fusepath, attrname, attrval, attrvalsize, flags); } } } mergerfs-2.21.0/src/gidcache.hpp0000664000175000017500000000275413003720477015062 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __GIDCACHE_HPP__ #define __GIDCACHE_HPP__ #include #include #define MAXGIDS 32 #define MAXRECS 256 struct gid_t_rec { uid_t uid; int size; gid_t gids[MAXGIDS]; bool operator<(const struct gid_t_rec &b) const; }; struct gid_t_cache { public: size_t size; gid_t_rec recs[MAXRECS]; private: gid_t_rec * begin(void); gid_t_rec * end(void); gid_t_rec * allocrec(void); gid_t_rec * lower_bound(gid_t_rec *begin, gid_t_rec *end, const uid_t uid); gid_t_rec * cache(const uid_t uid, const gid_t gid); public: int initgroups(const uid_t uid, const gid_t gid); }; #endif mergerfs-2.21.0/src/fs.cpp0000664000175000017500000001216713101724730013730 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include #include #include #include "errno.hpp" #include "fs_attr.hpp" #include "fs_base_realpath.hpp" #include "fs_base_stat.hpp" #include "fs_base_statvfs.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 rv; struct statvfs st; rv = fs::statvfs(path,st); return (STATVFS_SUCCEEDED(rv) && StatVFS::readonly(st)); } bool 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); return STATVFS_SUCCEEDED(rv); } bool 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); return STATVFS_SUCCEEDED(rv); } void findallfiles(const vector &srcmounts, const char *fusepath, vector &paths) { string fullpath; for(size_t i = 0, ei = srcmounts.size(); i != ei; i++) { fs::path::make(&srcmounts[i],fusepath,fullpath); if(!fs::exists(fullpath)) continue; paths.push_back(fullpath); } } int findonfs(const vector &srcmounts, const char *fusepath, const int fd, string &basepath) { int rv; dev_t dev; string fullpath; struct stat st; rv = fs::fstat(fd,st); if(FSTAT_FAILED(rv)) return -1; dev = st.st_dev; for(size_t i = 0, ei = srcmounts.size(); i != ei; i++) { fs::path::make(&srcmounts[i],fusepath,fullpath); rv = fs::lstat(fullpath,st); if(FSTAT_FAILED(rv)) continue; if(st.st_dev != dev) continue; basepath = srcmounts[i]; return 0; } return (errno=ENOENT,-1); } void glob(const vector &patterns, vector &strs) { int flags; size_t veclen; glob_t gbuf = {0}; veclen = patterns.size(); if(veclen == 0) return; flags = 0; glob(patterns[0].c_str(),flags,NULL,&gbuf); flags = GLOB_APPEND; for(size_t i = 1; i < veclen; i++) glob(patterns[i].c_str(),flags,NULL,&gbuf); for(size_t i = 0; i < gbuf.gl_pathc; ++i) strs.push_back(gbuf.gl_pathv[i]); globfree(&gbuf); } void realpathize(vector &strs) { char *rv; for(size_t i = 0; i < strs.size(); i++) { rv = fs::realpath(strs[i]); if(rv == NULL) continue; strs[i] = rv; ::free(rv); } } int getfl(const int fd) { return ::fcntl(fd,F_GETFL,0); } int mfs(const vector &basepaths, const uint64_t minfreespace, string &path) { uint64_t mfs; 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]; if(!fs::spaceavail(basepath,spaceavail)) continue; if(spaceavail < minfreespace) continue; if(spaceavail <= mfs) continue; mfs = spaceavail; mfsbasepath = &basepaths[i]; } if(mfsbasepath == NULL) return (errno=ENOENT,-1); path = *mfsbasepath; return 0; } }; mergerfs-2.21.0/src/fsyncdir.cpp0000664000175000017500000000252213101724730015133 0ustar bilebile/* Copyright (c) 2017, Antonio SJ Musumeci 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 #include #include #include "errno.hpp" #include "dirinfo.hpp" #include "fs_base_fsync.hpp" static int _fsyncdir(const DirInfo *di, const int isdatasync) { int rv; rv = -1; errno = ENOSYS; return ((rv == -1) ? -errno : 0); } namespace mergerfs { namespace fuse { int fsyncdir(const char *fusepath, int isdatasync, fuse_file_info *ffi) { DirInfo *di = reinterpret_cast(ffi->fh); return ::_fsyncdir(di,isdatasync); } } } mergerfs-2.21.0/src/truncate.cpp0000664000175000017500000000534313040040376015142 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include #include "config.hpp" #include "errno.hpp" #include "fs_base_truncate.hpp" #include "fs_path.hpp" #include "rv.hpp" #include "rwlock.hpp" #include "ugid.hpp" using std::string; using std::vector; using mergerfs::Policy; static int _truncate_loop_core(const string *basepath, const char *fusepath, const off_t size, const int error) { int rv; string fullpath; fs::path::make(basepath,fusepath,fullpath); rv = fs::truncate(fullpath,size); return error::calc(rv,error,errno); } static int _truncate_loop(const vector &basepaths, const char *fusepath, const off_t size) { int error; error = -1; for(size_t i = 0, ei = basepaths.size(); i != ei; i++) { error = _truncate_loop_core(basepaths[0],fusepath,size,error); } return -error; } static int _truncate(Policy::Func::Action actionFunc, const vector &srcmounts, const uint64_t minfreespace, const char *fusepath, const off_t size) { int rv; vector basepaths; rv = actionFunc(srcmounts,fusepath,minfreespace,basepaths); if(rv == -1) return -errno; return _truncate_loop(basepaths,fusepath,size); } namespace mergerfs { namespace fuse { int truncate(const char *fusepath, off_t size) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); return _truncate(config.truncate, config.srcmounts, config.minfreespace, fusepath, size); } } } mergerfs-2.21.0/src/read_buf.cpp0000664000175000017500000000346713035712542015076 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #if READ_BUF #include #include #include #include "errno.hpp" #include "fileinfo.hpp" typedef struct fuse_bufvec fuse_bufvec; static int _read_buf(const int fd, fuse_bufvec **bufp, const size_t size, const off_t offset) { fuse_bufvec *src; src = (fuse_bufvec*)malloc(sizeof(fuse_bufvec)); if(src == NULL) return -ENOMEM; *src = FUSE_BUFVEC_INIT(size); src->buf->flags = (fuse_buf_flags)(FUSE_BUF_IS_FD|FUSE_BUF_FD_SEEK|FUSE_BUF_FD_RETRY); src->buf->fd = fd; src->buf->pos = offset; *bufp = src; return 0; } namespace mergerfs { namespace fuse { int read_buf(const char *fusepath, fuse_bufvec **bufp, size_t size, off_t offset, fuse_file_info *ffi) { FileInfo *fi = reinterpret_cast(ffi->fh); return _read_buf(fi->fd, bufp, size, offset); } } } #endif mergerfs-2.21.0/src/success_fail.hpp0000664000175000017500000000321113040040376015755 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __SUCCESS_FAIL_HPP__ #define __SUCCESS_FAIL_HPP__ #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)) #endif mergerfs-2.21.0/src/fs_clonefile.cpp0000664000175000017500000001054613101724730015747 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include "errno.hpp" #include "fs_attr.hpp" #include "fs_base_chmod.hpp" #include "fs_base_chown.hpp" #include "fs_base_close.hpp" #include "fs_base_fadvise.hpp" #include "fs_base_fallocate.hpp" #include "fs_base_lseek.hpp" #include "fs_base_mkdir.hpp" #include "fs_base_open.hpp" #include "fs_base_read.hpp" #include "fs_base_stat.hpp" #include "fs_base_utime.hpp" #include "fs_base_write.hpp" #include "fs_sendfile.hpp" #include "fs_xattr.hpp" #ifndef O_LARGEFILE # define O_LARGEFILE 0 #endif #ifndef O_NOATIME # define O_NOATIME 0 #endif using std::string; using std::vector; int writen(const int fd, const char *buf, const size_t count) { size_t nleft; ssize_t nwritten; nleft = count; do { nwritten = fs::write(fd,buf,nleft); if((nwritten == -1) && (errno == EINTR)) continue; if(nwritten == -1) return -1; nleft -= nwritten; buf += nwritten; } while(nleft > 0); return count; } static int copyfile_rw(const int fdin, const int fdout, const size_t count, const size_t blocksize) { ssize_t nr; ssize_t nw; ssize_t bufsize; size_t totalwritten; vector buf; bufsize = (blocksize * 16); buf.resize(bufsize); fs::lseek(fdin,0,SEEK_SET); totalwritten = 0; while(totalwritten < count) { nr = fs::read(fdin,&buf[0],bufsize); if(nr == 0) return totalwritten; if((nr == -1) && (errno == EINTR)) continue; if(nr == -1) return -1; nw = writen(fdout,&buf[0],nr); if(nw == -1) return -1; totalwritten += nw; } return totalwritten; } static int copydata(const int fdin, const int fdout, const size_t count, const size_t blocksize) { int rv; fs::fadvise_willneed(fdin,0,count); fs::fadvise_sequential(fdin,0,count); fs::fallocate(fdout,0,0,count); rv = fs::sendfile(fdin,fdout,count); if((rv == -1) && ((errno == EINVAL) || (errno == ENOSYS))) return ::copyfile_rw(fdin,fdout,count,blocksize); return rv; } static bool ignorable_error(const int err) { switch(err) { case ENOTTY: case ENOTSUP: #if ENOTSUP != EOPNOTSUPP case EOPNOTSUPP: #endif return true; } return false; } namespace fs { int clonefile(const int fdin, const int fdout) { int rv; struct stat stin; rv = fs::fstat(fdin,stin); if(rv == -1) return -1; rv = ::copydata(fdin,fdout,stin.st_size,stin.st_blksize); if(rv == -1) return -1; rv = fs::attr::copy(fdin,fdout); if((rv == -1) && !ignorable_error(errno)) return -1; rv = fs::xattr::copy(fdin,fdout); if((rv == -1) && !ignorable_error(errno)) return -1; rv = fs::fchown_check_on_error(fdout,stin); if(rv == -1) return -1; rv = fs::fchmod_check_on_error(fdout,stin); if(rv == -1) return -1; rv = fs::utime(fdout,stin); if(rv == -1) return -1; return 0; } int clonefile(const string &in, const string &out) { int rv; int fdin; int fdout; int error; fdin = fs::open(in,O_RDONLY|O_NOFOLLOW); if(fdin == -1) return -1; const int flags = O_CREAT|O_LARGEFILE|O_NOATIME|O_NOFOLLOW|O_TRUNC|O_WRONLY; const mode_t mode = S_IWUSR; fdout = fs::open(out,flags,mode); if(fdout == -1) return -1; rv = fs::clonefile(fdin,fdout); error = errno; fs::close(fdin); fs::close(fdout); errno = error; return rv; } } mergerfs-2.21.0/src/fs_base_read.hpp0000664000175000017500000000233713040040376015717 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_READ_HPP__ #define __FS_BASE_READ_HPP__ #include namespace fs { static inline ssize_t read(const int fd, void *buf, const size_t count) { return ::read(fd,buf,count); } static inline ssize_t pread(const int fd, void *buf, const size_t count, const off_t offset) { return ::pread(fd,buf,count,offset); } } #endif mergerfs-2.21.0/src/utimens.hpp0000664000175000017500000000172013040040376015001 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __UTIMENS_HPP__ #define __UTIMENS_HPP__ namespace mergerfs { namespace fuse { int utimens(const char *fusepath, const timespec ts[2]); } } #endif mergerfs-2.21.0/src/ioctl.hpp0000664000175000017500000000210413040040376014424 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __IOCTL_HPP__ #define __IOCTL_HPP__ namespace mergerfs { namespace fuse { int ioctl(const char *fusepath, int cmd, void *arg, fuse_file_info *fi, unsigned int flags, void *data); } } #endif mergerfs-2.21.0/src/readlink.cpp0000664000175000017500000000704713103071706015112 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include "config.hpp" #include "errno.hpp" #include "fs_base_readlink.hpp" #include "fs_base_stat.hpp" #include "fs_path.hpp" #include "rwlock.hpp" #include "symlinkify.hpp" #include "ugid.hpp" using std::string; using std::vector; using mergerfs::Policy; static int _readlink_core_standard(const string &fullpath, char *buf, const size_t size) { int rv; rv = fs::readlink(fullpath,buf,size); if(rv == -1) return -errno; buf[rv] = '\0'; return 0; } static int _readlink_core_symlinkify(const string &fullpath, char *buf, const size_t size, const time_t symlinkify_timeout) { int rv; struct stat st; rv = fs::stat(fullpath,st); if(rv == -1) return -errno; if(!symlinkify::can_be_symlink(st,symlinkify_timeout)) return _readlink_core_standard(fullpath,buf,size); strncpy(buf,fullpath.c_str(),size); return 0; } static int _readlink_core(const string *basepath, const char *fusepath, char *buf, const size_t size, const bool symlinkify, const time_t symlinkify_timeout) { string fullpath; fs::path::make(basepath,fusepath,fullpath); if(symlinkify) return _readlink_core_symlinkify(fullpath,buf,size,symlinkify_timeout); return _readlink_core_standard(fullpath,buf,size); } static int _readlink(Policy::Func::Search searchFunc, const vector &srcmounts, const uint64_t minfreespace, const char *fusepath, char *buf, const size_t size, const bool symlinkify, const time_t symlinkify_timeout) { int rv; vector basepaths; rv = searchFunc(srcmounts,fusepath,minfreespace,basepaths); if(rv == -1) return -errno; return _readlink_core(basepaths[0],fusepath,buf,size, symlinkify,symlinkify_timeout); } namespace mergerfs { namespace fuse { int readlink(const char *fusepath, char *buf, size_t size) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); return _readlink(config.readlink, config.srcmounts, config.minfreespace, fusepath, buf, size, config.symlinkify, config.symlinkify_timeout); } } } mergerfs-2.21.0/src/rename.cpp0000664000175000017500000002242113040040376014560 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include "config.hpp" #include "errno.hpp" #include "fs_base_remove.hpp" #include "fs_base_rename.hpp" #include "fs_clonepath.hpp" #include "fs_path.hpp" #include "rv.hpp" #include "rwlock.hpp" #include "success_fail.hpp" #include "ugid.hpp" using std::string; using std::vector; using std::set; using namespace mergerfs; static bool member(const vector &haystack, const string &needle) { for(size_t i = 0, ei = haystack.size(); i != ei; i++) { if(*haystack[i] == needle) return true; } return false; } static void _remove(const vector &toremove) { for(size_t i = 0, ei = toremove.size(); i != ei; i++) fs::remove(toremove[i]); } static int _rename(const std::string &oldbasepath, const std::string &oldfullpath, const std::string &newbasepath, const std::string &newfusedirpath, const std::string &newfullpath) { int rv; if(oldbasepath != newbasepath) { const ugid::SetRootGuard guard; rv = fs::clonepath(newbasepath,oldbasepath,newfusedirpath); if(rv == -1) return -1; } return fs::rename(oldfullpath,newfullpath); } static void _rename_create_path_core(const vector &oldbasepaths, const string &oldbasepath, const string &newbasepath, const char *oldfusepath, const char *newfusepath, const string &newfusedirpath, int &error, vector &tounlink) { int rv; bool ismember; string oldfullpath; string newfullpath; fs::path::make(&oldbasepath,newfusepath,newfullpath); ismember = member(oldbasepaths,oldbasepath); if(ismember) { fs::path::make(&oldbasepath,oldfusepath,oldfullpath); rv = _rename(oldbasepath,oldfullpath, newbasepath,newfusedirpath,newfullpath); error = error::calc(rv,error,errno); if(RENAME_FAILED(rv)) tounlink.push_back(oldfullpath); } else { tounlink.push_back(newfullpath); } } static int _rename_create_path(Policy::Func::Search searchFunc, Policy::Func::Action actionFunc, const vector &srcmounts, const uint64_t minfreespace, const char *oldfusepath, const char *newfusepath) { int rv; int error; vector toremove; vector newbasepath; vector oldbasepaths; rv = actionFunc(srcmounts,oldfusepath,minfreespace,oldbasepaths); if(POLICY_FAILED(rv)) return -errno; string newfusedirpath = newfusepath; fs::path::dirname(newfusedirpath); rv = searchFunc(srcmounts,newfusedirpath.c_str(),minfreespace,newbasepath); if(POLICY_FAILED(rv)) return -errno; error = RENAME_FAIL; for(size_t i = 0, ei = srcmounts.size(); i != ei; i++) { const string &oldbasepath = srcmounts[i]; _rename_create_path_core(oldbasepaths, oldbasepath,*newbasepath[0], oldfusepath,newfusepath, newfusedirpath, error,toremove); } if(RENAME_SUCCEEDED(error)) _remove(toremove); return -error; } static int _clonepath(Policy::Func::Search searchFunc, const vector &srcmounts, const uint64_t minfreespace, const string &dstbasepath, const string &fusedirpath) { int rv; vector srcbasepath; rv = searchFunc(srcmounts,fusedirpath.c_str(),minfreespace,srcbasepath); if(POLICY_FAILED(rv)) return rv; { const ugid::SetRootGuard ugidGuard; fs::clonepath(*srcbasepath[0],dstbasepath,fusedirpath); } return POLICY_SUCCESS; } static int _clonepath_if_would_create(Policy::Func::Search searchFunc, Policy::Func::Create createFunc, const vector &srcmounts, const uint64_t minfreespace, const string &oldbasepath, const char *oldfusepath, const char *newfusepath) { int rv; string newfusedirpath; vector newbasepath; newfusedirpath = newfusepath; fs::path::dirname(newfusedirpath); rv = createFunc(srcmounts,newfusedirpath.c_str(),minfreespace,newbasepath); if(POLICY_FAILED(rv)) return rv; if(oldbasepath == *newbasepath[0]) return _clonepath(searchFunc,srcmounts,minfreespace,oldbasepath,newfusedirpath); return POLICY_FAIL_ERRNO(EXDEV); } static void _rename_preserve_path_core(Policy::Func::Search searchFunc, Policy::Func::Create createFunc, const vector &srcmounts, const uint64_t minfreespace, const vector &oldbasepaths, const string &oldbasepath, const char *oldfusepath, const char *newfusepath, int &error, vector &toremove) { int rv; bool ismember; string newfullpath; fs::path::make(&oldbasepath,newfusepath,newfullpath); ismember = member(oldbasepaths,oldbasepath); if(ismember) { string oldfullpath; fs::path::make(&oldbasepath,oldfusepath,oldfullpath); rv = fs::rename(oldfullpath,newfullpath); if(RENAME_FAILED_WITH(rv,ENOENT)) { rv = _clonepath_if_would_create(searchFunc,createFunc, srcmounts,minfreespace, oldbasepath,oldfusepath,newfusepath); if(POLICY_SUCCEEDED(rv)) rv = fs::rename(oldfullpath,newfullpath); } error = error::calc(rv,error,errno); if(RENAME_FAILED(rv)) toremove.push_back(oldfullpath); } else { toremove.push_back(newfullpath); } } static int _rename_preserve_path(Policy::Func::Search searchFunc, Policy::Func::Action actionFunc, Policy::Func::Create createFunc, const vector &srcmounts, const uint64_t minfreespace, const char *oldfusepath, const char *newfusepath) { int rv; int error; vector toremove; vector oldbasepaths; rv = actionFunc(srcmounts,oldfusepath,minfreespace,oldbasepaths); if(POLICY_FAILED(rv)) return -errno; error = RENAME_FAIL; for(size_t i = 0, ei = srcmounts.size(); i != ei; i++) { const string &oldbasepath = srcmounts[i]; _rename_preserve_path_core(searchFunc,createFunc, srcmounts,minfreespace, oldbasepaths,oldbasepath, oldfusepath,newfusepath, error,toremove); } if(RENAME_SUCCEEDED(error)) _remove(toremove); return -error; } namespace mergerfs { namespace fuse { int rename(const char *oldpath, const char *newpath) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); if(config.create->path_preserving()) return _rename_preserve_path(config.getattr, config.rename, config.create, config.srcmounts, config.minfreespace, oldpath, newpath); return _rename_create_path(config.getattr, config.rename, config.srcmounts, config.minfreespace, oldpath, newpath); } } } mergerfs-2.21.0/src/option_parser.hpp0000664000175000017500000000177113040040376016207 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __OPTION_PARSER_HPP__ #define __OPTION_PARSER_HPP__ #include #include "config.hpp" namespace mergerfs { namespace options { void parse(fuse_args &args, Config &config); } } #endif mergerfs-2.21.0/src/fs_base_futimesat.cpp0000664000175000017500000000162113072271045016777 0ustar bilebile/* ISC License Copyright (c) 2017, Antonio SJ Musumeci 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. */ #if __APPLE__ # include "fs_base_futimesat_osx.icpp" #else # include "fs_base_futimesat_generic.icpp" #endif mergerfs-2.21.0/src/fs_base_symlink.hpp0000664000175000017500000000234513040040376016471 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_SYMLINK_HPP__ #define __FS_BASE_SYMLINK_HPP__ #include #include namespace fs { static inline int symlink(const std::string &oldpath, const std::string &newpath) { return ::symlink(oldpath.c_str(),newpath.c_str()); } static inline int symlink(const char *oldpath, const std::string &newpath) { return ::symlink(oldpath,newpath.c_str()); } } #endif mergerfs-2.21.0/src/mkdir.cpp0000664000175000017500000000767213040040376014432 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include "config.hpp" #include "errno.hpp" #include "fs_acl.hpp" #include "fs_base_mkdir.hpp" #include "fs_clonepath.hpp" #include "fs_path.hpp" #include "rv.hpp" #include "rwlock.hpp" #include "ugid.hpp" using std::string; using std::vector; using namespace mergerfs; static inline int _mkdir_core(const string &fullpath, mode_t mode, const mode_t umask) { if(!fs::acl::dir_has_defaults(fullpath)) mode &= ~umask; return fs::mkdir(fullpath,mode); } static int _mkdir_loop_core(const string &existingpath, const string &createpath, const char *fusepath, const char *fusedirpath, const mode_t mode, const mode_t umask, const int error) { int rv; string fullpath; if(createpath != existingpath) { const ugid::SetRootGuard ugidGuard; rv = fs::clonepath(existingpath,createpath,fusedirpath); if(rv == -1) return errno; } fs::path::make(&createpath,fusepath,fullpath); rv = _mkdir_core(fullpath,mode,umask); return error::calc(rv,error,errno); } static int _mkdir_loop(const string &existingpath, const vector &createpaths, const char *fusepath, const char *fusedirpath, const mode_t mode, const mode_t umask) { int error; error = -1; for(size_t i = 0, ei = createpaths.size(); i != ei; i++) { error = _mkdir_loop_core(existingpath,*createpaths[i], fusepath,fusedirpath,mode,umask,error); } return -error; } static int _mkdir(Policy::Func::Search searchFunc, Policy::Func::Create createFunc, const vector &srcmounts, const uint64_t minfreespace, const char *fusepath, const mode_t mode, const mode_t umask) { int rv; string fusedirpath; const char *fusedirpathcstr; vector createpaths; vector existingpaths; fusedirpath = fusepath; fs::path::dirname(fusedirpath); fusedirpathcstr = fusedirpath.c_str(); rv = searchFunc(srcmounts,fusedirpathcstr,minfreespace,existingpaths); if(rv == -1) return -errno; rv = createFunc(srcmounts,fusedirpathcstr,minfreespace,createpaths); if(rv == -1) return -errno; return _mkdir_loop(*existingpaths[0],createpaths, fusepath,fusedirpathcstr,mode,umask); } namespace mergerfs { namespace fuse { int mkdir(const char *fusepath, mode_t mode) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); return _mkdir(config.getattr, config.mkdir, config.srcmounts, config.minfreespace, fusepath, mode, fc->umask); } } } mergerfs-2.21.0/src/config.cpp0000664000175000017500000000620213103454507014562 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include "config.hpp" #include "errno.hpp" #include "fs.hpp" #include "rwlock.hpp" #define MINFREESPACE_DEFAULT (4294967295ULL) #define POLICYINIT(X) X(policies[FuseFunc::Enum::X]) using std::string; using std::vector; namespace mergerfs { Config::Config() : destmount(), srcmounts(), srcmountslock(), minfreespace(MINFREESPACE_DEFAULT), moveonenospc(false), direct_io(false), dropcacheonclose(false), symlinkify(false), symlinkify_timeout(3600), POLICYINIT(access), POLICYINIT(chmod), POLICYINIT(chown), POLICYINIT(create), POLICYINIT(getattr), POLICYINIT(getxattr), POLICYINIT(link), POLICYINIT(listxattr), POLICYINIT(mkdir), POLICYINIT(mknod), POLICYINIT(open), POLICYINIT(readlink), POLICYINIT(removexattr), POLICYINIT(rename), POLICYINIT(rmdir), POLICYINIT(setxattr), POLICYINIT(symlink), POLICYINIT(truncate), POLICYINIT(unlink), POLICYINIT(utimens), controlfile("/.mergerfs") { pthread_rwlock_init(&srcmountslock,NULL); set_category_policy("action","all"); set_category_policy("create","epmfs"); set_category_policy("search","ff"); } int Config::set_func_policy(const string &fusefunc_, const string &policy_) { const Policy *policy; const FuseFunc *fusefunc; fusefunc = FuseFunc::find(fusefunc_); if(fusefunc == FuseFunc::invalid) return (errno=ENODATA,-1); policy = Policy::find(policy_); if(policy == Policy::invalid) return (errno=EINVAL,-1); policies[(FuseFunc::Enum::Type)*fusefunc] = policy; return 0; } int Config::set_category_policy(const string &category_, const string &policy_) { const Policy *policy; const Category *category; category = Category::find(category_); if(category == Category::invalid) return (errno=ENODATA,-1); policy = Policy::find(policy_); if(policy == Policy::invalid) return (errno=EINVAL,-1); for(int i = 0; i < FuseFunc::Enum::END; i++) { if(FuseFunc::fusefuncs[i] == (Category::Enum::Type)*category) policies[(FuseFunc::Enum::Type)FuseFunc::fusefuncs[i]] = policy; } return 0; } } mergerfs-2.21.0/src/destroy.hpp0000664000175000017500000000163413040040376015012 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __DESTROY_HPP__ #define __DESTROY_HPP__ namespace mergerfs { namespace fuse { void destroy(void *); } } #endif mergerfs-2.21.0/src/fusefunc.hpp0000664000175000017500000000726113003720477015147 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FUSEFUNC_HPP__ #define __FUSEFUNC_HPP__ #include #include #include "category.hpp" namespace mergerfs { class FuseFunc { public: struct Enum { enum Type { invalid = -1, BEGIN = 0, access = BEGIN, chmod, chown, create, getattr, getxattr, link, listxattr, mkdir, mknod, open, readlink, removexattr, rename, rmdir, setxattr, symlink, truncate, unlink, utimens, END }; }; private: Enum::Type _enum; std::string _str; Category::Enum::Type _category; public: FuseFunc() : _enum(invalid), _str(invalid), _category(Category::Enum::invalid) { } FuseFunc(const Enum::Type enum_, const std::string &str_, const Category::Enum::Type category_) : _enum(enum_), _str(str_), _category(category_) { } public: operator const Enum::Type() const { return _enum; } operator const std::string&() const { return _str; } operator const Category::Enum::Type() const { return _category; } operator const FuseFunc*() const { return this; } bool operator==(const std::string &str_) const { return _str == str_; } bool operator==(const Enum::Type enum_) const { return _enum == enum_; } bool operator!=(const FuseFunc &r) const { return _enum != r._enum; } bool operator<(const FuseFunc &r) const { return _enum < r._enum; } public: static const FuseFunc &find(const std::string&); static const FuseFunc &find(const Enum::Type); public: static const std::vector _fusefuncs_; static const FuseFunc * const fusefuncs; static const FuseFunc &invalid; static const FuseFunc &access; static const FuseFunc &chmod; static const FuseFunc &chown; static const FuseFunc &create; static const FuseFunc &getattr; static const FuseFunc &getxattr; static const FuseFunc &link; static const FuseFunc &listxattr; static const FuseFunc &mkdir; static const FuseFunc &mknod; static const FuseFunc &open; static const FuseFunc &readlink; static const FuseFunc &removexattr; static const FuseFunc &rename; static const FuseFunc &rmdir; static const FuseFunc &setxattr; static const FuseFunc &symlink; static const FuseFunc &truncate; static const FuseFunc &unlink; static const FuseFunc &utimens; }; } #endif mergerfs-2.21.0/src/fs_base_dirfd.hpp0000664000175000017500000000175113035712542016100 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_DIRFD_HPP__ #define __FS_DIRFD_HPP__ #include #include namespace fs { static inline int dirfd(DIR *dirp) { return ::dirfd(dirp); } } #endif mergerfs-2.21.0/src/unlink.hpp0000664000175000017500000000164613040040376014624 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __UNLINK_HPP__ #define __UNLINK_HPP__ namespace mergerfs { namespace fuse { int unlink(const char *fusepath); } } #endif mergerfs-2.21.0/src/strset.hpp0000664000175000017500000000261613035712542014653 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __STRSET_HPP__ #define __STRSET_HPP__ #include #include "khash.h" KHASH_SET_INIT_STR(strset); class StrSet { public: StrSet() { _set = kh_init(strset); } ~StrSet() { 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)); kh_destroy(strset,_set); } inline int put(const char *str) { int rv; khint_t key; key = kh_put(strset,_set,str,&rv); if(rv == 0) return 0; kh_key(_set,key) = strdup(str); return rv; } private: khash_t(strset) *_set; }; #endif mergerfs-2.21.0/src/fs_base_getxattr.hpp0000664000175000017500000000237013101724730016644 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_GETXATTR_HPP__ #define __FS_BASE_GETXATTR_HPP__ #include #include "errno.hpp" #include "xattr.hpp" namespace fs { static inline int lgetxattr(const std::string &path, const char *attrname, void *value, const size_t size) { #ifndef WITHOUT_XATTR return ::lgetxattr(path.c_str(),attrname,value,size); #else return (errno=ENOTSUP,-1); #endif } } #endif mergerfs-2.21.0/src/fs_attr.cpp0000664000175000017500000000156713035712542014770 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifdef __linux__ # include "fs_attr_linux.icpp" #else # include "fs_attr_unsupported.icpp" #endif mergerfs-2.21.0/src/fs_base_ftruncate.hpp0000664000175000017500000000205113040040376016770 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_FTRUNCATE_HPP__ #define __FS_BASE_FTRUNCATE_HPP__ #include #include namespace fs { static inline int ftruncate(const int fd, const off_t size) { return ::ftruncate(fd,size); } } #endif mergerfs-2.21.0/src/open.hpp0000664000175000017500000000172513040040376014263 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __OPEN_HPP__ #define __OPEN_HPP__ #include namespace mergerfs { namespace fuse { int open(const char *fusepath, fuse_file_info *ffi); } } #endif mergerfs-2.21.0/src/fgetattr.cpp0000664000175000017500000000252013101724730015130 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include "errno.hpp" #include "fileinfo.hpp" #include "fs_base_stat.hpp" #include "fs_inode.hpp" static int _fgetattr(const int fd, struct stat &st) { int rv; rv = fs::fstat(fd,st); if(rv == -1) return -errno; fs::inode::recompute(st); return 0; } namespace mergerfs { namespace fuse { int fgetattr(const char *fusepath, struct stat *st, fuse_file_info *ffi) { FileInfo *fi = reinterpret_cast(ffi->fh); return ::_fgetattr(fi->fd,*st); } } } mergerfs-2.21.0/src/mergerfs.hpp0000664000175000017500000000151313003720477015135 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __MERGER_HPP__ #define __MERGER_HPP__ #endif mergerfs-2.21.0/src/fs_attr.hpp0000664000175000017500000000206313003720476014765 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_ATTR_HPP__ #define __FS_ATTR_HPP__ #include namespace fs { namespace attr { using std::string; int copy(const int fdin, const int fdout); int copy(const string &from, const string &to); } } #endif // __FS_ATTR_HPP__ mergerfs-2.21.0/src/fs_base_truncate.hpp0000664000175000017500000000212513040040376016624 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_TRUNCATE_HPP__ #define __FS_BASE_TRUNCATE_HPP__ #include #include #include namespace fs { static inline int truncate(const std::string &path, const off_t length) { return ::truncate(path.c_str(),length); } } #endif mergerfs-2.21.0/src/listxattr.hpp0000664000175000017500000000175713040040376015365 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __LISTXATTR_HPP__ #define __LISTXATTR_HPP__ namespace mergerfs { namespace fuse { int listxattr(const char *fusepath, char *buf, size_t count); } } #endif mergerfs-2.21.0/src/num.hpp0000664000175000017500000000176413103071706014125 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __NUM_HPP__ #define __NUM_HPP__ #include #include namespace num { int to_uint64_t(const std::string &str, uint64_t &value); int to_time_t(const std::string &str, time_t &value); } #endif mergerfs-2.21.0/src/fs_base_fallocate_unsupported.icpp0000664000175000017500000000174313101724730021553 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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.hpp" namespace fs { int fallocate(const int fd, const int mode, const off_t offset, const off_t len) { return (errno=EOPNOTSUPP,-1); } } mergerfs-2.21.0/src/fs_movefile.cpp0000664000175000017500000000554013101724730015613 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include #include #include "fs.hpp" #include "fs_base_open.hpp" #include "fs_base_close.hpp" #include "fs_base_unlink.hpp" #include "fs_base_stat.hpp" #include "fs_clonefile.hpp" #include "fs_clonepath.hpp" #include "fs_path.hpp" using std::string; using std::vector; namespace fs { int movefile(const vector &basepaths, const string &fusepath, const size_t additional_size, int &origfd) { return fs::movefile(basepaths,fusepath.c_str(),additional_size,origfd); } int movefile(const vector &basepaths, const char *fusepath, const size_t additional_size, int &origfd) { int rv; int fdin; int fdout; int fdin_flags; string fusedir; string fdin_path; string fdout_path; struct stat fdin_st; fdin = origfd; rv = fs::fstat(fdin,fdin_st); if(rv == -1) return -1; fdin_flags = fs::getfl(fdin); if(rv == -1) return -1; rv = fs::findonfs(basepaths,fusepath,fdin,fdin_path); if(rv == -1) return -1; fdin_st.st_size += additional_size; rv = fs::mfs(basepaths,fdin_st.st_size,fdout_path); if(rv == -1) return -1; fusedir = fusepath; fs::path::dirname(fusedir); rv = fs::clonepath(fdin_path,fdout_path,fusedir); if(rv == -1) return -1; fs::path::append(fdin_path,fusepath); fdin = fs::open(fdin_path,O_RDONLY); if(fdin == -1) return -1; fs::path::append(fdout_path,fusepath); fdout = fs::open(fdout_path,fdin_flags|O_CREAT,fdin_st.st_mode); if(fdout == -1) return -1; rv = fs::clonefile(fdin,fdout); if(rv == -1) { fs::close(fdin); fs::close(fdout); fs::unlink(fdout_path); return -1; } // should we care if it fails? fs::unlink(fdin_path); std::swap(origfd,fdout); fs::close(fdin); fs::close(fdout); return 0; } } mergerfs-2.21.0/src/option_parser.cpp0000664000175000017500000002131613103071706016200 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include #include #include #include #include #include #include #include "config.hpp" #include "num.hpp" #include "policy.hpp" #include "str.hpp" #include "version.hpp" using std::string; using std::vector; using namespace mergerfs; enum { MERGERFS_OPT_HELP, MERGERFS_OPT_VERSION }; static void set_option(fuse_args &args, const std::string &option_) { string option; option = "-o" + option_; fuse_opt_insert_arg(&args,1,option.c_str()); } static void set_kv_option(fuse_args &args, const std::string &key, const std::string &value) { std::string option; option = key + '=' + value; set_option(args,option); } static void set_fsname(fuse_args &args, const vector &srcmounts) { if(srcmounts.size() > 0) { std::string fsname; fsname = str::remove_common_prefix_and_join(srcmounts,':'); set_kv_option(args,"fsname",fsname); } } static void set_subtype(fuse_args &args) { set_kv_option(args,"subtype","mergerfs"); } static void set_default_options(fuse_args &args) { set_option(args,"atomic_o_trunc"); set_option(args,"auto_cache"); set_option(args,"big_writes"); set_option(args,"default_permissions"); set_option(args,"splice_move"); set_option(args,"splice_read"); set_option(args,"splice_write"); } static int parse_and_process(const std::string &value, uint64_t &minfreespace) { int rv; rv = num::to_uint64_t(value,minfreespace); if(rv == -1) return 1; return 0; } static int parse_and_process(const std::string &value, time_t &time) { int rv; rv = num::to_time_t(value,time); if(rv == -1) return 1; return 0; } static int parse_and_process(const std::string &value, bool &boolean) { if(value == "false") boolean = false; else if(value == "true") boolean = true; else return 1; return 0; } static int parse_and_process_arg(Config &config, const std::string &arg, fuse_args *outargs) { if(arg == "defaults") return (set_default_options(*outargs),0); else if(arg == "direct_io") return (config.direct_io=true,1); return 1; } static int parse_and_process_kv_arg(Config &config, const std::string &key, const std::string &value) { int rv = -1; std::vector keypart; str::split(keypart,key,'.'); if(keypart.size() == 2) { if(keypart[0] == "func") rv = config.set_func_policy(keypart[1],value); else if(keypart[0] == "category") rv = config.set_category_policy(keypart[1],value); } else { if(key == "minfreespace") rv = parse_and_process(value,config.minfreespace); else if(key == "moveonenospc") rv = parse_and_process(value,config.moveonenospc); else if(key == "dropcacheonclose") rv = parse_and_process(value,config.dropcacheonclose); else if(key == "symlinkify") rv = parse_and_process(value,config.symlinkify); else if(key == "symlinkify_timeout") rv = parse_and_process(value,config.symlinkify_timeout); } if(rv == -1) rv = 1; return rv; } static int process_opt(Config &config, const std::string &arg, fuse_args *outargs) { int rv; std::vector argvalue; str::split(argvalue,arg,'='); switch(argvalue.size()) { case 1: rv = parse_and_process_arg(config,argvalue[0],outargs); break; case 2: rv = parse_and_process_kv_arg(config,argvalue[0],argvalue[1]); break; default: rv = 1; break; }; return rv; } static int process_srcmounts(const char *arg, Config &config) { vector paths; str::split(paths,arg,':'); fs::glob(paths,config.srcmounts); fs::realpathize(config.srcmounts); return 0; } static int process_destmounts(const char *arg, Config &config) { config.destmount = arg; return 1; } static void usage(void) { std::cout << "Usage: mergerfs [options] \n" "\n" " -o [opt,...] mount options\n" " -h --help print help\n" " -v --version print version\n" "\n" "mergerfs options:\n" " ':' delimited list of directories. Supports\n" " shell globbing (must be escaped in shell)\n" " -o defaults Default FUSE options which seem to provide the\n" " best performance: atomic_o_trunc, auto_cache,\n" " big_writes, default_permissions, splice_read,\n" " splice_write, splice_move\n" " -o func.=

Set function to policy

\n" " -o category.=

Set functions in category to

\n" " -o direct_io Bypass additional caching, increases write\n" " speeds at the cost of reads. Please read docs\n" " for more details as there are tradeoffs.\n" " -o use_ino Have mergerfs generate inode values rather than\n" " autogenerated by libfuse. Suggested.\n" " -o minfreespace= minimum free space needed for certain policies.\n" " default=4G\n" " -o moveonenospc= Try to move file to another drive when ENOSPC\n" " on write. default=false\n" " -o dropcacheonclose=\n" " When a file is closed suggest to OS it drop\n" " the file's cache. This is useful when direct_io\n" " is disabled. default=false\n" " -o symlinkify= Read-only files, after a timeout, will be turned\n" " into symlinks. Read docs for limitations and\n" " possible issues. default=false\n" " -o symlinkify_timeout=\n" " timeout in seconds before will turn to symlinks.\n" " default=3600\n" << std::endl; } static void version(void) { std::cout << "mergerfs version: " << MERGERFS_VERSION << std::endl; } static int option_processor(void *data, const char *arg, int key, fuse_args *outargs) { int rv = 0; Config &config = *(Config*)data; switch(key) { case FUSE_OPT_KEY_OPT: rv = process_opt(config,arg,outargs); break; case FUSE_OPT_KEY_NONOPT: rv = config.srcmounts.empty() ? process_srcmounts(arg,config) : process_destmounts(arg,config); break; case MERGERFS_OPT_HELP: usage(); close(2); dup(1); fuse_opt_add_arg(outargs,"-ho"); break; case MERGERFS_OPT_VERSION: version(); fuse_opt_add_arg(outargs,"--version"); break; default: break; } return rv; } namespace mergerfs { namespace options { void parse(fuse_args &args, Config &config) { const struct fuse_opt opts[] = { FUSE_OPT_KEY("-h",MERGERFS_OPT_HELP), FUSE_OPT_KEY("--help",MERGERFS_OPT_HELP), FUSE_OPT_KEY("-v",MERGERFS_OPT_VERSION), FUSE_OPT_KEY("-V",MERGERFS_OPT_VERSION), FUSE_OPT_KEY("--version",MERGERFS_OPT_VERSION), {NULL,-1U,0} }; fuse_opt_parse(&args, &config, opts, ::option_processor); set_fsname(args,config.srcmounts); set_subtype(args); } } } mergerfs-2.21.0/src/assert.hpp0000664000175000017500000000213713040040376014621 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __ASSERT_HPP__ #define __ASSERT_HPP__ #define STATIC_ASSERT(cond) assert::StaticAssert< (cond) >() #define STATIC_ARRAYLENGTH_ASSERT(array,size) STATIC_ASSERT(((sizeof(array)/sizeof(array[0]))==(size))) namespace assert { template struct StaticAssert; template<> struct StaticAssert {}; } #endif mergerfs-2.21.0/src/fs_base_futimesat_generic.icpp0000664000175000017500000000203413072271045020643 0ustar bilebile/* ISC License Copyright (c) 2017, Antonio SJ Musumeci 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 #include namespace fs { int futimesat(const int dirfd, const char *pathname, const struct timeval times[2]) { return ::futimesat(dirfd,pathname,times); } } mergerfs-2.21.0/src/fs_base_statvfs.hpp0000664000175000017500000000226713040040376016500 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_STATVFS_HPP__ #define __FS_BASE_STATVFS_HPP__ #include #include namespace fs { static inline int statvfs(const char *path, struct statvfs &st) { return ::statvfs(path,&st); } static inline int statvfs(const std::string &path, struct statvfs &st) { return fs::statvfs(path.c_str(),st); } } #endif mergerfs-2.21.0/src/symlink.cpp0000664000175000017500000000724613040040376015007 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include "config.hpp" #include "errno.hpp" #include "fs_base_symlink.hpp" #include "fs_clonepath.hpp" #include "fs_path.hpp" #include "rv.hpp" #include "rwlock.hpp" #include "ugid.hpp" using std::string; using std::vector; using namespace mergerfs; static int _symlink_loop_core(const string &existingpath, const string &newbasepath, const char *oldpath, const char *newpath, const char *newdirpath, const int error) { int rv; string fullnewpath; if(newbasepath != existingpath) { const ugid::SetRootGuard ugidGuard; rv = fs::clonepath(existingpath,newbasepath,newdirpath); if(rv == -1) return -1; } fs::path::make(&newbasepath,newpath,fullnewpath); rv = fs::symlink(oldpath,fullnewpath); return error::calc(rv,error,errno); } static int _symlink_loop(const string &existingpath, const vector newbasepaths, const char *oldpath, const char *newpath, const char *newdirpath) { int error; error = -1; for(size_t i = 0, ei = newbasepaths.size(); i != ei; i++) { error = _symlink_loop_core(existingpath,*newbasepaths[i], oldpath,newpath,newdirpath, error); } return -error; } static int _symlink(Policy::Func::Search searchFunc, Policy::Func::Create createFunc, const vector &srcmounts, const uint64_t minfreespace, const char *oldpath, const char *newpath) { int rv; string newdirpath; const char *newdirpathcstr; vector newbasepaths; vector existingpaths; newdirpath = newpath; fs::path::dirname(newdirpath); newdirpathcstr = newdirpath.c_str(); rv = searchFunc(srcmounts,newdirpathcstr,minfreespace,existingpaths); if(rv == -1) return -errno; rv = createFunc(srcmounts,newdirpathcstr,minfreespace,newbasepaths); if(rv == -1) return -errno; return _symlink_loop(*existingpaths[0],newbasepaths, oldpath,newpath,newdirpathcstr); } namespace mergerfs { namespace fuse { int symlink(const char *oldpath, const char *newpath) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); return _symlink(config.getattr, config.symlink, config.srcmounts, config.minfreespace, oldpath, newpath); } } } mergerfs-2.21.0/src/fs_base_utime.hpp0000664000175000017500000000330113101724711016117 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_UTIME_HPP__ #define __FS_BASE_UTIME_HPP__ #ifdef __linux__ # include "fs_base_utime_utimensat.hpp" #elif __FreeBSD__ >= 11 # include "fs_base_utime_utimensat.hpp" #else # include "fs_base_utime_generic.hpp" #endif #include "fs_base_stat.hpp" namespace fs { static inline int utime(const std::string &path, const struct stat &st) { struct timespec times[2]; times[0] = *fs::stat_atime(st); times[1] = *fs::stat_mtime(st); return fs::utime(AT_FDCWD,path,times,0); } static inline int utime(const int fd, const struct stat &st) { struct timespec times[2]; times[0] = *fs::stat_atime(st); times[1] = *fs::stat_mtime(st); return fs::utime(fd,times); } static inline int lutime(const std::string &path, const struct timespec times[2]) { return fs::utime(AT_FDCWD,path,times,AT_SYMLINK_NOFOLLOW); } } #endif mergerfs-2.21.0/src/link.hpp0000664000175000017500000000166513040040376014262 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __LINK_HPP__ #define __LINK_HPP__ namespace mergerfs { namespace fuse { int link(const char *from, const char *to); } } #endif mergerfs-2.21.0/src/utimens.cpp0000664000175000017500000000527413040040376015004 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include "config.hpp" #include "errno.hpp" #include "fs_base_utime.hpp" #include "fs_path.hpp" #include "rv.hpp" #include "rwlock.hpp" #include "ugid.hpp" using std::string; using std::vector; using mergerfs::Policy; static int _utimens_loop_core(const string *basepath, const char *fusepath, const timespec ts[2], const int error) { int rv; string fullpath; fs::path::make(basepath,fusepath,fullpath); rv = fs::lutime(fullpath,ts); return error::calc(rv,error,errno); } static int _utimens_loop(const vector &basepaths, const char *fusepath, const timespec ts[2]) { int error; error = -1; for(size_t i = 0, ei = basepaths.size(); i != ei; i++) { error = _utimens_loop_core(basepaths[i],fusepath,ts,error); } return -error; } static int _utimens(Policy::Func::Action actionFunc, const vector &srcmounts, const uint64_t minfreespace, const char *fusepath, const timespec ts[2]) { int rv; vector basepaths; rv = actionFunc(srcmounts,fusepath,minfreespace,basepaths); if(rv == -1) return -errno; return _utimens_loop(basepaths,fusepath,ts); } namespace mergerfs { namespace fuse { int utimens(const char *fusepath, const timespec ts[2]) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); return _utimens(config.utimens, config.srcmounts, config.minfreespace, fusepath, ts); } } } mergerfs-2.21.0/src/setxattr.hpp0000664000175000017500000000206713101724730015201 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __SETXATTR_HPP__ #define __SETXATTR_HPP__ namespace mergerfs { namespace fuse { int setxattr(const char *fusepath, const char *attrname, const char *attrval, size_t attrvalsize, int flags); } } #endif mergerfs-2.21.0/src/fs_base_futimesat_osx.icpp0000664000175000017500000000375113101724730020044 0ustar bilebile/* ISC License Copyright (c) 2017, Antonio SJ Musumeci 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 #include #include #include #include #include #include #include #include static int getpath(const int dirfd, const char *path, char *fullpath) { int rv; struct stat st; rv = ::fstat(dirfd,&st); if(rv == -1) return -1; if(!S_ISDIR(st.st_mode)) return (errno=ENOTDIR,-1); rv = ::fcntl(dirfd,F_GETPATH,fullpath); if(rv == -1) return -1; rv = ::strlcat(fullpath,"/",MAXPATHLEN); if(rv > MAXPATHLEN) return (errno=ENAMETOOLONG,-1); rv = ::strlcat(fullpath,path,MAXPATHLEN); if(rv > MAXPATHLEN) return (errno=ENAMETOOLONG,-1); return 0; } namespace fs { int futimesat(const int dirfd, const char *pathname, const struct timeval times[2]) { int rv; char fullpath[MAXPATHLEN]; if((dirfd == AT_FDCWD) || ((pathname != NULL) && (pathname[0] == '/'))) return ::utimes(pathname,times); if(dirfd < 0) return (errno=EBADF,-1); rv = getpath(dirfd,pathname,fullpath); if(rv == -1) return -1; return ::utimes(fullpath,times); } } mergerfs-2.21.0/src/buildvector.hpp0000664000175000017500000000237413040040376015645 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __BUILDVECTOR_HPP__ #define __BUILDVECTOR_HPP__ #include template class buildvector { public: buildvector(const V &val) { _vector.push_back(val); } buildvector &operator()(const V &val) { _vector.push_back(val); return *this; } operator std::vector() { if(SORT == true) std::sort(_vector.begin(),_vector.end()); return _vector; } private: std::vector _vector; }; #endif mergerfs-2.21.0/src/removexattr.hpp0000664000175000017500000000173313040040376015701 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __REMOVEXATTR_HPP__ #define __REMOVEXATTR_HPP__ namespace mergerfs { namespace fuse { int removexattr(const char *fusepath, const char *attrname); } } #endif mergerfs-2.21.0/src/ioctl.cpp0000664000175000017500000000656213101724730014434 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include "config.hpp" #include "dirinfo.hpp" #include "errno.hpp" #include "fileinfo.hpp" #include "fs_base_close.hpp" #include "fs_base_ioctl.hpp" #include "fs_base_open.hpp" #include "fs_path.hpp" #include "rwlock.hpp" #include "ugid.hpp" using std::string; using std::vector; using namespace mergerfs; static int _ioctl(const int fd, const unsigned long cmd, void *data) { int rv; rv = fs::ioctl(fd,cmd,data); return ((rv == -1) ? -errno : rv); } static int _ioctl_file(fuse_file_info *ffi, const unsigned long cmd, void *data) { FileInfo *fi = reinterpret_cast(ffi->fh); return _ioctl(fi->fd,cmd,data); } #ifdef FUSE_IOCTL_DIR #ifndef O_NOATIME #define O_NOATIME 0 #endif static int _ioctl_dir_base(Policy::Func::Search searchFunc, const vector &srcmounts, const uint64_t minfreespace, const char *fusepath, const unsigned long cmd, void *data) { int fd; int rv; string fullpath; vector basepaths; rv = searchFunc(srcmounts,fusepath,minfreespace,basepaths); if(rv == -1) return -errno; fs::path::make(basepaths[0],fusepath,fullpath); const int flags = O_RDONLY | O_NOATIME | O_NONBLOCK; fd = fs::open(fullpath,flags); if(fd == -1) return -errno; rv = _ioctl(fd,cmd,data); fs::close(fd); return rv; } static int _ioctl_dir(fuse_file_info *ffi, const unsigned long cmd, void *data) { DirInfo *di = reinterpret_cast(ffi->fh); const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); return _ioctl_dir_base(config.getattr, config.srcmounts, config.minfreespace, di->fusepath.c_str(), cmd, data); } #endif namespace mergerfs { namespace fuse { int ioctl(const char *fusepath, int cmd, void *arg, fuse_file_info *ffi, unsigned int flags, void *data) { #ifdef FUSE_IOCTL_DIR if(flags & FUSE_IOCTL_DIR) return ::_ioctl_dir(ffi,cmd,data); #endif return ::_ioctl_file(ffi,cmd,data); } } } mergerfs-2.21.0/src/release.cpp0000664000175000017500000000307613103454507014743 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include "config.hpp" #include "errno.hpp" #include "fileinfo.hpp" #include "fs_base_close.hpp" #include "fs_base_fadvise.hpp" static int _release(FileInfo *fi, const bool dropcacheonclose) { // according to Feh of nocache calling it once doesn't always work // https://github.com/Feh/nocache if(dropcacheonclose) { fs::fadvise_dontneed(fi->fd); fs::fadvise_dontneed(fi->fd); } fs::close(fi->fd); delete fi; return 0; } namespace mergerfs { namespace fuse { int release(const char *fusepath, fuse_file_info *ffi) { const Config &config = Config::get(); FileInfo *fi = reinterpret_cast(ffi->fh); return _release(fi,config.dropcacheonclose); } } } mergerfs-2.21.0/src/write_buf.cpp0000664000175000017500000000517013101112174015273 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #if WRITE_BUF #include #include #include #include #include #include "config.hpp" #include "errno.hpp" #include "fileinfo.hpp" #include "fs_movefile.hpp" #include "policy.hpp" #include "rwlock.hpp" #include "ugid.hpp" #include "write.hpp" using std::string; using std::vector; using namespace mergerfs; static bool _out_of_space(const int error) { return ((error == ENOSPC) || (error == EDQUOT)); } static int _write_buf(const int fd, fuse_bufvec &src, const off_t offset) { 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); dst.buf->flags = (fuse_buf_flags)(FUSE_BUF_IS_FD|FUSE_BUF_FD_SEEK); dst.buf->fd = fd; dst.buf->pos = offset; return fuse_buf_copy(&dst,&src,cpflags); } namespace mergerfs { namespace fuse { int write_buf(const char *fusepath, fuse_bufvec *src, off_t offset, fuse_file_info *ffi) { int rv; FileInfo *fi = reinterpret_cast(ffi->fh); rv = _write_buf(fi->fd,*src,offset); if(_out_of_space(-rv)) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); if(config.moveonenospc) { size_t extra; const ugid::Set ugid(0,0); const rwlock::ReadGuard readlock(&config.srcmountslock); extra = fuse_buf_size(src); rv = fs::movefile(config.srcmounts,fusepath,extra,fi->fd); if(rv == -1) return -ENOSPC; rv = _write_buf(fi->fd,*src,offset); } } return rv; } } } #endif mergerfs-2.21.0/src/write_buf.hpp0000664000175000017500000000213113003720477015306 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __WRITE_BUF_HPP__ #define __WRITE_BUF_HPP__ #include #include namespace mergerfs { namespace fuse { int write_buf(const char *fusepath, struct fuse_bufvec *buf, off_t offset, fuse_file_info *fi); } } #endif mergerfs-2.21.0/src/resources.cpp0000664000175000017500000000356213003720477015336 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include namespace mergerfs { namespace resources { int reset_umask(void) { umask(0); return 0; } int maxout_rlimit(const int resource) { int rv; struct rlimit rlim; rlim.rlim_cur = RLIM_INFINITY; rlim.rlim_max = RLIM_INFINITY; rv = ::setrlimit(resource,&rlim); if(rv == 0) return 0; rv = ::getrlimit(resource,&rlim); if(rv == -1) return -1; rv = 0; rlim.rlim_cur = rlim.rlim_max; while(rv == 0) { rv = ::setrlimit(resource,&rlim); rlim.rlim_max *= 2; rlim.rlim_cur = rlim.rlim_max; } return rv; } int maxout_rlimit_nofile(void) { return maxout_rlimit(RLIMIT_NOFILE); } int maxout_rlimit_fsize(void) { return maxout_rlimit(RLIMIT_FSIZE); } int setpriority(const int prio) { const int SELF = 0; return ::setpriority(PRIO_PROCESS,SELF,prio); } } } mergerfs-2.21.0/src/fsync.hpp0000664000175000017500000000177613040040376014452 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FSYNC_HPP__ #define __FSYNC_HPP__ #include namespace mergerfs { namespace fuse { int fsync(const char *fusepath, int isdatasync, fuse_file_info *fi); } } #endif mergerfs-2.21.0/src/str.cpp0000664000175000017500000000652213003720477014133 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include using std::string; using std::vector; using std::istringstream; namespace str { void split(vector &result, const char *str, const char delimiter) { string part; istringstream ss(str); while(std::getline(ss,part,delimiter)) result.push_back(part); } void split(vector &result, const string &str, const char delimiter) { return split(result,str.c_str(),delimiter); } string join(const vector &vec, const size_t substridx, const char sep) { if(vec.empty()) return string(); string rv = vec[0].substr(substridx); for(size_t i = 1; i < vec.size(); i++) rv += sep + vec[i].substr(substridx); return rv; } string join(const vector &vec, const char sep) { return str::join(vec,0,sep); } size_t longest_common_prefix_index(const vector &vec) { if(vec.empty()) return string::npos; for(size_t n = 0; n < vec[0].size(); n++) { char chr = vec[0][n]; for(size_t i = 1; i < vec.size(); i++) { if(n >= vec[i].size()) return n; if(vec[i][n] != chr) return n; } } return string::npos; } string longest_common_prefix(const vector &vec) { size_t idx; idx = longest_common_prefix_index(vec); if(idx != string::npos) return vec[0].substr(0,idx); return string(); } string remove_common_prefix_and_join(const vector &vec, const char sep) { size_t idx; idx = str::longest_common_prefix_index(vec); if(idx == string::npos) idx = 0; return str::join(vec,idx,sep); } void erase_fnmatches(const vector &patterns, vector &strs) { vector::iterator si; vector::const_iterator pi; si = strs.begin(); while(si != strs.end()) { int match = FNM_NOMATCH; for(pi = patterns.begin(); pi != patterns.end() && match != 0; ++pi) { match = fnmatch(pi->c_str(),si->c_str(),0); } if(match == 0) si = strs.erase(si); else ++si; } } bool isprefix(const string &s0, const string &s1) { return ((s0.size() >= s1.size()) && (s0.compare(0,s1.size(),s1) == 0)); } } mergerfs-2.21.0/src/fs_base_ioctl.hpp0000664000175000017500000000210113101724730016104 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_IOCTL_HPP__ #define __FS_BASE_IOCTL_HPP__ #include namespace fs { static inline int ioctl(const int fd, const unsigned long request, void *data) { return ::ioctl(fd,request,data); } } #endif mergerfs-2.21.0/src/getxattr.cpp0000664000175000017500000002122013103071706015150 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include #include #include #include #include "config.hpp" #include "errno.hpp" #include "fs_base_getxattr.hpp" #include "fs_path.hpp" #include "rwlock.hpp" #include "str.hpp" #include "ugid.hpp" #include "version.hpp" using std::string; using std::vector; using std::set; using namespace mergerfs; static int _lgetxattr(const string &path, const char *attrname, void *value, const size_t size) { int rv; rv = fs::lgetxattr(path,attrname,value,size); return ((rv == -1) ? -errno : rv); } static void _getxattr_controlfile_fusefunc_policy(const Config &config, const string &attr, string &attrvalue) { FuseFunc fusefunc; fusefunc = FuseFunc::find(attr); if(fusefunc != FuseFunc::invalid) attrvalue = (std::string)*config.policies[(FuseFunc::Enum::Type)*fusefunc]; } static void _getxattr_controlfile_category_policy(const Config &config, const string &attr, string &attrvalue) { Category cat; cat = Category::find(attr); if(cat != Category::invalid) { vector policies; for(int i = FuseFunc::Enum::BEGIN; i < FuseFunc::Enum::END; i++) { if(cat == (Category::Enum::Type)*FuseFunc::fusefuncs[i]) policies.push_back(*config.policies[i]); } std::sort(policies.begin(),policies.end()); policies.erase(std::unique(policies.begin(),policies.end()), policies.end()); attrvalue = str::join(policies,','); } } static void _getxattr_controlfile_srcmounts(const Config &config, string &attrvalue) { attrvalue = str::join(config.srcmounts,':'); } static void _getxattr_controlfile_uint64_t(const uint64_t uint, string &attrvalue) { std::ostringstream os; os << uint; attrvalue = os.str(); } static void _getxattr_controlfile_time_t(const time_t time, string &attrvalue) { std::ostringstream os; os << time; attrvalue = os.str(); } static void _getxattr_controlfile_bool(const bool boolvalue, string &attrvalue) { attrvalue = (boolvalue ? "true" : "false"); } static void _getxattr_controlfile_policies(const Config &config, string &attrvalue) { size_t i = Policy::Enum::begin(); attrvalue = (string)Policy::policies[i]; for(i++; i < Policy::Enum::end(); i++) attrvalue += ',' + (string)Policy::policies[i]; } static void _getxattr_controlfile_version(string &attrvalue) { attrvalue = MERGERFS_VERSION; } static void _getxattr_pid(string &attrvalue) { int pid; char buf[32]; pid = getpid(); snprintf(buf,sizeof(buf),"%d",pid); attrvalue = buf; } static int _getxattr_controlfile(const Config &config, const char *attrname, char *buf, const size_t count) { size_t len; string attrvalue; vector attr; str::split(attr,attrname,'.'); if((attr[0] != "user") || (attr[1] != "mergerfs")) return -ENOATTR; switch(attr.size()) { case 3: if(attr[2] == "srcmounts") _getxattr_controlfile_srcmounts(config,attrvalue); else if(attr[2] == "minfreespace") _getxattr_controlfile_uint64_t(config.minfreespace,attrvalue); else if(attr[2] == "moveonenospc") _getxattr_controlfile_bool(config.moveonenospc,attrvalue); else if(attr[2] == "dropcacheonclose") _getxattr_controlfile_bool(config.dropcacheonclose,attrvalue); else if(attr[2] == "symlinkify") _getxattr_controlfile_bool(config.symlinkify,attrvalue); else if(attr[2] == "symlinkify_timeout") _getxattr_controlfile_time_t(config.symlinkify_timeout,attrvalue); else if(attr[2] == "policies") _getxattr_controlfile_policies(config,attrvalue); else if(attr[2] == "version") _getxattr_controlfile_version(attrvalue); else if(attr[2] == "pid") _getxattr_pid(attrvalue); break; case 4: if(attr[2] == "category") _getxattr_controlfile_category_policy(config,attr[3],attrvalue); else if(attr[2] == "func") _getxattr_controlfile_fusefunc_policy(config,attr[3],attrvalue); break; } if(attrvalue.empty()) return -ENOATTR; len = attrvalue.size(); if(count == 0) return len; if(count < len) return -ERANGE; memcpy(buf,attrvalue.c_str(),len); return (int)len; } static int _getxattr_from_string(char *destbuf, const size_t destbufsize, const string &src) { const size_t srcbufsize = src.size(); if(destbufsize == 0) return srcbufsize; if(srcbufsize > destbufsize) return -ERANGE; memcpy(destbuf,src.data(),srcbufsize); return srcbufsize; } static int _getxattr_user_mergerfs_allpaths(const vector &srcmounts, const char *fusepath, char *buf, const size_t count) { string concated; vector paths; fs::findallfiles(srcmounts,fusepath,paths); concated = str::join(paths,'\0'); return _getxattr_from_string(buf,count,concated); } static int _getxattr_user_mergerfs(const string &basepath, const char *fusepath, const string &fullpath, const vector &srcmounts, const char *attrname, char *buf, const size_t count) { vector attr; str::split(attr,attrname,'.'); if(attr[2] == "basepath") return _getxattr_from_string(buf,count,basepath); else if(attr[2] == "relpath") return _getxattr_from_string(buf,count,fusepath); else if(attr[2] == "fullpath") return _getxattr_from_string(buf,count,fullpath); else if(attr[2] == "allpaths") return _getxattr_user_mergerfs_allpaths(srcmounts,fusepath,buf,count); return -ENOATTR; } static int _getxattr(Policy::Func::Search searchFunc, const vector &srcmounts, const size_t minfreespace, const char *fusepath, const char *attrname, char *buf, const size_t count) { int rv; string fullpath; vector basepaths; rv = searchFunc(srcmounts,fusepath,minfreespace,basepaths); if(rv == -1) return -errno; fs::path::make(basepaths[0],fusepath,fullpath); if(str::isprefix(attrname,"user.mergerfs.")) rv = _getxattr_user_mergerfs(*basepaths[0],fusepath,fullpath,srcmounts,attrname,buf,count); else rv = _lgetxattr(fullpath,attrname,buf,count); return rv; } namespace mergerfs { namespace fuse { int getxattr(const char *fusepath, const char *attrname, char *buf, size_t count) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); if(fusepath == config.controlfile) return _getxattr_controlfile(config, attrname, buf, count); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); return _getxattr(config.getxattr, config.srcmounts, config.minfreespace, fusepath, attrname, buf, count); } } } mergerfs-2.21.0/src/fgetattr.hpp0000664000175000017500000000207213040040376015136 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FGETATTR_HPP__ #define __FGETATTR_HPP__ #include #include #include namespace mergerfs { namespace fuse { int fgetattr(const char *fusepath, struct stat *st, fuse_file_info *fileinfo); } } #endif mergerfs-2.21.0/src/releasedir.hpp0000664000175000017500000000175513040040376015444 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __RELEASEDIR_HPP__ #define __RELEASEDIR_HPP__ #include namespace mergerfs { namespace fuse { int releasedir(const char *fusepath, fuse_file_info *ffi); } } #endif mergerfs-2.21.0/src/getattr.cpp0000664000175000017500000000603613103071706014770 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include "config.hpp" #include "errno.hpp" #include "fs_base_stat.hpp" #include "fs_inode.hpp" #include "fs_path.hpp" #include "rwlock.hpp" #include "symlinkify.hpp" #include "ugid.hpp" using std::string; using std::vector; using mergerfs::Policy; static int _getattr_controlfile(struct stat &st) { static const uid_t uid = ::getuid(); static const gid_t gid = ::getgid(); static const time_t now = ::time(NULL); st.st_dev = 0; st.st_ino = fs::inode::MAGIC; st.st_mode = (S_IFREG|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH); st.st_nlink = 1; st.st_uid = uid; st.st_gid = gid; st.st_rdev = 0; st.st_size = 0; st.st_blksize = 512; st.st_blocks = 0; st.st_atime = now; st.st_mtime = now; st.st_ctime = now; return 0; } static int _getattr(Policy::Func::Search searchFunc, const vector &srcmounts, const uint64_t minfreespace, const char *fusepath, struct stat &st, const bool symlinkify, const time_t symlinkify_timeout) { int rv; string fullpath; vector basepaths; rv = searchFunc(srcmounts,fusepath,minfreespace,basepaths); if(rv == -1) return -errno; fs::path::make(basepaths[0],fusepath,fullpath); rv = fs::lstat(fullpath,st); if(rv == -1) return -errno; if(symlinkify && symlinkify::can_be_symlink(st,symlinkify_timeout)) st.st_mode = symlinkify::convert(st.st_mode); fs::inode::recompute(st); return 0; } namespace mergerfs { namespace fuse { int getattr(const char *fusepath, struct stat *st) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); if(fusepath == config.controlfile) return _getattr_controlfile(*st); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); return _getattr(config.getattr, config.srcmounts, config.minfreespace, fusepath, *st, config.symlinkify, config.symlinkify_timeout); } } } mergerfs-2.21.0/src/fs_base_link.hpp0000664000175000017500000000207213040040376015735 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_LINK_HPP__ #define __FS_BASE_LINK_HPP__ #include #include namespace fs { static inline int link(const std::string &oldpath, const std::string &newpath) { return ::link(oldpath.c_str(),newpath.c_str()); } } #endif mergerfs-2.21.0/src/truncate.hpp0000664000175000017500000000174313040040376015147 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __TRUNCATE_HPP__ #define __TRUNCATE_HPP__ #include namespace mergerfs { namespace fuse { int truncate(const char *fusepath, off_t size); } } #endif mergerfs-2.21.0/src/rv.hpp0000664000175000017500000000206613040040376013750 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __RV_HPP__ #define __RV_HPP__ namespace error { static inline int calc(const int rv, const int prev, const int cur) { if(rv == -1) { if(prev == 0) return 0; return cur; } return 0; } } #endif // __RV_HPP__ mergerfs-2.21.0/src/fs_sendfile.cpp0000664000175000017500000000157713035712542015610 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifdef __linux__ # include "fs_sendfile_linux.icpp" #else # include "fs_sendfile_unsupported.icpp" #endif mergerfs-2.21.0/src/symlinkify.hpp0000664000175000017500000000255413103071706015522 0ustar bilebile/* ISC License Copyright (c) 2017, Antonio SJ Musumeci 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. */ #ifndef __SYMLINKIFY_HPP__ #define __SYMLINKIFY_HPP__ #include #include namespace symlinkify { static inline bool can_be_symlink(const struct stat &st, const time_t timeout) { if(S_ISDIR(st.st_mode) || (st.st_mode & (S_IWUSR|S_IWGRP|S_IWOTH))) return false; const time_t now = ::time(NULL); return (((now - st.st_mtime) > timeout) && ((now - st.st_ctime) > timeout)); } static inline mode_t convert(const mode_t mode) { return ((mode & ~S_IFMT) | S_IFLNK); } } #endif mergerfs-2.21.0/src/policy_newest.cpp0000664000175000017500000000604213101725025016175 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include "errno.hpp" #include "fs.hpp" #include "fs_path.hpp" #include "policy.hpp" #include "success_fail.hpp" using std::string; using std::vector; static int _newest_create(const vector &basepaths, const char *fusepath, vector &paths) { time_t newest; string fullpath; const string *newestbasepath; newest = std::numeric_limits::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); if(!fs::exists(fullpath,st)) continue; if(st.st_mtime < newest) continue; if(fs::readonly(*basepath)) continue; newest = st.st_mtime; newestbasepath = basepath; } if(newestbasepath == NULL) return POLICY_FAIL_ENOENT; paths.push_back(newestbasepath); return POLICY_SUCCESS; } static int _newest_other(const vector &basepaths, const char *fusepath, vector &paths) { time_t newest; string fullpath; const string *newestbasepath; newest = std::numeric_limits::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); if(!fs::exists(fullpath,st)) continue; if(st.st_mtime < newest) continue; newest = st.st_mtime; newestbasepath = basepath; } if(newestbasepath == NULL) return POLICY_FAIL_ENOENT; paths.push_back(newestbasepath); return POLICY_SUCCESS; } namespace mergerfs { int Policy::Func::newest(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { if(type == Category::Enum::create) return _newest_create(basepaths,fusepath,paths); return _newest_other(basepaths,fusepath,paths); } } mergerfs-2.21.0/src/buildmap.hpp0000664000175000017500000000236413040040376015117 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __BUILDMAP_HPP__ #define __BUILDMAP_HPP__ #include template class buildmap { public: buildmap(const K &key, const V &val) { _map.insert(std::make_pair(key,val)); } buildmap &operator()(const K &key, const V &val) { _map.insert(std::make_pair(key,val)); return *this; } operator std::map() { return _map; } private: std::map _map; }; #endif mergerfs-2.21.0/src/fs_attr_linux.icpp0000664000175000017500000000561113101724730016346 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include "errno.hpp" #include "fs_base_close.hpp" #include "fs_base_open.hpp" #include "fs_base_ioctl.hpp" using std::string; namespace fs { namespace attr { static int get_fs_ioc_flags(const int fd, int &flags) { int rv; rv = fs::ioctl(fd,FS_IOC_GETFLAGS,(void*)&flags); if((rv == -1) && (errno == EINVAL)) errno = ENOTSUP; return rv; } static int get_fs_ioc_flags(const string &file, int &flags) { int fd; int rv; const int openflags = O_RDONLY|O_NONBLOCK; fd = fs::open(file,openflags); if(fd == -1) return -1; rv = get_fs_ioc_flags(fd,flags); if(rv == -1) { int error = errno; fs::close(fd); errno = error; return -1; } return fs::close(fd); } static int set_fs_ioc_flags(const int fd, const int flags) { int rv; rv = fs::ioctl(fd,FS_IOC_SETFLAGS,(void*)&flags); if((rv == -1) && (errno == EINVAL)) errno = ENOTSUP; return rv; } static int set_fs_ioc_flags(const string &file, const int flags) { int fd; int rv; const int openflags = O_RDONLY|O_NONBLOCK; fd = fs::open(file,openflags); if(fd == -1) return -1; rv = set_fs_ioc_flags(fd,flags); if(rv == -1) { int error = errno; fs::close(fd); errno = error; return -1; } return fs::close(fd); } int copy(const int fdin, const int fdout) { int rv; int flags; rv = get_fs_ioc_flags(fdin,flags); if(rv == -1) return -1; return set_fs_ioc_flags(fdout,flags); } int copy(const string &from, const string &to) { int rv; int flags; rv = get_fs_ioc_flags(from,flags); if(rv == -1) return -1; return set_fs_ioc_flags(to,flags); } } } mergerfs-2.21.0/src/flush.hpp0000664000175000017500000000170113040040376014435 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FLUSH_HPP__ #define __FLUSH_HPP__ namespace mergerfs { namespace fuse { int flush(const char *path, fuse_file_info *fi); } } #endif mergerfs-2.21.0/src/chown.cpp0000664000175000017500000000546413040040376014437 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include "config.hpp" #include "errno.hpp" #include "fs_base_chown.hpp" #include "fs_path.hpp" #include "rv.hpp" #include "rwlock.hpp" #include "ugid.hpp" using std::string; using std::vector; using mergerfs::Policy; using mergerfs::Config; static int _chown_loop_core(const string *basepath, const char *fusepath, const uid_t uid, const gid_t gid, const int error) { int rv; string fullpath; fs::path::make(basepath,fusepath,fullpath); rv = fs::lchown(fullpath,uid,gid); return error::calc(rv,error,errno); } static int _chown_loop(const vector &basepaths, const char *fusepath, const uid_t uid, const gid_t gid) { int error; error = -1; for(size_t i = 0, ei = basepaths.size(); i != ei; i++) { error = _chown_loop_core(basepaths[i],fusepath,uid,gid,error); } return -error; } static int _chown(Policy::Func::Action actionFunc, const vector &srcmounts, const uint64_t minfreespace, const char *fusepath, const uid_t uid, const gid_t gid) { int rv; vector basepaths; rv = actionFunc(srcmounts,fusepath,minfreespace,basepaths); if(rv == -1) return -errno; return _chown_loop(basepaths,fusepath,uid,gid); } namespace mergerfs { namespace fuse { int chown(const char *fusepath, uid_t uid, gid_t gid) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); return _chown(config.chown, config.srcmounts, config.minfreespace, fusepath, uid, gid); } } } mergerfs-2.21.0/src/create.hpp0000664000175000017500000000202613040040376014560 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __CREATE_HPP__ #define __CREATE_HPP__ #include #include namespace mergerfs { namespace fuse { int create(const char *fusepath, mode_t mode, fuse_file_info *ffi); } } #endif mergerfs-2.21.0/src/init.cpp0000664000175000017500000000214613037464211014262 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include "config.hpp" #include "ugid.hpp" namespace mergerfs { namespace fuse { void * init(fuse_conn_info *conn) { ugid::init(); conn->want |= FUSE_CAP_DONT_MASK; #ifdef FUSE_CAP_IOCTL_DIR conn->want |= FUSE_CAP_IOCTL_DIR; #endif return &Config::get_writable(); } } } mergerfs-2.21.0/src/write.cpp0000664000175000017500000000613613101724730014451 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include "config.hpp" #include "errno.hpp" #include "fileinfo.hpp" #include "fs_base_write.hpp" #include "fs_movefile.hpp" #include "rwlock.hpp" #include "ugid.hpp" using namespace mergerfs; typedef int (*WriteFunc)(const int,const void*,const size_t,const off_t); static bool _out_of_space(const int error) { return ((error == ENOSPC) || (error == EDQUOT)); } static inline int _write(const int fd, const void *buf, const size_t count, const off_t offset) { int rv; rv = fs::pwrite(fd,buf,count,offset); if(rv == -1) return -errno; if(rv == 0) return 0; return count; } static inline int _write_direct_io(const int fd, const void *buf, const size_t count, const off_t offset) { int rv; rv = fs::pwrite(fd,buf,count,offset); if(rv == -1) return -errno; return rv; } namespace mergerfs { namespace fuse { static inline int write(WriteFunc func, const char *buf, const size_t count, const off_t offset, fuse_file_info *ffi) { int rv; FileInfo* fi = reinterpret_cast(ffi->fh); rv = func(fi->fd,buf,count,offset); if(_out_of_space(-rv)) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); if(config.moveonenospc) { const ugid::Set ugid(0,0); const rwlock::ReadGuard readlock(&config.srcmountslock); rv = fs::movefile(config.srcmounts,fi->fusepath,count,fi->fd); if(rv == -1) return -ENOSPC; rv = func(fi->fd,buf,count,offset); } } return rv; } int write(const char *fusepath, const char *buf, size_t count, off_t offset, fuse_file_info *ffi) { return write(_write,buf,count,offset,ffi); } int write_direct_io(const char *fusepath, const char *buf, size_t count, off_t offset, fuse_file_info *ffi) { return write(_write_direct_io,buf,count,offset,ffi); } } } mergerfs-2.21.0/src/fs_base_access.hpp0000664000175000017500000000274513040040376016250 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_ACCESS_HPP__ #define __FS_BASE_ACCESS_HPP__ #include #include #include namespace fs { static inline int access(const int dirfd, const std::string &path, const int mode, const int flags) { return ::faccessat(dirfd,path.c_str(),mode,flags); } static inline int access(const std::string &path, const int mode, const int flags) { return fs::access(AT_FDCWD,path,mode,flags); } static inline int eaccess(const std::string &path, const int mode) { return fs::access(path,mode,AT_EACCESS); } } #endif mergerfs-2.21.0/src/num.cpp0000664000175000017500000000322113103071706014106 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include namespace num { int to_uint64_t(const std::string &str, uint64_t &value) { char *endptr; uint64_t tmp; tmp = strtoll(str.c_str(),&endptr,10); switch(*endptr) { case 'k': case 'K': tmp *= 1024; break; case 'm': case 'M': tmp *= (1024 * 1024); break; case 'g': case 'G': tmp *= (1024 * 1024 * 1024); break; case '\0': break; default: return -1; } value = tmp; return 0; } int to_time_t(const std::string &str, time_t &value) { time_t tmp; char *endptr; tmp = strtoll(str.c_str(),&endptr,10); if(*endptr != '\0') return -1; if(tmp < 0) return -1; value = tmp; return 0; } } mergerfs-2.21.0/src/fs_base_fallocate.hpp0000664000175000017500000000200513101724730016727 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_FALLOCATE_HPP__ #define __FS_BASE_FALLOCATE_HPP__ #include namespace fs { int fallocate(const int fd, const int mode, const off_t offset, const off_t len); } #endif mergerfs-2.21.0/src/statfs.hpp0000664000175000017500000000171513040040376014625 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __STATFS_HPP__ #define __STATFS_HPP__ namespace mergerfs { namespace fuse { int statfs(const char *fusepath, struct statvfs *fsstat); } } #endif mergerfs-2.21.0/src/fs_base_fadvise.cpp0000664000175000017500000000361613101724730016422 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #if _XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L # include "fs_base_fadvise_posix.icpp" #else # include "fs_base_fadvise_unsupported.icpp" #endif #ifndef POSIX_FADV_NORMAL # define POSIX_FADV_NORMAL 0 #endif #ifndef POSIX_FADV_RANDOM # define POSIX_FADV_RANDOM 1 #endif #ifndef POSIX_FADV_SEQUENTIAL # define POSIX_FADV_SEQUENTIAL 2 #endif #ifndef POSIX_FADV_WILLNEED # define POSIX_FADV_WILLNEED 3 #endif #ifndef POSIX_FADV_DONTNEED # define POSIX_FADV_DONTNEED 4 #endif #ifndef POSIX_FADV_NOREUSE # define POSIX_FADV_NOREUSE 5 #endif namespace fs { int fadvise_dontneed(const int fd, const off_t offset, const off_t len) { return fs::fadvise(fd,offset,len,POSIX_FADV_DONTNEED); } int fadvise_willneed(const int fd, const off_t offset, const off_t len) { return fs::fadvise(fd,offset,len,POSIX_FADV_WILLNEED); } int fadvise_sequential(const int fd, const off_t offset, const off_t len) { return fs::fadvise(fd,offset,len,POSIX_FADV_SEQUENTIAL); } } mergerfs-2.21.0/src/fs_base_unlink.hpp0000664000175000017500000000201113040040376016271 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_UNLINK_HPP__ #define __FS_BASE_UNLINK_HPP__ #include #include namespace fs { static inline int unlink(const std::string &path) { return ::unlink(path.c_str()); } } #endif mergerfs-2.21.0/src/release.hpp0000664000175000017500000000171513040040376014741 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __RELEASE_HPP__ #define __RELEASE_HPP__ namespace mergerfs { namespace fuse { int release(const char *fusepath, fuse_file_info *fi); } } #endif mergerfs-2.21.0/src/policy_erofs.cpp0000664000175000017500000000240113101725025016001 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include "errno.hpp" #include "policy.hpp" using std::string; using std::vector; namespace mergerfs { int Policy::Func::erofs(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { return POLICY_FAIL_ERRNO(EROFS); } } mergerfs-2.21.0/src/fs_base_dup.hpp0000664000175000017500000000172513040040376015574 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_DUP_HPP__ #define __FS_BASE_DUP_HPP__ #include namespace fs { static inline int dup(const int fd) { return ::dup(fd); } } #endif mergerfs-2.21.0/src/policy_lus.cpp0000664000175000017500000000666013101725025015501 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include "errno.hpp" #include "fs.hpp" #include "fs_path.hpp" #include "policy.hpp" using std::string; using std::vector; using mergerfs::Category; static int _lus_create(const vector &basepaths, const uint64_t minfreespace, vector &paths) { string fullpath; uint64_t lus; const string *lusbasepath; lus = std::numeric_limits::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]; if(!fs::info(*basepath,readonly,spaceavail,spaceused)) continue; if(readonly) continue; if(spaceavail < minfreespace) continue; if(spaceused >= lus) continue; lus = spaceused; lusbasepath = basepath; } if(lusbasepath == NULL) return POLICY_FAIL_ENOENT; paths.push_back(lusbasepath); return POLICY_SUCCESS; } static int _lus_other(const vector &basepaths, const char *fusepath, vector &paths) { string fullpath; uint64_t lus; 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); if(!fs::exists(fullpath)) continue; if(!fs::spaceused(*basepath,spaceused)) continue; if(spaceused >= lus) continue; lus = spaceused; lusbasepath = basepath; } if(lusbasepath == NULL) return POLICY_FAIL_ENOENT; paths.push_back(lusbasepath); return POLICY_SUCCESS; } static int _lus(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { if(type == Category::Enum::create) return _lus_create(basepaths,minfreespace,paths); return _lus_other(basepaths,fusepath,paths); } namespace mergerfs { int Policy::Func::lus(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { int rv; rv = _lus(type,basepaths,fusepath,minfreespace,paths); if(POLICY_FAILED(rv)) rv = Policy::Func::mfs(type,basepaths,fusepath,minfreespace,paths); return rv; } } mergerfs-2.21.0/src/fs_xattr.hpp0000664000175000017500000000371113035712542015156 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_XATTR_HPP__ #define __FS_XATTR_HPP__ #include #include #include namespace fs { namespace xattr { using std::string; using std::vector; using std::map; int list(const string &path, vector &attrs); int list(const string &path, string &attrs); int list(const string &path, vector &attrs); int get(const string &path, const string &attr, vector &value); int get(const string &path, const string &attr, string &value); int get(const string &path, map &attrs); int set(const string &path, const string &key, const string &value, const int flags); int set(const int fd, const string &key, const string &value, const int flags); int set(const string &path, const map &attrs); int copy(const int fdin, const int fdout); int copy(const string &from, const string &to); } } #endif // __FS_HPP__ mergerfs-2.21.0/src/fs_path.cpp0000664000175000017500000000263713003720477014752 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include #include "fs_path.hpp" using std::string; namespace fs { namespace path { void dirname(string &path) { string::reverse_iterator i; string::reverse_iterator bi; bi = path.rend(); i = path.rbegin(); while(*i == '/' && i != bi) i++; while(*i != '/' && i != bi) i++; while(*i == '/' && i != bi) i++; path.erase(i.base(),path.end()); } string basename(const string &path) { return path.substr(path.find_last_of('/')+1); } } } mergerfs-2.21.0/src/getxattr.hpp0000664000175000017500000000201513101724730015156 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __GETXATTR_HPP__ #define __GETXATTR_HPP__ namespace mergerfs { namespace fuse { int getxattr(const char *fusepath, const char *attrname, char *buf, size_t count); } } #endif mergerfs-2.21.0/src/policy_eprand.cpp0000664000175000017500000000271413101725025016143 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include "errno.hpp" #include "policy.hpp" #include "success_fail.hpp" using std::string; using std::vector; namespace mergerfs { int Policy::Func::eprand(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { int rv; rv = Policy::Func::epall(type,basepaths,fusepath,minfreespace,paths); if(POLICY_SUCCEEDED(rv)) std::random_shuffle(paths.begin(),paths.end()); return rv; } } mergerfs-2.21.0/src/opendir.cpp0000664000175000017500000000203713101724730014753 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include "dirinfo.hpp" namespace mergerfs { namespace fuse { int opendir(const char *fusepath, fuse_file_info *ffi) { ffi->fh = reinterpret_cast(new DirInfo(fusepath)); return 0; } } } mergerfs-2.21.0/src/access.cpp0000664000175000017500000000406413037445067014571 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include "config.hpp" #include "errno.hpp" #include "fs_base_access.hpp" #include "fs_path.hpp" #include "rwlock.hpp" #include "ugid.hpp" using std::string; using std::vector; using mergerfs::Policy; using mergerfs::Category; static int _access(Policy::Func::Search searchFunc, const vector &srcmounts, const uint64_t minfreespace, const char *fusepath, const int mask) { int rv; string fullpath; vector basepaths; rv = searchFunc(srcmounts,fusepath,minfreespace,basepaths); if(rv == -1) return -errno; fs::path::make(basepaths[0],fusepath,fullpath); rv = fs::eaccess(fullpath,mask); return ((rv == -1) ? -errno : 0); } namespace mergerfs { namespace fuse { int access(const char *fusepath, int mask) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); return _access(config.access, config.srcmounts, config.minfreespace, fusepath, mask); } } } mergerfs-2.21.0/src/fs_attr_unsupported.icpp0000664000175000017500000000211013101724730017566 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include "errno.hpp" namespace fs { namespace attr { int copy(const int fdin, const int fdout) { return (errno=ENOTSUP,-1); } int copy(const std::string &from, const std::string &to) { return (errno=ENOTSUP,-1); } } } mergerfs-2.21.0/src/read.cpp0000664000175000017500000000411613101724730014226 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include "errno.hpp" #include "fileinfo.hpp" #include "fs_base_read.hpp" static inline int _read(const int fd, void *buf, const size_t count, const off_t offset) { int rv; rv = fs::pread(fd,buf,count,offset); if(rv == -1) return -errno; if(rv == 0) return 0; return count; } static inline int _read_direct_io(const int fd, void *buf, const size_t count, const off_t offset) { int rv; rv = fs::pread(fd,buf,count,offset); if(rv == -1) return -errno; return rv; } namespace mergerfs { namespace fuse { int read(const char *fusepath, char *buf, size_t count, off_t offset, fuse_file_info *ffi) { FileInfo *fi = reinterpret_cast(ffi->fh); return ::_read(fi->fd,buf,count,offset); } int read_direct_io(const char *fusepath, char *buf, size_t count, off_t offset, fuse_file_info *ffi) { FileInfo *fi = reinterpret_cast(ffi->fh); return ::_read_direct_io(fi->fd,buf,count,offset); } } } mergerfs-2.21.0/src/fs_base_fadvise_posix.icpp0000664000175000017500000000201213101724730020002 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include "errno.hpp" namespace fs { static int fadvise(const int fd, const off_t offset, const off_t len, const int advice) { return ::posix_fadvise(fd,offset,len,advice); } } mergerfs-2.21.0/src/flock.hpp0000664000175000017500000000174413040040376014421 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FLOCK_HPP__ #define __FLOCK_HPP__ namespace mergerfs { namespace fuse { int flock(const char *fusepath, fuse_file_info *ffi, int op); } } #endif mergerfs-2.21.0/src/fs_base_futimesat.hpp0000664000175000017500000000201213101724730016774 0ustar bilebile/* ISC License Copyright (c) 2017, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_FUTIMESAT_HPP__ #define __FS_BASE_FUTIMESAT_HPP__ namespace fs { int futimesat(const int dirfd, const char *pathname, const struct timeval times[2]); } #endif mergerfs-2.21.0/src/policy.hpp0000664000175000017500000001277713101725025014631 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __POLICY_HPP__ #define __POLICY_HPP__ #include #include #include #include "fs.hpp" #include "category.hpp" #define POLICY_SUCCESS 0 #define POLICY_FAIL -1 #define POLICY_SUCCEEDED(RV) ((RV) == POLICY_SUCCESS) #define POLICY_FAILED(RV) ((RV) == POLICY_FAIL) #define POLICY_FAIL_ERRNO(ERRNO) (errno=ERRNO,POLICY_FAIL) #define POLICY_FAIL_ENOENT POLICY_FAIL_ERRNO(ENOENT) namespace mergerfs { class Policy { public: struct Enum { enum Type { invalid = -1, BEGIN = 0, all = BEGIN, epall, epff, eplfs, eplus, epmfs, eprand, erofs, ff, lfs, lus, mfs, newest, rand, END }; static size_t begin() { return BEGIN; } static size_t end() { return END; } }; struct Func { typedef std::string string; typedef std::vector strvec; typedef std::vector cstrptrvec; typedef const string cstring; typedef const uint64_t cuint64_t; typedef const strvec cstrvec; typedef const Category::Enum::Type CType; typedef int (*Ptr)(CType,cstrvec &,const char *,cuint64_t,cstrptrvec &); template class Base { public: Base(const Policy *p) : func(p->_func) {} int operator()(cstrvec &b,const char *c,cuint64_t d,cstrptrvec &e) { return func(T,b,c,d,e); } private: const Ptr func; }; typedef Base Action; typedef Base Create; typedef Base Search; static int invalid(CType,cstrvec&,const char *,cuint64_t,cstrptrvec&); static int all(CType,cstrvec&,const char*,cuint64_t,cstrptrvec&); static int epall(CType,cstrvec&,const char*,cuint64_t,cstrptrvec&); static int epff(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 eprand(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: Enum::Type _enum; std::string _str; Func::Ptr _func; bool _path_preserving; public: Policy() : _enum(invalid), _str(invalid), _func(invalid), _path_preserving(false) { } Policy(const Enum::Type enum_, const std::string &str_, const Func::Ptr func_, const bool path_preserving_) : _enum(enum_), _str(str_), _func(func_), _path_preserving(path_preserving_) { } bool path_preserving() const { return _path_preserving; } public: operator const Enum::Type() const { return _enum; } operator const std::string&() const { return _str; } operator const Func::Ptr() const { return _func; } operator const Policy*() const { return this; } bool operator==(const Enum::Type enum_) const { return _enum == enum_; } bool operator==(const std::string &str_) const { return _str == str_; } bool operator==(const Func::Ptr func_) const { return _func == func_; } bool operator!=(const Policy &r) const { return _enum != r._enum; } bool operator<(const Policy &r) const { return _enum < r._enum; } public: static const Policy &find(const std::string&); static const Policy &find(const Enum::Type); public: static const std::vector _policies_; static const Policy * const policies; static const Policy &invalid; static const Policy &all; static const Policy &epall; static const Policy &epff; static const Policy &eplfs; static const Policy ⩱ static const Policy &epmfs; static const Policy &eprand; static const Policy &erofs; static const Policy &ff; static const Policy &lfs; static const Policy &lus; static const Policy &mfs; static const Policy &newest; static const Policy &rand; }; } #endif mergerfs-2.21.0/src/fs_acl.cpp0000664000175000017500000000232713071441761014552 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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 #include "fs_base_getxattr.hpp" #include "fs_path.hpp" const char POSIX_ACL_DEFAULT_XATTR[] = "system.posix_acl_default"; namespace fs { namespace acl { bool dir_has_defaults(const std::string &fullpath) { int rv; std::string dirpath = fullpath; fs::path::dirname(dirpath); rv = fs::lgetxattr(dirpath,POSIX_ACL_DEFAULT_XATTR,NULL,0); return (rv != -1); } } } mergerfs-2.21.0/src/fs_base_rmdir.hpp0000664000175000017500000000200513040040376016111 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_RMDIR_HPP__ #define __FS_BASE_RMDIR_HPP__ #include #include namespace fs { static inline int rmdir(const std::string &path) { return ::rmdir(path.c_str()); } } #endif mergerfs-2.21.0/src/fs_xattr.cpp0000664000175000017500000001657713101724730015163 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include #include #include #include #include #include "errno.hpp" #include "fs_base_open.hpp" #include "fs_base_close.hpp" #include "str.hpp" #include "xattr.hpp" using std::string; using std::vector; using std::map; using std::istringstream; namespace fs { namespace xattr { int list(const int fd, vector &attrs) { #ifndef WITHOUT_XATTR ssize_t rv; rv = -1; errno = ERANGE; while((rv == -1) && (errno == ERANGE)) { rv = ::flistxattr(fd,NULL,0); if(rv <= 0) return rv; attrs.resize(rv); rv = ::flistxattr(fd,&attrs[0],rv); } return rv; #else return (errno=ENOTSUP,-1); #endif } int list(const string &path, vector &attrs) { #ifndef WITHOUT_XATTR ssize_t rv; rv = -1; errno = ERANGE; while((rv == -1) && (errno == ERANGE)) { rv = ::llistxattr(path.c_str(),NULL,0); if(rv <= 0) return rv; attrs.resize(rv); rv = ::llistxattr(path.c_str(),&attrs[0],rv); } return rv; #else return (errno=ENOTSUP,-1); #endif } int list(const int fd, vector &attrvector) { int rv; vector attrs; rv = list(fd,attrs); if(rv != -1) { string tmp(attrs.begin(),attrs.end()); str::split(attrvector,tmp,'\0'); } return rv; } int list(const string &path, vector &attrvector) { int rv; vector attrs; rv = list(path,attrs); if(rv != -1) { string tmp(attrs.begin(),attrs.end()); str::split(attrvector,tmp,'\0'); } return rv; } int list(const int fd, string &attrstr) { int rv; vector attrs; rv = list(fd,attrs); if(rv != -1) attrstr = string(attrs.begin(),attrs.end()); return rv; } int list(const string &path, string &attrstr) { int rv; vector attrs; rv = list(path,attrs); if(rv != -1) attrstr = string(attrs.begin(),attrs.end()); return rv; } int get(const int fd, const string &attr, vector &value) { #ifndef WITHOUT_XATTR ssize_t rv; rv = -1; errno = ERANGE; while((rv == -1) && (errno == ERANGE)) { rv = ::fgetxattr(fd,attr.c_str(),NULL,0); if(rv <= 0) return rv; value.resize(rv); rv = ::fgetxattr(fd,attr.c_str(),&value[0],rv); } return rv; #else return (errno=ENOTSUP,-1); #endif } int get(const string &path, const string &attr, vector &value) { #ifndef WITHOUT_XATTR ssize_t rv; rv = -1; errno = ERANGE; while((rv == -1) && (errno == ERANGE)) { rv = ::lgetxattr(path.c_str(),attr.c_str(),NULL,0); if(rv <= 0) return rv; value.resize(rv); rv = ::lgetxattr(path.c_str(),attr.c_str(),&value[0],rv); } return rv; #else return (errno=ENOTSUP,-1); #endif } int get(const int fd, const string &attr, string &value) { int rv; vector tmpvalue; rv = get(fd,attr,tmpvalue); if(rv != -1) value = string(tmpvalue.begin(),tmpvalue.end()); return rv; } int get(const string &path, const string &attr, string &value) { int rv; vector tmpvalue; rv = get(path,attr,tmpvalue); if(rv != -1) value = string(tmpvalue.begin(),tmpvalue.end()); return rv; } int get(const int fd, map &attrs) { int rv; string attrstr; rv = list(fd,attrstr); if(rv == -1) return -1; { string key; istringstream ss(attrstr); while(getline(ss,key,'\0')) { string value; rv = get(fd,key,value); if(rv != -1) attrs[key] = value; } } return 0; } int get(const string &path, map &attrs) { int rv; string attrstr; rv = list(path,attrstr); if(rv == -1) return -1; { string key; istringstream ss(attrstr); while(getline(ss,key,'\0')) { string value; rv = get(path,key,value); if(rv != -1) attrs[key] = value; } } return 0; } int set(const int fd, const string &key, const string &value, const int flags) { #ifndef WITHOUT_XATTR return ::fsetxattr(fd, key.c_str(), value.data(), value.size(), flags); #else return (errno=ENOTSUP,-1); #endif } int set(const string &path, const string &key, const string &value, const int flags) { #ifndef WITHOUT_XATTR return ::lsetxattr(path.c_str(), key.c_str(), value.data(), value.size(), flags); #else return (errno=ENOTSUP,-1); #endif } int set(const int fd, const map &attrs) { int rv; for(map::const_iterator i = attrs.begin(), ei = attrs.end(); i != ei; ++i) { rv = set(fd,i->first,i->second,0); if(rv == -1) return -1; } return 0; } int set(const string &path, const map &attrs) { int fd; fd = fs::open(path,O_RDONLY|O_NONBLOCK); if(fd == -1) return -1; set(fd,attrs); return fs::close(fd); } int copy(const int fdin, const int fdout) { int rv; map attrs; rv = get(fdin,attrs); if(rv == -1) return -1; return set(fdout,attrs); } int copy(const string &from, const string &to) { int rv; map attrs; rv = get(from,attrs); if(rv == -1) return -1; return set(to,attrs); } } } mergerfs-2.21.0/src/symlink.hpp0000664000175000017500000000171113040040376015003 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __SYMLINK_HPP__ #define __SYMLINK_HPP__ namespace mergerfs { namespace fuse { int symlink(const char *oldpath, const char *newpath); } } #endif mergerfs-2.21.0/src/fs_clonepath.hpp0000664000175000017500000000217013040040376015762 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_CLONEPATH_HPP__ #define __FS_CLONEPATH_HPP__ #include namespace fs { int clonepath(const std::string &from, const std::string &to, const char *relative); int clonepath(const std::string &from, const std::string &to, const std::string &relative); } #endif mergerfs-2.21.0/src/policy_epall.cpp0000664000175000017500000000527113101725025015770 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include "errno.hpp" #include "fs.hpp" #include "fs_path.hpp" #include "policy.hpp" using std::string; using std::vector; static int _epall_create(const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { string fullpath; 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); if(!fs::exists(fullpath)) continue; if(!fs::info(*basepath,readonly,spaceavail,_spaceused)) continue; if(readonly) continue; if(spaceavail < minfreespace) continue; paths.push_back(basepath); } if(paths.empty()) return POLICY_FAIL_ENOENT; return POLICY_SUCCESS; } static int _epall_other(const vector &basepaths, const char *fusepath, vector &paths) { string fullpath; for(size_t i = 0, ei = basepaths.size(); i != ei; i++) { const string *basepath = &basepaths[i]; fs::path::make(basepath,fusepath,fullpath); if(!fs::exists(fullpath)) continue; paths.push_back(basepath); } if(paths.empty()) return POLICY_FAIL_ENOENT; return POLICY_SUCCESS; } namespace mergerfs { int Policy::Func::epall(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { if(type == Category::Enum::create) return _epall_create(basepaths,fusepath,minfreespace,paths); return _epall_other(basepaths,fusepath,paths); } } mergerfs-2.21.0/src/fs_base_fadvise_unsupported.icpp0000664000175000017500000000174613101724730021245 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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.hpp" namespace fs { static int fadvise(const int fd, const off_t offset, const off_t len, const int advice) { return (errno=EOPNOTSUPP,-1); } } mergerfs-2.21.0/src/readdir.hpp0000664000175000017500000000226513040040376014734 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __READDIR_HPP__ #define __READDIR_HPP__ #include #include #include #include #include #include namespace mergerfs { namespace fuse { int readdir(const char *fusepath, void *buf, fuse_fill_dir_t filler, off_t offset, fuse_file_info *fi); } } #endif mergerfs-2.21.0/src/fs_base_removexattr.hpp0000664000175000017500000000226113101724730017361 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_REMOVEXATTR_HPP__ #define __FS_BASE_REMOVEXATTR_HPP__ #include #include "errno.hpp" #include "xattr.hpp" namespace fs { static inline int lremovexattr(const std::string &path, const char *attrname) { #ifndef WITHOUT_XATTR return ::lremovexattr(path.c_str(),attrname); #else return (errno=ENOTSUP,-1); #endif } } #endif mergerfs-2.21.0/src/fs_base_fadvise.hpp0000664000175000017500000000241513101724730016423 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_FADVISE_HPP__ #define __FS_BASE_FADVISE_HPP__ namespace fs { int fadvise_dontneed(const int fd, const off_t offset = 0, const off_t len = 0); int fadvise_willneed(const int fd, const off_t offset = 0, const off_t len = 0); int fadvise_sequential(const int fd, const off_t offset = 0, const off_t len = 0); } #endif // __FS_FADVISE_HPP__ mergerfs-2.21.0/src/fs_base_chown.hpp0000664000175000017500000000552113072271026016123 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_CHOWN_HPP__ #define __FS_BASE_CHOWN_HPP__ #include #include #include #include #include "fs_base_stat.hpp" namespace fs { static inline int chown(const std::string &path, const uid_t uid, const gid_t gid) { return ::chown(path.c_str(),uid,gid); } static inline int chown(const std::string &path, const struct stat &st) { return fs::chown(path,st.st_uid,st.st_gid); } static inline int lchown(const std::string &path, const uid_t uid, const gid_t gid) { return ::lchown(path.c_str(),uid,gid); } static inline int lchown(const std::string &path, const struct stat &st) { return fs::lchown(path,st.st_uid,st.st_gid); } static inline int fchown(const int fd, const uid_t uid, const gid_t gid) { return ::fchown(fd,uid,gid); } static inline int fchown(const int fd, const struct stat &st) { return fs::fchown(fd,st.st_uid,st.st_gid); } static inline int lchown_check_on_error(const std::string &path, const struct stat &st) { int rv; rv = fs::lchown(path,st); if(rv == -1) { int error; struct stat tmpst; error = errno; rv = fs::lstat(path,tmpst); if(rv == -1) return -1; if((st.st_uid != tmpst.st_uid) || (st.st_gid != tmpst.st_gid)) return (errno=error,-1); } return 0; } static inline int fchown_check_on_error(const int fd, const struct stat &st) { int rv; rv = fs::fchown(fd,st); if(rv == -1) { int error; struct stat tmpst; error = errno; rv = fs::fstat(fd,tmpst); if(rv == -1) return -1; if((st.st_uid != tmpst.st_uid) || (st.st_gid != tmpst.st_gid)) return (errno=error,-1); } return 0; } } #endif mergerfs-2.21.0/src/chmod.cpp0000664000175000017500000000515713040040376014412 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include "config.hpp" #include "errno.hpp" #include "fs_base_chmod.hpp" #include "fs_path.hpp" #include "rv.hpp" #include "rwlock.hpp" #include "ugid.hpp" using std::string; using std::vector; using mergerfs::Policy; static int _chmod_loop_core(const string *basepath, const char *fusepath, const mode_t mode, const int error) { int rv; string fullpath; fs::path::make(basepath,fusepath,fullpath); rv = fs::chmod(fullpath,mode); return error::calc(rv,error,errno); } static int _chmod_loop(const vector &basepaths, const char *fusepath, const mode_t mode) { int error; error = -1; for(size_t i = 0, ei = basepaths.size(); i != ei; i++) { error = _chmod_loop_core(basepaths[i],fusepath,mode,error); } return -error; } static int _chmod(Policy::Func::Action actionFunc, const vector &srcmounts, const uint64_t minfreespace, const char *fusepath, const mode_t mode) { int rv; vector basepaths; rv = actionFunc(srcmounts,fusepath,minfreespace,basepaths); if(rv == -1) return -errno; return _chmod_loop(basepaths,fusepath,mode); } namespace mergerfs { namespace fuse { int chmod(const char *fusepath, mode_t mode) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); return _chmod(config.chmod, config.srcmounts, config.minfreespace, fusepath, mode); } } } mergerfs-2.21.0/src/releasedir.cpp0000664000175000017500000000215613101724730015434 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include "dirinfo.hpp" static int _releasedir(DirInfo *di) { delete di; return 0; } namespace mergerfs { namespace fuse { int releasedir(const char *fusepath, fuse_file_info *ffi) { DirInfo *di = reinterpret_cast(ffi->fh); return ::_releasedir(di); } } } mergerfs-2.21.0/src/fallocate.cpp0000664000175000017500000000303713101724730015246 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #if FALLOCATE #include #include "errno.hpp" #include "fileinfo.hpp" #include "fs_base_fallocate.hpp" static int _fallocate(const int fd, const int mode, const off_t offset, const off_t len) { int rv; rv = fs::fallocate(fd,mode,offset,len); return ((rv == -1) ? -errno : 0); } namespace mergerfs { namespace fuse { int fallocate(const char *fusepath, int mode, off_t offset, off_t len, fuse_file_info *ffi) { FileInfo *fi = reinterpret_cast(ffi->fh); return _fallocate(fi->fd, mode, offset, len); } } } #endif mergerfs-2.21.0/src/version.hpp0000664000175000017500000000014213103514237015001 0ustar bilebile#ifndef _VERSION_HPP #define _VERSION_HPP static const char MERGERFS_VERSION[] = "2.21.0"; #endif mergerfs-2.21.0/src/flock.cpp0000664000175000017500000000240513035712542014414 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include "errno.hpp" #include "fileinfo.hpp" #include "fs_base_flock.hpp" static int _flock(const int fd, const int operation) { int rv; rv = fs::flock(fd,operation); return ((rv == -1) ? -errno : 0); } namespace mergerfs { namespace fuse { int flock(const char *fusepath, fuse_file_info *ffi, int op) { FileInfo* fi = reinterpret_cast(ffi->fh); return _flock(fi->fd,op); } } } mergerfs-2.21.0/src/errno.hpp0000664000175000017500000000221213040040376014437 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __ERRNO_HPP__ #define __ERRNO_HPP__ #include #if defined(ENODATA) && !defined(ENOATTR) #define ENOATTR ENODATA #endif #if defined(ENOATTR) && !defined(ENODATA) #define ENODATA ENOATTR #endif #if !defined(ENOATTR) && !defined(ENODATA) #error "Neither ENOATTR or ENODATA defined: please contact mergerfs author with platform information" #endif #endif mergerfs-2.21.0/src/gidcache.cpp0000664000175000017500000000672713101724730015054 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include #if defined __linux__ and UGID_USE_RWLOCK == 0 # include #elif __APPLE__ # include #endif #include #include #include "gidcache.hpp" inline bool gid_t_rec::operator<(const struct gid_t_rec &b) const { return uid < b.uid; } inline gid_t_rec * gid_t_cache::begin(void) { return recs; } inline gid_t_rec * gid_t_cache::end(void) { return recs + size; } inline gid_t_rec * gid_t_cache::allocrec(void) { if(size == MAXRECS) return &recs[rand() % MAXRECS]; else return &recs[size++]; } inline gid_t_rec * gid_t_cache::lower_bound(gid_t_rec *begin, gid_t_rec *end, const uid_t uid) { int step; int count; gid_t_rec *iter; count = std::distance(begin,end); while(count > 0) { iter = begin; step = count / 2; std::advance(iter,step); if(iter->uid < uid) { begin = ++iter; count -= step + 1; } else { count = step; } } return begin; } static int _getgrouplist(const char *user, const gid_t group, gid_t *groups, int *ngroups) { #if __APPLE__ return ::getgrouplist(user,group,(int*)groups,ngroups); #else return ::getgrouplist(user,group,groups,ngroups); #endif } gid_t_rec * gid_t_cache::cache(const uid_t uid, const gid_t gid) { int rv; char buf[4096]; struct passwd pwd; struct passwd *pwdrv; gid_t_rec *rec; rec = allocrec(); rec->uid = uid; rv = ::getpwuid_r(uid,&pwd,buf,sizeof(buf),&pwdrv); if(pwdrv != NULL && rv == 0) { rec->size = 0; ::_getgrouplist(pwd.pw_name,gid,NULL,&rec->size); rec->size = std::min(MAXGIDS,rec->size); rv = ::_getgrouplist(pwd.pw_name,gid,rec->gids,&rec->size); if(rv == -1) { rec->gids[0] = gid; rec->size = 1; } } return rec; } static inline int setgroups(const gid_t_rec *rec) { #if defined __linux__ and UGID_USE_RWLOCK == 0 # if defined SYS_setgroups32 return ::syscall(SYS_setgroups32,rec->size,rec->gids); # else return ::syscall(SYS_setgroups,rec->size,rec->gids); # endif #else return ::setgroups(rec->size,rec->gids); #endif } int gid_t_cache::initgroups(const uid_t uid, const gid_t gid) { int rv; gid_t_rec *rec; rec = lower_bound(begin(),end(),uid); if(rec == end() || rec->uid != uid) { rec = cache(uid,gid); rv = ::setgroups(rec); std::sort(begin(),end()); } else { rv = ::setgroups(rec); } return rv; } mergerfs-2.21.0/src/fsync.cpp0000664000175000017500000000254613101724730014442 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include "errno.hpp" #include "fileinfo.hpp" #include "fs_base_fsync.hpp" static int _fsync(const int fd, const int isdatasync) { int rv; rv = (isdatasync ? fs::fdatasync(fd) : fs::fsync(fd)); return ((rv == -1) ? -errno : 0); } namespace mergerfs { namespace fuse { int fsync(const char *fusepath, int isdatasync, fuse_file_info *ffi) { FileInfo *fi = reinterpret_cast(ffi->fh); return ::_fsync(fi->fd,isdatasync); } } } mergerfs-2.21.0/src/chmod.hpp0000664000175000017500000000167713040040376014422 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __CHMOD_HPP__ #define __CHMOD_HPP__ namespace mergerfs { namespace fuse { int chmod(const char *fusepath, mode_t mode); } } #endif mergerfs-2.21.0/src/policy_epff.cpp0000664000175000017500000000637013101725025015614 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include "errno.hpp" #include "fs.hpp" #include "fs_path.hpp" #include "policy.hpp" using std::string; using std::vector; using mergerfs::Category; static int _epff_create(const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { string fullpath; 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]; fs::path::make(basepath,fusepath,fullpath); if(!fs::exists(fullpath)) continue; if(!fs::info(*basepath,readonly,spaceavail,_spaceused)) continue; if(readonly) continue; if(fallback == NULL) fallback = basepath; if(spaceavail < minfreespace) continue; paths.push_back(basepath); return POLICY_SUCCESS; } if(fallback == NULL) return POLICY_FAIL_ENOENT; paths.push_back(fallback); return POLICY_SUCCESS; } static int _epff_other(const vector &basepaths, const char *fusepath, vector &paths) { string fullpath; for(size_t i = 0, ei = basepaths.size(); i != ei; i++) { const string *basepath = &basepaths[i]; fs::path::make(basepath,fusepath,fullpath); if(!fs::exists(fullpath)) continue; paths.push_back(basepath); return POLICY_SUCCESS; } return POLICY_FAIL_ENOENT; } static int _epff(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { if(type == Category::Enum::create) return _epff_create(basepaths,fusepath,minfreespace,paths); return _epff_other(basepaths,fusepath,paths); } namespace mergerfs { int Policy::Func::epff(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { int rv; rv = _epff(type,basepaths,fusepath,minfreespace,paths); if(POLICY_FAILED(rv)) rv = Policy::Func::ff(type,basepaths,fusepath,minfreespace,paths); return rv; } } mergerfs-2.21.0/src/fs_base_fallocate_posix.icpp0000664000175000017500000000207513101724730020324 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include "errno.hpp" namespace fs { int fallocate(const int fd, const int mode, const off_t offset, const off_t len) { return (mode ? (errno=EOPNOTSUPP,-1) : (::posix_fallocate(fd,offset,len))); } } mergerfs-2.21.0/src/fs_base_mknod.hpp0000664000175000017500000000217413040040376016113 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_MKNOD_HPP__ #define __FS_BASE_MKNOD_HPP__ #include #include #include #include namespace fs { static inline int mknod(const std::string &path, const mode_t mode, const dev_t dev) { return ::mknod(path.c_str(),mode,dev); } } #endif mergerfs-2.21.0/src/ugid_rwlock.hpp0000664000175000017500000000441213071441761015636 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __UGID_RWLOCK_HPP__ #define __UGID_RWLOCK_HPP__ #include #include #include #include namespace mergerfs { namespace ugid { extern uid_t currentuid; extern gid_t currentgid; extern pthread_rwlock_t rwlock; static void ugid_set(const uid_t newuid, const gid_t newgid) { pthread_rwlock_rdlock(&rwlock); if(newuid == currentuid && newgid == currentgid) return; pthread_rwlock_unlock(&rwlock); pthread_rwlock_wrlock(&rwlock); if(newuid == currentuid && newgid == currentgid) return; if(currentuid != 0) { ::seteuid(0); ::setegid(0); } if(newgid) { ::setegid(newgid); initgroups(newuid,newgid); } if(newuid) ::seteuid(newuid); currentuid = newuid; currentgid = newgid; } struct Set { Set(const uid_t newuid, const gid_t newgid) { ugid_set(newuid,newgid); } ~Set() { pthread_rwlock_unlock(&rwlock); } }; struct SetRootGuard { SetRootGuard() : prevuid(currentuid), prevgid(currentgid) { pthread_rwlock_unlock(&rwlock); ugid_set(0,0); } ~SetRootGuard() { pthread_rwlock_unlock(&rwlock); ugid_set(prevuid,prevgid); } const uid_t prevuid; const gid_t prevgid; }; } } #endif mergerfs-2.21.0/src/mknod.cpp0000664000175000017500000001030613040040376014420 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include "config.hpp" #include "errno.hpp" #include "fs_acl.hpp" #include "fs_base_mknod.hpp" #include "fs_clonepath.hpp" #include "fs_path.hpp" #include "rv.hpp" #include "rwlock.hpp" #include "ugid.hpp" using std::string; using std::vector; using namespace mergerfs; static inline int _mknod_core(const string &fullpath, mode_t mode, const mode_t umask, const dev_t dev) { if(!fs::acl::dir_has_defaults(fullpath)) mode &= ~umask; return fs::mknod(fullpath,mode,dev); } static int _mknod_loop_core(const string &existingpath, const string &createpath, const char *fusepath, const char *fusedirpath, const mode_t mode, const mode_t umask, const dev_t dev, const int error) { int rv; string fullpath; if(createpath != existingpath) { const ugid::SetRootGuard ugidGuard; rv = fs::clonepath(existingpath,createpath,fusedirpath); if(rv == -1) return -1; } fs::path::make(&createpath,fusepath,fullpath); rv = _mknod_core(fullpath,mode,umask,dev); return error::calc(rv,error,errno); } static int _mknod_loop(const string &existingpath, const vector &createpaths, const char *fusepath, const char *fusedirpath, const mode_t mode, const mode_t umask, const dev_t dev) { int error; error = -1; for(size_t i = 0, ei = createpaths.size(); i != ei; i++) { error = _mknod_loop_core(existingpath,*createpaths[i], fusepath,fusedirpath, mode,umask,dev,error); } return -error; } static int _mknod(Policy::Func::Search searchFunc, Policy::Func::Create createFunc, const vector &srcmounts, const uint64_t minfreespace, const char *fusepath, const mode_t mode, const mode_t umask, const dev_t dev) { int rv; string fusedirpath; const char *fusedirpathcstr; vector createpaths; vector existingpaths; fusedirpath = fusepath; fs::path::dirname(fusedirpath); fusedirpathcstr = fusedirpath.c_str(); rv = searchFunc(srcmounts,fusedirpathcstr,minfreespace,existingpaths); if(rv == -1) return -errno; rv = createFunc(srcmounts,fusedirpathcstr,minfreespace,createpaths); if(rv == -1) return -errno; return _mknod_loop(*existingpaths[0],createpaths, fusepath,fusedirpathcstr, mode,umask,dev); } namespace mergerfs { namespace fuse { int mknod(const char *fusepath, mode_t mode, dev_t rdev) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); return _mknod(config.getattr, config.mknod, config.srcmounts, config.minfreespace, fusepath, mode, fc->umask, rdev); } } } mergerfs-2.21.0/src/write.hpp0000664000175000017500000000240713040040376014452 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __WRITE_HPP__ #define __WRITE_HPP__ namespace mergerfs { namespace fuse { int write(const char *fusepath, const char *buf, size_t count, off_t offset, fuse_file_info *fi); int write_direct_io(const char *fusepath, const char *buf, size_t count, off_t offset, fuse_file_info *fi); } } #endif mergerfs-2.21.0/src/statvfs_util.hpp0000664000175000017500000000243313040040376016046 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __STATVFS_UTIL_HPP__ #define __STATVFS_UTIL_HPP__ #include #include #include "success_fail.hpp" namespace StatVFS { static inline bool readonly(const struct statvfs &st) { return (st.f_flag & ST_RDONLY); } static inline uint64_t spaceavail(const struct statvfs &st) { return (st.f_frsize * st.f_bavail); } static inline uint64_t spaceused(const struct statvfs &st) { return (st.f_frsize * (st.f_blocks - st.f_bavail)); } } #endif mergerfs-2.21.0/src/mkdir.hpp0000664000175000017500000000167713040040376014436 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __MKDIR_HPP__ #define __MKDIR_HPP__ namespace mergerfs { namespace fuse { int mkdir(const char *fusepath, mode_t mode); } } #endif mergerfs-2.21.0/src/fs_movefile.hpp0000664000175000017500000000251713101724730015621 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_MOVEFILE_HPP__ #define __FS_MOVEFILE_HPP__ #include #include namespace fs { int movefile(const std::vector &basepaths, const std::string &fusepath, const size_t additional_size, int &origfd); int movefile(const std::vector &basepaths, const char *fusepath, const size_t additional_size, int &origfd); } #endif mergerfs-2.21.0/src/fs.hpp0000664000175000017500000000377213101725025013735 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_HPP__ #define __FS_HPP__ #include #include #include namespace fs { using std::string; using std::vector; bool exists(const string &path, struct stat &st); bool exists(const string &path); bool info(const string &path, bool &readonly, uint64_t &spaceavail, uint64_t &spaceused); bool readonly(const string &path); bool spaceavail(const string &path, uint64_t &spaceavail); bool spaceused(const string &path, uint64_t &spaceavail); void findallfiles(const vector &srcmounts, const char *fusepath, vector &paths); int findonfs(const vector &srcmounts, const char *fusepath, const int fd, string &basepath); void glob(const vector &patterns, vector &strs); void realpathize(vector &strs); int getfl(const int fd); int mfs(const vector &srcs, const uint64_t minfreespace, string &path); }; #endif // __FS_HPP__ mergerfs-2.21.0/src/fileinfo.hpp0000664000175000017500000000203113101724730015105 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FILEINFO_HPP__ #define __FILEINFO_HPP__ #include class FileInfo { public: FileInfo(const int fd_, const char *fusepath_) : fd(fd_), fusepath(fusepath_) { } public: int fd; std::string fusepath; }; #endif mergerfs-2.21.0/src/listxattr.cpp0000664000175000017500000000662113103071706015354 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include "buildvector.hpp" #include "category.hpp" #include "config.hpp" #include "errno.hpp" #include "fs_base_listxattr.hpp" #include "fs_path.hpp" #include "rwlock.hpp" #include "ugid.hpp" #include "xattr.hpp" using std::string; using std::vector; using namespace mergerfs; static int _listxattr_controlfile(char *list, const size_t size) { string xattrs; const vector strs = buildvector ("user.mergerfs.srcmounts") ("user.mergerfs.minfreespace") ("user.mergerfs.moveonenospc") ("user.mergerfs.dropcacheonclose") ("user.mergerfs.symlinkify") ("user.mergerfs.symlinkify_timeout") ("user.mergerfs.policies") ("user.mergerfs.version") ("user.mergerfs.pid"); xattrs.reserve(1024); for(size_t i = 0; i < strs.size(); i++) xattrs += (strs[i] + '\0'); for(size_t i = Category::Enum::BEGIN; i < Category::Enum::END; i++) xattrs += ("user.mergerfs.category." + (std::string)*Category::categories[i] + '\0'); for(size_t i = FuseFunc::Enum::BEGIN; i < FuseFunc::Enum::END; i++) xattrs += ("user.mergerfs.func." + (std::string)*FuseFunc::fusefuncs[i] + '\0'); if(size == 0) return xattrs.size(); if(size < xattrs.size()) return -ERANGE; memcpy(list,xattrs.c_str(),xattrs.size()); return xattrs.size(); } static int _listxattr(Policy::Func::Search searchFunc, const vector &srcmounts, const uint64_t minfreespace, const char *fusepath, char *list, const size_t size) { int rv; string fullpath; vector basepaths; rv = searchFunc(srcmounts,fusepath,minfreespace,basepaths); if(rv == -1) return -errno; fs::path::make(basepaths[0],fusepath,fullpath); rv = fs::llistxattr(fullpath,list,size); return ((rv == -1) ? -errno : rv); } namespace mergerfs { namespace fuse { int listxattr(const char *fusepath, char *list, size_t size) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); if(fusepath == config.controlfile) return _listxattr_controlfile(list,size); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); return _listxattr(config.listxattr, config.srcmounts, config.minfreespace, fusepath, list, size); } } } mergerfs-2.21.0/src/ugid.cpp0000664000175000017500000000217013035712542014245 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 "gidcache.hpp" #if defined __linux__ and UGID_USE_RWLOCK == 0 #include "ugid_linux.icpp" #else #include "ugid_rwlock.icpp" #endif namespace mergerfs { namespace ugid { void initgroups(const uid_t uid, const gid_t gid) { static __thread gid_t_cache cache = {0}; cache.initgroups(uid,gid); } } } mergerfs-2.21.0/src/fs_base_lseek.hpp0000664000175000017500000000207613040040376016107 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_LSEEK_HPP__ #define __FS_BASE_LSEEK_HPP__ #include #include namespace fs { static inline off_t lseek(const int fd, const off_t offset, const int whence) { return ::lseek(fd,offset,whence); } } #endif mergerfs-2.21.0/src/policy_eplus.cpp0000664000175000017500000000722713101725025016026 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include "errno.hpp" #include "fs.hpp" #include "fs_path.hpp" #include "policy.hpp" using std::string; using std::vector; using mergerfs::Category; static int _eplus_create(const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { string fullpath; uint64_t eplus; const string *eplusbasepath; eplus = std::numeric_limits::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); if(!fs::exists(fullpath)) continue; if(!fs::info(*basepath,readonly,spaceavail,spaceused)) continue; if(readonly) continue; if(spaceavail < minfreespace) continue; if(spaceused >= eplus) continue; eplus = spaceused; eplusbasepath = basepath; } if(eplusbasepath == NULL) return POLICY_FAIL_ENOENT; paths.push_back(eplusbasepath); return POLICY_SUCCESS; } static int _eplus_other(const vector &basepaths, const char *fusepath, vector &paths) { string fullpath; uint64_t eplus; 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); if(!fs::exists(fullpath)) continue; if(!fs::spaceused(*basepath,spaceused)) continue; if(spaceused >= eplus) continue; eplus = spaceused; eplusbasepath = basepath; } if(eplusbasepath == NULL) return POLICY_FAIL_ENOENT; paths.push_back(eplusbasepath); return POLICY_SUCCESS; } static int _eplus(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { if(type == Category::Enum::create) return _eplus_create(basepaths,fusepath,minfreespace,paths); return _eplus_other(basepaths,fusepath,paths); } namespace mergerfs { int Policy::Func::eplus(const Category::Enum::Type type, const vector &basepaths, const char *fusepath, const uint64_t minfreespace, vector &paths) { int rv; rv = _eplus(type,basepaths,fusepath,minfreespace,paths); if(POLICY_FAILED(rv)) rv = Policy::Func::lus(type,basepaths,fusepath,minfreespace,paths); return rv; } } mergerfs-2.21.0/src/fs_base_fsync.hpp0000664000175000017500000000230413101724730016121 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_FSYNC_HPP__ #define __FS_BASE_FSYNC_HPP__ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include "errno.hpp" namespace fs { static inline int fsync(const int fd) { return ::fsync(fd); } static inline int fdatasync(const int fd) { #if _POSIX_SYNCHRONIZED_IO > 0 return ::fdatasync(fd); #else return (errno=ENOSYS,-1); #endif } } #endif mergerfs-2.21.0/src/rename.hpp0000664000175000017500000000167513040040376014575 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __RENAME_HPP__ #define __RENAME_HPP__ namespace mergerfs { namespace fuse { int rename(const char *from, const char *to); } } #endif mergerfs-2.21.0/src/create.cpp0000664000175000017500000000736513101724730014567 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include "config.hpp" #include "errno.hpp" #include "fileinfo.hpp" #include "fs_acl.hpp" #include "fs_base_open.hpp" #include "fs_clonepath.hpp" #include "fs_path.hpp" #include "rwlock.hpp" #include "ugid.hpp" using std::string; using std::vector; using namespace mergerfs; static inline int _create_core(const string &fullpath, mode_t mode, const mode_t umask, const int flags) { if(!fs::acl::dir_has_defaults(fullpath)) mode &= ~umask; return fs::open(fullpath,flags,mode); } static int _create_core(const string &existingpath, const string &createpath, const char *fusepath, const char *fusedirpath, const mode_t mode, const mode_t umask, const int flags, uint64_t &fh) { int rv; string fullpath; if(createpath != existingpath) { const ugid::SetRootGuard ugidGuard; rv = fs::clonepath(existingpath,createpath,fusedirpath); if(rv == -1) return -errno; } fs::path::make(&createpath,fusepath,fullpath); rv = _create_core(fullpath,mode,umask,flags); if(rv == -1) return -errno; fh = reinterpret_cast(new FileInfo(rv,fusepath)); return 0; } static int _create(Policy::Func::Search searchFunc, Policy::Func::Create createFunc, const vector &srcmounts, const uint64_t minfreespace, const char *fusepath, const mode_t mode, const mode_t umask, const int flags, uint64_t &fh) { int rv; string fullpath; string fusedirpath; const char *fusedirpathcstr; vector createpaths; vector existingpaths; fusedirpath = fusepath; fs::path::dirname(fusedirpath); fusedirpathcstr = fusedirpath.c_str(); rv = searchFunc(srcmounts,fusedirpathcstr,minfreespace,existingpaths); if(rv == -1) return -errno; rv = createFunc(srcmounts,fusedirpathcstr,minfreespace,createpaths); if(rv == -1) return -errno; return _create_core(*existingpaths[0],*createpaths[0], fusepath,fusedirpathcstr, mode,umask,flags,fh); } namespace mergerfs { namespace fuse { int create(const char *fusepath, mode_t mode, fuse_file_info *ffi) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); return _create(config.getattr, config.create, config.srcmounts, config.minfreespace, fusepath, mode, fc->umask, ffi->flags, ffi->fh); } } } mergerfs-2.21.0/src/rwlock.hpp0000664000175000017500000000301313040040376014613 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __RWLOCK_HPP__ #define __RWLOCK_HPP__ #include namespace mergerfs { namespace rwlock { class ReadGuard { public: ReadGuard(pthread_rwlock_t *lock) { _lock = lock; pthread_rwlock_rdlock(_lock); } ~ReadGuard() { pthread_rwlock_unlock(_lock); } private: ReadGuard(); private: pthread_rwlock_t *_lock; }; class WriteGuard { public: WriteGuard(pthread_rwlock_t *lock) { _lock = lock; pthread_rwlock_wrlock(_lock); } ~WriteGuard() { pthread_rwlock_unlock(_lock); } private: WriteGuard(); private: pthread_rwlock_t *_lock; }; } } #endif mergerfs-2.21.0/src/fs_devid.hpp0000664000175000017500000000213613040040376015102 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_DEVID_HPP__ #define __FS_DEVID_HPP__ #include #include #include namespace fs { static inline dev_t devid(const int fd) { int rv; struct stat st; rv = ::fstat(fd,&st); if(rv == -1) return -1; return st.st_dev; } } #endif mergerfs-2.21.0/src/fallocate.hpp0000664000175000017500000000210213040040376015242 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FALLOCATE_HPP__ #define __FALLOCATE_HPP__ namespace mergerfs { namespace fuse { int fallocate(const char *fusepath, int mode, off_t offset, off_t len, fuse_file_info *fi); } } #endif mergerfs-2.21.0/src/fs_base_fallocate.cpp0000664000175000017500000000207013101724730016724 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #ifdef __linux__ # include "fs_base_fallocate_linux.icpp" #elif _XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L # include "fs_base_fallocate_posix.icpp" #elif __APPLE__ # include "fs_base_fallocate_osx.icpp" #else # include "fs_base_fallocate_unsupported.icpp" #endif mergerfs-2.21.0/src/unlink.cpp0000664000175000017500000000471213040040376014614 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include #include #include #include "config.hpp" #include "errno.hpp" #include "fs_base_unlink.hpp" #include "fs_path.hpp" #include "rv.hpp" #include "rwlock.hpp" #include "ugid.hpp" using std::string; using std::vector; using mergerfs::Policy; static int _unlink_loop_core(const string *basepath, const char *fusepath, const int error) { int rv; string fullpath; fs::path::make(basepath,fusepath,fullpath); rv = fs::unlink(fullpath); return error::calc(rv,error,errno); } static int _unlink_loop(const vector &basepaths, const char *fusepath) { int error; error = -1; for(size_t i = 0, ei = basepaths.size(); i != ei; i++) { error = _unlink_loop_core(basepaths[i],fusepath,error); } return -error; } static int _unlink(Policy::Func::Action actionFunc, const vector &srcmounts, const uint64_t minfreespace, const char *fusepath) { int rv; vector basepaths; rv = actionFunc(srcmounts,fusepath,minfreespace,basepaths); if(rv == -1) return -errno; return _unlink_loop(basepaths,fusepath); } namespace mergerfs { namespace fuse { int unlink(const char *fusepath) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); const ugid::Set ugid(fc->uid,fc->gid); const rwlock::ReadGuard readlock(&config.srcmountslock); return _unlink(config.unlink, config.srcmounts, config.minfreespace, fusepath); } } } mergerfs-2.21.0/src/config.hpp0000664000175000017500000000525313103454507014574 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __CONFIG_HPP__ #define __CONFIG_HPP__ #include #include #include #include #include #include "policy.hpp" #include "fusefunc.hpp" namespace mergerfs { class Config { public: Config(); public: int set_func_policy(const std::string &fusefunc_, const std::string &policy_); int set_category_policy(const std::string &category, const std::string &policy); public: std::string destmount; std::vector srcmounts; mutable pthread_rwlock_t srcmountslock; uint64_t minfreespace; bool moveonenospc; bool direct_io; bool dropcacheonclose; bool symlinkify; time_t symlinkify_timeout; public: const Policy *policies[FuseFunc::Enum::END]; const Policy *&access; const Policy *&chmod; const Policy *&chown; const Policy *&create; const Policy *&getattr; const Policy *&getxattr; const Policy *&link; const Policy *&listxattr; const Policy *&mkdir; const Policy *&mknod; const Policy *&open; const Policy *&readlink; const Policy *&removexattr; const Policy *&rename; const Policy *&rmdir; const Policy *&setxattr; const Policy *&symlink; const Policy *&truncate; const Policy *&unlink; const Policy *&utimens; public: const std::string controlfile; public: static const Config & get(void) { const fuse_context *fc = fuse_get_context(); return get(fc); } static const Config & get(const fuse_context *fc) { return *((Config*)fc->private_data); } static Config & get_writable(void) { return (*((Config*)fuse_get_context()->private_data)); } }; } #endif mergerfs-2.21.0/src/fs_base_listxattr.hpp0000664000175000017500000000231213101724730017034 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_LISTXATTR_HPP__ #define __FS_BASE_LISTXATTR_HPP__ #include #include "errno.hpp" #include "xattr.hpp" namespace fs { static inline int llistxattr(const std::string &path, char *list, const size_t size) { #ifndef WITHOUT_XATTR return ::llistxattr(path.c_str(),list,size); #else return (errno=ENOTSUP,-1); #endif } } #endif mergerfs-2.21.0/src/str.hpp0000664000175000017500000000361113040040376014126 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __STR_HPP__ #define __STR_HPP__ #include #include namespace str { void split(std::vector &result, const char *str, const char delimiter); void split(std::vector &result, const std::string &str, const char delimiter); std::string join(const std::vector &vec, const size_t substridx, const char sep); std::string join(const std::vector &vec, const char sep); size_t longest_common_prefix_index(const std::vector &vec); std::string longest_common_prefix(const std::vector &vec); std::string remove_common_prefix_and_join(const std::vector &vec, const char sep); void erase_fnmatches(const std::vector &pattern, std::vector &strs); bool isprefix(const std::string &s0, const std::string &s1); } #endif mergerfs-2.21.0/src/fsyncdir.hpp0000664000175000017500000000201613101724730015136 0ustar bilebile/* Copyright (c) 2017, Antonio SJ Musumeci 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. */ #ifndef __FSYNCDIR_HPP__ #define __FSYNCDIR_HPP__ #include namespace mergerfs { namespace fuse { int fsyncdir(const char *fusepath, int isdatasync, fuse_file_info *ffi); } } #endif mergerfs-2.21.0/src/fs_sendfile_unsupported.icpp0000664000175000017500000000174013035712542020421 0ustar bilebile/* Copyright (c) 2016, Antonio SJ Musumeci 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 #include "errno.hpp" namespace fs { ssize_t sendfile(const int fdin, const int fdout, const size_t count) { return (errno=EINVAL,-1); } } mergerfs-2.21.0/src/fs_base_remove.hpp0000664000175000017500000000202013040040376016266 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ #ifndef __FS_BASE_REMOVE_HPP__ #define __FS_BASE_REMOVE_HPP__ #include #include namespace fs { static inline int remove(const std::string &pathname) { return ::remove(pathname.c_str()); } } #endif mergerfs-2.21.0/README.md0000664000175000017500000012103113103071706013273 0ustar bilebile% mergerfs(1) mergerfs user manual % Antonio SJ Musumeci % 2017-02-18 # NAME mergerfs - a featureful union filesystem # SYNOPSIS mergerfs -o<options> <srcmounts> <mountpoint> # DESCRIPTION **mergerfs** is a union filesystem geared towards simplifying storage and management of files across numerous commodity storage devices. It is similar to **mhddfs**, **unionfs**, and **aufs**. # FEATURES * Runs in userspace (FUSE) * Configurable behaviors * Support for extended attributes (xattrs) * Support for file attributes (chattr) * Runtime configurable (via xattrs) * Safe to run as root * Opportunistic credential caching * Works with heterogeneous filesystem types * Handling of writes to full drives (transparently move file to drive with capacity) * Handles pool of readonly and read/write drives * Turn read-only files into symlinks to increase read performance # OPTIONS ### mount options * **defaults**: a shortcut for FUSE's **atomic_o_trunc**, **auto_cache**, **big_writes**, **default_permissions**, **splice_move**, **splice_read**, and **splice_write**. These options seem to provide the best performance. * **direct_io**: causes FUSE to bypass caching which can increase write speeds at the detriment of reads. Note that not enabling `direct_io` will cause double caching of files and therefore less memory for caching generally. However, `mmap` does not work when `direct_io` is enabled. * **minfreespace**: the minimum space value used for creation policies. Understands 'K', 'M', and 'G' to represent kilobyte, megabyte, and gigabyte respectively. (default: 4G) * **moveonenospc**: when enabled (set to **true**) if a **write** fails with **ENOSPC** or **EDQUOT** a scan of all drives will be done looking for the drive with most free space which is at least the size of the file plus the amount which failed to write. An attempt to move the file to that drive will occur (keeping all metadata possible) and if successful the original is unlinked and the write retried. (default: false) * **use_ino**: causes mergerfs to supply file/directory inodes rather than libfuse. While not a default it is generally recommended it be enabled so that hard linked files share the same inode value. * **dropcacheonclose**: when a file is requested to be closed call `posix_fadvise` on it first to instruct the kernel that we no longer need the data and it can drop its cache. Recommended when **direct_io** is not enabled to limit double caching. (default: false) * **symlinkify**: when enabled (set to **true**) and a file is not writable and its mtime or ctime is older than **symlinkify_timeout** files will be reported as symlinks to the original files. Please read more below before using. (default: false) * **symlinkify_timeout**: time to wait, in seconds, to activate the **symlinkify** behavior. (default: 3600) * **fsname**: sets the name of the filesystem as seen in **mount**, **df**, etc. Defaults to a list of the source paths concatenated together with the longest common prefix removed. * **func.<func>=<policy>**: sets the specific FUSE function's policy. See below for the list of value types. Example: **func.getattr=newest** * **category.<category>=<policy>**: Sets policy of all FUSE functions in the provided category. Example: **category.create=mfs** **NOTE:** Options are evaluated in the order listed so if the options are **func.rmdir=rand,category.action=ff** the **action** category setting will override the **rmdir** setting. ### srcmounts The srcmounts (source mounts) argument is a colon (':') delimited list of paths to be included in the pool. It does not matter if the paths are on the same or different drives nor does it matter the filesystem. Used and available space will not be duplicated for paths on the same device and any features which aren't supported by the underlying filesystem (such as file attributes or extended attributes) will return the appropriate errors. To make it easier to include multiple source mounts mergerfs supports [globbing](http://linux.die.net/man/7/glob). **The globbing tokens MUST be escaped when using via the shell else the shell itself will expand it.** ``` $ mergerfs -o defaults,allow_other,use_ino /mnt/disk\*:/mnt/cdrom /media/drives ``` The above line will use all mount points in /mnt prefixed with **disk** and the **cdrom**. To have the pool mounted at boot or otherwise accessable from related tools use **/etc/fstab**. ``` # /mnt/disk*:/mnt/cdrom /media/drives fuse.mergerfs defaults,allow_other,use_ino 0 0 ``` **NOTE:** the globbing is done at mount or xattr update time (see below). If a new directory is added matching the glob after the fact it will not be automatically included. **NOTE:** for mounting via **fstab** to work you must have **mount.fuse** installed. For Ubuntu/Debian it is included in the **fuse** package. ### symlinkify Due to the levels of indirection introduced by mergerfs and the underlying technology FUSE there can be varying levels of performance degredation. This feature will turn non-directories which are not writable into symlinks to the original file found by the `readlink` policy after the mtime and ctime are older than the timeout. **WARNING:** The current implementation has a known issue in which if the file is open and being used when the file is converted to a symlink then the application which has that file open will receive an error when using it. This is unlikely to occur in practice but is something to keep in mind. **WARNING:** Some backup solutions, such as CrashPlan, do not backup the target of a symlink. If using this feature it will be necessary to point any backup software to the original drives or configure the software to follow symlinks if such an option is available. Alternatively create two mounts. One for backup and one for general consumption. # FUNCTIONS / POLICIES / CATEGORIES The POSIX filesystem API has a number of functions. **creat**, **stat**, **chown**, etc. In mergerfs these functions are grouped into 3 categories: **action**, **create**, and **search**. Functions and categories can be assigned a policy which dictates how **mergerfs** behaves. Any policy can be assigned to a function or category though some may not be very useful in practice. For instance: **rand** (random) may be useful for file creation (create) but could lead to very odd behavior if used for `chmod` (though only if there were more than one copy of the file). Policies, when called to create, will ignore drives which are readonly. This allows for readonly and read/write drives to be mixed together. Note that the drive must be explicitly mounted with the **ro** mount option for this to work. #### Function / Category classifications | Category | FUSE Functions | |----------|-------------------------------------------------------------------------------------| | action | chmod, chown, link, removexattr, rename, rmdir, setxattr, truncate, unlink, utimens | | create | create, mkdir, mknod, symlink | | search | access, getattr, getxattr, ioctl, listxattr, open, readlink | | N/A | fallocate, fgetattr, fsync, ftruncate, ioctl, read, readdir, release, statfs, write | Due to FUSE limitations **ioctl** behaves differently if its acting on a directory. It'll use the **getattr** policy to find and open the directory before issuing the **ioctl**. In other cases where something may be searched (to confirm a directory exists across all source mounts) **getattr** will also be used. #### Path Preservation Policies, as described below, are of two core types. `path preserving` and `non-path preserving`. All policies which start with `ep` (**epff**, **eplfs**, **eplus**, **epmfs**, **eprand**) are `path preserving'. `ep` stands for 'existing path`. As the descriptions explain a path preserving policy will only consider drives where the relative path being accessed already exists. When using non-path preserving policies where something is created paths will be copied to target drives as necessary. #### Policy descriptions | Policy | Description | |------------------|------------------------------------------------------------| | all | Search category: acts like **ff**. Action category: apply to all found. Create category: for **mkdir**, **mknod**, and **symlink** it will apply to all found. **create** works like **ff**. It will exclude readonly drives and those with free space less than **minfreespace**. | | epall (existing path, all) | Search category: acts like **epff**. Action category: apply to all found. Create category: for **mkdir**, **mknod**, and **symlink** it will apply to all existing paths found. **create** works like **epff**. Excludes readonly drives and those with free space less than **minfreespace**. | | epff (existing path, first found) | Given the order of the drives, as defined at mount time or configured at runtime, act on the first one found where the relative path already exists. For **create** category functions it will exclude readonly drives and those with free space less than **minfreespace** (unless there is no other option). Falls back to **ff**. | | eplfs (existing path, least free space) | Of all the drives on which the relative path exists choose the drive with the least free space. For **create** category functions it will exclude readonly drives and those with free space less than **minfreespace**. Falls back to **lfs**. | | eplus (existing path, least used space) | Of all the drives on which the relative path exists choose the drive with the least used space. For **create** category functions it will exclude readonly drives and those with free space less than **minfreespace**. Falls back to **lus**. | | epmfs (existing path, most free space) | Of all the drives on which the relative path exists choose the drive with the most free space. For **create** category functions it will exclude readonly drives and those with free space less than **minfreespace**. Falls back to **mfs**. | | eprand (existing path, random) | Calls **epall** and then randomizes. Otherwise behaves the same as **epall**. | | erofs | Exclusively return **-1** with **errno** set to **EROFS** (Read-only filesystem). By setting **create** functions to this you can in effect turn the filesystem mostly readonly. | | ff (first found) | Given the order of the drives, as defined at mount time or configured at runtime, act on the first one found. For **create** category functions it will exclude readonly drives and those with free space less than **minfreespace** (unless there is no other option). | | lfs (least free space) | Pick the drive with the least available free space. For **create** category functions it will exclude readonly drives and those with free space less than **minfreespace**. Falls back to **mfs**. | | lus (least used space) | Pick the drive with the least used space. For **create** category functions it will exclude readonly drives and those with free space less than **minfreespace**. Falls back to **mfs**. | | mfs (most free space) | Pick the drive with the most available free space. For **create** category functions it will exclude readonly drives. Falls back to **ff**. | | newest | Pick the file / directory with the largest mtime. For **create** category functions it will exclude readonly drives and those with free space less than **minfreespace** (unless there is no other option). | | rand (random) | Calls **all** and then randomizes. | #### Defaults #### | Category | Policy | |----------|--------| | action | all | | create | epmfs | | search | ff | #### rename & link #### **NOTE:** If you're receiving errors from software when files are moved / renamed then you should consider changing the create policy to one which is **not** path preserving or contacting the author of the offending software and requesting that `EXDEV` be properly handled. [rename](http://man7.org/linux/man-pages/man2/rename.2.html) is a tricky function in a merged system. Under normal situations rename only works within a single filesystem or device. If a rename can't be done atomically due to the source and destination paths existing on different mount points it will return **-1** with **errno = EXDEV** (cross device). Originally mergerfs would return EXDEV whenever a rename was requested which was cross directory in any way. This made the code simple and was technically complient with POSIX requirements. However, many applications fail to handle EXDEV at all and treat it as a normal error or otherwise handle it poorly. Such apps include: gvfsd-fuse v1.20.3 and prior, Finder / CIFS/SMB client in Apple OSX 10.9+, NZBGet, Samba's recycling bin feature. As a result a compromise was made in order to get most software to work while still obeying mergerfs' policies. Below is the rather complicated logic. * If using a **create** policy which tries to preserve directory paths (epff,eplfs,eplus,epmfs) * Using the **rename** policy get the list of files to rename * For each file attempt rename: * If failure with ENOENT run **create** policy * If create policy returns the same drive as currently evaluating then clone the path * Re-attempt rename * If **any** of the renames succeed the higher level rename is considered a success * If **no** renames succeed the first error encountered will be returned * On success: * Remove the target from all drives with no source file * Remove the source from all drives which failed to rename * If using a **create** policy which does **not** try to preserve directory paths * Using the **rename** policy get the list of files to rename * Using the **getattr** policy get the target path * For each file attempt rename: * If the source drive != target drive: * Clone target path from target drive to source drive * Rename * If **any** of the renames succeed the higher level rename is considered a success * If **no** renames succeed the first error encountered will be returned * On success: * Remove the target from all drives with no source file * Remove the source from all drives which failed to rename The the removals are subject to normal entitlement checks. The above behavior will help minimize the likelihood of EXDEV being returned but it will still be possible. **link** uses the same basic strategy. #### readdir #### [readdir](http://linux.die.net/man/3/readdir) is different from all other filesystem functions. While it could have it's own set of policies to tweak its behavior at this time it provides a simple union of files and directories found. Remember that any action or information queried about these files and directories come from the respective function. For instance: an **ls** is a **readdir** and for each file/directory returned **getattr** is called. Meaning the policy of **getattr** is responsible for choosing the file/directory which is the source of the metadata you see in an **ls**. #### statvfs #### [statvfs](http://linux.die.net/man/2/statvfs) normalizes the source drives based on the fragment size and sums the number of adjusted blocks and inodes. This means you will see the combined space of all sources. Total, used, and free. The sources however are dedupped based on the drive so multiple sources on the same drive will not result in double counting it's space. # BUILDING **NOTE:** Prebuilt packages can be found at: https://github.com/trapexit/mergerfs/releases First get the code from [github](http://github.com/trapexit/mergerfs). ``` $ git clone https://github.com/trapexit/mergerfs.git $ # or $ wget https://github.com/trapexit/mergerfs/releases/download//mergerfs-.tar.gz ``` #### Debian / Ubuntu ``` $ sudo apt-get install g++ pkg-config git git-buildpackage pandoc debhelper libfuse-dev libattr1-dev python $ cd mergerfs $ make deb $ sudo dpkg -i ../mergerfs_version_arch.deb ``` #### Fedora ``` $ su - # dnf install rpm-build fuse-devel libattr-devel pandoc gcc-c++ git make which python # cd mergerfs # make rpm # rpm -i rpmbuild/RPMS//mergerfs-..rpm ``` #### Generically Have git, python, pkg-config, pandoc, libfuse, libattr1 installed. ``` $ cd mergerfs $ make $ make man $ sudo make install ``` # RUNTIME #### .mergerfs pseudo file #### ``` /.mergerfs ``` There is a pseudo file available at the mount point which allows for the runtime modification of certain **mergerfs** options. The file will not show up in **readdir** but can be **stat**'ed and manipulated via [{list,get,set}xattrs](http://linux.die.net/man/2/listxattr) calls. Even if xattrs are disabled for mergerfs the [{list,get,set}xattrs](http://linux.die.net/man/2/listxattr) calls against this pseudo file will still work. Any changes made at runtime are **not** persisted. If you wish for values to persist they must be included as options wherever you configure the mounting of mergerfs (fstab). ##### Keys ##### Use `xattr -l /mount/point/.mergerfs` to see all supported keys. Some are informational and therefore readonly. ###### user.mergerfs.srcmounts ###### Used to query or modify the list of source mounts. When modifying there are several shortcuts to easy manipulation of the list. | Value | Description | |--------------|-------------| | [list] | set | | +<[list] | prepend | | +>[list] | append | | -[list] | remove all values provided | | -< | remove first in list | | -> | remove last in list | ###### minfreespace ###### Input: interger with an optional multiplier suffix. **K**, **M**, or **G**. Output: value in bytes ###### moveonenospc ###### Input: **true** and **false** Ouput: **true** or **false** ###### categories / funcs ###### Input: short policy string as described elsewhere in this document Output: the policy string except for categories where its funcs have multiple types. In that case it will be a comma separated list ##### Example ##### ``` [trapexit:/tmp/mount] $ xattr -l .mergerfs user.mergerfs.srcmounts: /tmp/a:/tmp/b user.mergerfs.minfreespace: 4294967295 user.mergerfs.moveonenospc: false ... [trapexit:/tmp/mount] $ xattr -p user.mergerfs.category.search .mergerfs ff [trapexit:/tmp/mount] $ xattr -w user.mergerfs.category.search newest .mergerfs [trapexit:/tmp/mount] $ xattr -p user.mergerfs.category.search .mergerfs newest [trapexit:/tmp/mount] $ xattr -w user.mergerfs.srcmounts +/tmp/c .mergerfs [trapexit:/tmp/mount] $ xattr -p user.mergerfs.srcmounts .mergerfs /tmp/a:/tmp/b:/tmp/c [trapexit:/tmp/mount] $ xattr -w user.mergerfs.srcmounts =/tmp/c .mergerfs [trapexit:/tmp/mount] $ xattr -p user.mergerfs.srcmounts .mergerfs /tmp/c [trapexit:/tmp/mount] $ xattr -w user.mergerfs.srcmounts '+= 2.6.3 allows upto 65535 groups per user but most other *nixs allow far less. NFS allowing only 16. The system does handle overflow gracefully. If the user has more than 32 supplemental groups only the first 32 will be used. If more than 256 users are using the system when an uncached user is found it will evict an existing user's cache at random. So long as there aren't more than 256 active users this should be fine. If either value is too low for your needs you will have to modify `gidcache.hpp` to increase the values. Note that doing so will increase the memory needed by each thread. #### mergerfs or libfuse crashing If suddenly the mergerfs mount point disappears and `Transport endpoint is not connected` is returned when attempting to perform actions within the mount directory **and** the version of libfuse (use `mergerfs -v` to find the version) is older than `2.9.4` its likely due to a bug in libfuse. Affected versions of libfuse can be found in Debian Wheezy, Ubuntu Precise and others. In order to fix this please install newer versions of libfuse. If using a Debian based distro (Debian,Ubuntu,Mint) you can likely just install newer versions of [libfuse](https://packages.debian.org/unstable/libfuse2) and [fuse](https://packages.debian.org/unstable/fuse) from the repo of a newer release. #### mergerfs appears to be crashing or exiting There seems to be an issue with Linux version `4.9.0` and above in which an invalid message appears to be transmitted to libfuse (used by mergerfs) causing it to exit. No messages will be printed in any logs as its not a proper crash. Debugging of the issue is still ongoing and can be followed via the [fuse-devel thread](https://sourceforge.net/p/fuse/mailman/message/35662577). #### mergerfs under heavy load and memory preasure leads to kernel panic https://lkml.org/lkml/2016/9/14/527 ``` [25192.515454] kernel BUG at /build/linux-a2WvEb/linux-4.4.0/mm/workingset.c:346! [25192.517521] invalid opcode: 0000 [#1] SMP [25192.519602] Modules linked in: netconsole ip6t_REJECT nf_reject_ipv6 ipt_REJECT nf_reject_ipv4 configfs binfmt_misc veth bridge stp llc nf_conntrack_ipv6 nf_defrag_ipv6 xt_conntrack ip6table_filter ip6_tables xt_multiport iptable_filter ipt_MASQUERADE nf_nat_masquerade_ipv4 xt_comment xt_nat iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack xt_CHECKSUM xt_tcpudp iptable_mangle ip_tables x_tables intel_rapl x86_pkg_temp_thermal intel_powerclamp eeepc_wmi asus_wmi coretemp sparse_keymap kvm_intel ppdev kvm irqbypass mei_me 8250_fintek input_leds serio_raw parport_pc tpm_infineon mei shpchp mac_hid parport lpc_ich autofs4 drbg ansi_cprng dm_crypt algif_skcipher af_alg btrfs raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid0 multipath linear raid10 raid1 i915 crct10dif_pclmul crc32_pclmul aesni_intel i2c_algo_bit aes_x86_64 drm_kms_helper lrw gf128mul glue_helper ablk_helper syscopyarea cryptd sysfillrect sysimgblt fb_sys_fops drm ahci r8169 libahci mii wmi fjes video [last unloaded: netconsole] [25192.540910] CPU: 2 PID: 63 Comm: kswapd0 Not tainted 4.4.0-36-generic #55-Ubuntu [25192.543411] Hardware name: System manufacturer System Product Name/P8H67-M PRO, BIOS 3904 04/27/2013 [25192.545840] task: ffff88040cae6040 ti: ffff880407488000 task.ti: ffff880407488000 [25192.548277] RIP: 0010:[] [] shadow_lru_isolate+0x181/0x190 [25192.550706] RSP: 0018:ffff88040748bbe0 EFLAGS: 00010002 [25192.553127] RAX: 0000000000001c81 RBX: ffff8802f91ee928 RCX: ffff8802f91eeb38 [25192.555544] RDX: ffff8802f91ee938 RSI: ffff8802f91ee928 RDI: ffff8804099ba2c0 [25192.557914] RBP: ffff88040748bc08 R08: 000000000001a7b6 R09: 000000000000003f [25192.560237] R10: 000000000001a750 R11: 0000000000000000 R12: ffff8804099ba2c0 [25192.562512] R13: ffff8803157e9680 R14: ffff8803157e9668 R15: ffff8804099ba2c8 [25192.564724] FS: 0000000000000000(0000) GS:ffff88041f280000(0000) knlGS:0000000000000000 [25192.566990] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [25192.569201] CR2: 00007ffabb690000 CR3: 0000000001e0a000 CR4: 00000000000406e0 [25192.571419] Stack: [25192.573550] ffff8804099ba2c0 ffff88039e4f86f0 ffff8802f91ee928 ffff8804099ba2c8 [25192.575695] ffff88040748bd08 ffff88040748bc58 ffffffff811b99bf 0000000000000052 [25192.577814] 0000000000000000 ffffffff811ba380 000000000000008a 0000000000000080 [25192.579947] Call Trace: [25192.582022] [] __list_lru_walk_one.isra.3+0x8f/0x130 [25192.584137] [] ? memcg_drain_all_list_lrus+0x190/0x190 [25192.586165] [] list_lru_walk_one+0x23/0x30 [25192.588145] [] scan_shadow_nodes+0x34/0x50 [25192.590074] [] shrink_slab.part.40+0x1ed/0x3d0 [25192.591985] [] shrink_zone+0x2ca/0x2e0 [25192.593863] [] kswapd+0x51e/0x990 [25192.595737] [] ? mem_cgroup_shrink_node_zone+0x1c0/0x1c0 [25192.597613] [] kthread+0xd8/0xf0 [25192.599495] [] ? kthread_create_on_node+0x1e0/0x1e0 [25192.601335] [] ret_from_fork+0x3f/0x70 [25192.603193] [] ? kthread_create_on_node+0x1e0/0x1e0 ``` There is a bug in the kernel. A work around appears to be turning off `splice`. Add `no_splice_write,no_splice_move,no_splice_read` to mergerfs' options. Should be placed after `defaults` if it is used since it will turn them on. This however is not guaranteed to work. # FAQ #### Why use mergerfs over mhddfs? mhddfs is no longer maintained and has some known stability and security issues (see below). MergerFS provides a superset of mhddfs' features and should offer the same or maybe better performance. If you wish to get similar behavior to mhddfs from mergerfs then set `category.create=ff`. #### Why use mergerfs over aufs? While aufs can offer better peak performance mergerfs provides more configurability and is generally easier to use. mergerfs however does not offer the overlay / copy-on-write (COW) features which aufs and overlayfs have. #### Why use mergerfs over LVM/ZFS/BTRFS/RAID0 drive concatenation / striping? With simple JBOD / drive concatenation / stripping / RAID0 a single drive failure will result in full pool failure. mergerfs performs a similar behavior without the possibility of catastrophic failure and difficulties in recovery. Drives may fail however all other data will continue to be accessable. When combined with something like [SnapRaid](http://www.snapraid.it) and/or an offsite backup solution you can have the flexibilty of JBOD without the single point of failure. #### Why use mergerfs over ZFS? MergerFS is not intended to be a replacement for ZFS. MergerFS is intended to provide flexible pooling of arbitrary drives (local or remote), of arbitrary sizes, and arbitrary filesystems. For `write once, read many` usecases such as bulk media storage. Where data integrity and backup is managed in other ways. In that situation ZFS can introduce major maintance and cost burdens as described [here](http://louwrentius.com/the-hidden-cost-of-using-zfs-for-your-home-nas.html). #### Can drives be written to directly? Outside of mergerfs while pooled? Yes. It will be represented immediately in the pool as the policies perscribe. #### Why do I get an "out of space" error even though the system says there's lots of space left? First make sure you've read the sections above about policies, path preserving, and the **moveonenospc** option. Remember that mergerfs is simply presenting a logical merging of the contents of the pooled drives. The reported free space is the aggregate space available **not** the contiguous space available. MergerFS does not split files across drives. If the writing of a file fills a drive and **moveonenospc** is disabled it will return an ENOSPC error. If **moveonenospc** is enabled but there exists no drives with enough space for the file and the data to be written (or the drive happened to fill up as the file was being moved) it will error indicating there isn't enough space. It is also possible that the filesystem selected has run out of inodes. Use `df -i` to list the total and available inodes per filesystem. In the future it might be worth considering the number of inodes available when making placement decisions in order to minimize this situation. #### Can mergerfs mounts be exported over NFS? Yes. Some clients (Kodi) have issues in which the contents of the NFS mount will not be presented but users have found that enabling the `use_ino` option often fixes that problem. #### Can mergerfs mounts be exported over Samba / SMB? Yes. #### How are inodes calculated? mergerfs-inode = (original-inode | (device-id << 32)) While `ino_t` is 64 bits only a few filesystems use more than 32. Similarly, while `dev_t` is also 64 bits it was traditionally 16 bits. Bitwise or'ing them together should work most of the time. While totally unique inodes are preferred the overhead which would be needed does not seem to outweighted by the benefits. #### It's mentioned that there are some security issues with mhddfs. What are they? How does mergerfs address them? [mhddfs](https://github.com/trapexit/mhddfs) manages running as **root** by calling [getuid()](https://github.com/trapexit/mhddfs/blob/cae96e6251dd91e2bdc24800b4a18a74044f6672/src/main.c#L319) and if it returns **0** then it will [chown](http://linux.die.net/man/1/chown) the file. Not only is that a race condition but it doesn't handle many other situations. Rather than attempting to simulate POSIX ACL behavior the proper way to manage this is to use [seteuid](http://linux.die.net/man/2/seteuid) and [setegid](http://linux.die.net/man/2/setegid), in effect becoming the user making the original call, and perform the action as them. This is what mergerfs does. In Linux setreuid syscalls apply only to the thread. GLIBC hides this away by using realtime signals to inform all threads to change credentials. Taking after **Samba**, mergerfs uses **syscall(SYS_setreuid,...)** to set the callers credentials for that thread only. Jumping back to **root** as necessary should escalated privileges be needed (for instance: to clone paths between drives). For non-Linux systems mergerfs uses a read-write lock and changes credentials only when necessary. If multiple threads are to be user X then only the first one will need to change the processes credentials. So long as the other threads need to be user X they will take a readlock allowing multiple threads to share the credentials. Once a request comes in to run as user Y that thread will attempt a write lock and change to Y's credentials when it can. If the ability to give writers priority is supported then that flag will be used so threads trying to change credentials don't starve. This isn't the best solution but should work reasonably well assuming there are few users. # SUPPORT #### Issues with the software * github.com: https://github.com/trapexit/mergerfs/issues * email: trapexit@spawn.link * twitter: https://twitter.com/_trapexit #### Support development * Gratipay: https://gratipay.com/~trapexit * BitCoin: 12CdMhEPQVmjz3SSynkAEuD5q9JmhTDCZA # LINKS * http://github.com/trapexit/mergerfs * http://github.com/trapexit/mergerfs-tools * http://github.com/trapexit/scorch * http://github.com/trapexit/backup-and-recovery-howtos mergerfs-2.21.0/tools/0000775000175000017500000000000013101724730013156 5ustar bilebilemergerfs-2.21.0/tools/git2debcl0000775000175000017500000001062613035712542014754 0ustar bilebile#!/usr/bin/python # Copyright (c) 2016, Antonio SJ Musumeci # 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. import sys import subprocess import argparse def git_tags(): args = ["git", "tag", '-l'] tags = subprocess.check_output(args) tags = [[int(X) for X in tag.split(".")] for tag in tags.split()] tags.sort() tags.reverse() tags = [".".join([str(X) for X in tag]) for tag in tags] return tags def git_log(fromtag,totag): args = ['git','log','--no-merges','--oneline',fromtag+'...'+totag] return subprocess.check_output(args).strip().split('\n') def git_author_and_time(tag): args = ['git','log','-1','--format=-- %an <%ae> %cD',tag] return subprocess.check_output(args).strip() def git_version(): args = ['git','describe','--always','--tags','--dirty'] return subprocess.check_output(args).strip() def guess_distro(): try: args = ['lsb_release','-i','-s'] return subprocess.check_output(args).strip().lower() except: return 'unknown' def guess_codename(): try: args = ['lsb_release','-c','-s'] return subprocess.check_output(args).strip().lower() except: return 'unknown' def patch_subprocess(): if "check_output" not in dir( subprocess ): # duck punch it in! def check_output(*popenargs, **kwargs): r"""Run command with arguments and return its output as a byte string. Backported from Python 2.7 as it's implemented as pure python on stdlib. >>> check_output(['/usr/bin/python', '--version']) Python 2.6.2 """ process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs) output, unused_err = process.communicate() retcode = process.poll() if retcode: cmd = kwargs.get("args") if cmd is None: cmd = popenargs[0] error = subprocess.CalledProcessError(retcode, cmd) error.output = output raise error return output subprocess.check_output = check_output def main(): patch_subprocess() parser = argparse.ArgumentParser(description='Generated debian/changelog from git log') parser.add_argument('--name',type=str,help='Name of package',required=True) parser.add_argument('--version',type=str,help='Place in git history to include upto',default='::guess::') parser.add_argument('--distro',type=str,help='Distribution name',default='::guess::') parser.add_argument('--codename',type=str,help='Distribution codename',default='::guess::') parser.add_argument('--urgency',type=str,help='Urgency',default='medium') args = parser.parse_args() if args.distro == '::guess::': args.distro = guess_distro() if args.codename == '::guess::': args.codename = guess_codename() versuffix = "~"+args.distro+"-"+args.codename if args.version == '::guess::': args.version = git_version() tags = git_tags() if args.version in tags: idx = tags.index(args.version) tags = tags[idx:] tags = zip(tags,tags) else: tags = zip(tags,tags) tags.insert(0,(args.version,'HEAD')) for i in xrange(0,len(tags)): tags[i] = (tags[i][0] + versuffix,tags[i][1]) tag = tags[0] for prev in tags[1:]: lines = git_log(tag[1],prev[1]) if lines == ['']: tag = prev continue print('%s (%s) %s; urgency=%s\n' % (args.name,tag[0],args.codename,args.urgency)) for line in lines: print " * " + line authorandtime = git_author_and_time(tag[1]) print(' %s\n' % authorandtime) tag = prev if __name__ == "__main__": main() mergerfs-2.21.0/tools/cppfind0000775000175000017500000000031013101724730014521 0ustar bilebile#!/bin/sh CXX="${CXX:-c++}" FUSE_CFLAGS="$(pkg-config --cflags fuse) -DFUSE_USE_VERSION=29" echo "#include " | ${CXX} -E ${FUSE_CFLAGS} - | grep "${1}" > /dev/null [ "$?" != "0" ]; echo $? mergerfs-2.21.0/man/0000775000175000017500000000000013103071706012571 5ustar bilebilemergerfs-2.21.0/man/mergerfs.10000664000175000017500000012665213103514236014501 0ustar bilebile.\"t .\" Automatically generated by Pandoc 1.16.0.2 .\" .TH "mergerfs" "1" "2017\-02\-18" "mergerfs user manual" "" .hy .SH NAME .PP mergerfs \- a featureful union filesystem .SH SYNOPSIS .PP mergerfs \-o .SH DESCRIPTION .PP \f[B]mergerfs\f[] is a union filesystem geared towards simplifying storage and management of files across numerous commodity storage devices. It is similar to \f[B]mhddfs\f[], \f[B]unionfs\f[], and \f[B]aufs\f[]. .SH FEATURES .IP \[bu] 2 Runs in userspace (FUSE) .IP \[bu] 2 Configurable behaviors .IP \[bu] 2 Support for extended attributes (xattrs) .IP \[bu] 2 Support for file attributes (chattr) .IP \[bu] 2 Runtime configurable (via xattrs) .IP \[bu] 2 Safe to run as root .IP \[bu] 2 Opportunistic credential caching .IP \[bu] 2 Works with heterogeneous filesystem types .IP \[bu] 2 Handling of writes to full drives (transparently move file to drive with capacity) .IP \[bu] 2 Handles pool of readonly and read/write drives .IP \[bu] 2 Turn read\-only files into symlinks to increase read performance .SH OPTIONS .SS mount options .IP \[bu] 2 \f[B]defaults\f[]: a shortcut for FUSE\[aq]s \f[B]atomic_o_trunc\f[], \f[B]auto_cache\f[], \f[B]big_writes\f[], \f[B]default_permissions\f[], \f[B]splice_move\f[], \f[B]splice_read\f[], and \f[B]splice_write\f[]. These options seem to provide the best performance. .IP \[bu] 2 \f[B]direct_io\f[]: causes FUSE to bypass caching which can increase write speeds at the detriment of reads. Note that not enabling \f[C]direct_io\f[] will cause double caching of files and therefore less memory for caching generally. However, \f[C]mmap\f[] does not work when \f[C]direct_io\f[] is enabled. .IP \[bu] 2 \f[B]minfreespace\f[]: the minimum space value used for creation policies. Understands \[aq]K\[aq], \[aq]M\[aq], and \[aq]G\[aq] to represent kilobyte, megabyte, and gigabyte respectively. (default: 4G) .IP \[bu] 2 \f[B]moveonenospc\f[]: when enabled (set to \f[B]true\f[]) if a \f[B]write\f[] fails with \f[B]ENOSPC\f[] or \f[B]EDQUOT\f[] a scan of all drives will be done looking for the drive with most free space which is at least the size of the file plus the amount which failed to write. An attempt to move the file to that drive will occur (keeping all metadata possible) and if successful the original is unlinked and the write retried. (default: false) .IP \[bu] 2 \f[B]use_ino\f[]: causes mergerfs to supply file/directory inodes rather than libfuse. While not a default it is generally recommended it be enabled so that hard linked files share the same inode value. .IP \[bu] 2 \f[B]dropcacheonclose\f[]: when a file is requested to be closed call \f[C]posix_fadvise\f[] on it first to instruct the kernel that we no longer need the data and it can drop its cache. Recommended when \f[B]direct_io\f[] is not enabled to limit double caching. (default: false) .IP \[bu] 2 \f[B]symlinkify\f[]: when enabled (set to \f[B]true\f[]) and a file is not writable and its mtime or ctime is older than \f[B]symlinkify_timeout\f[] files will be reported as symlinks to the original files. Please read more below before using. (default: false) .IP \[bu] 2 \f[B]symlinkify_timeout\f[]: time to wait, in seconds, to activate the \f[B]symlinkify\f[] behavior. (default: 3600) .IP \[bu] 2 \f[B]fsname\f[]: sets the name of the filesystem as seen in \f[B]mount\f[], \f[B]df\f[], etc. Defaults to a list of the source paths concatenated together with the longest common prefix removed. .IP \[bu] 2 \f[B]func.=\f[]: sets the specific FUSE function\[aq]s policy. See below for the list of value types. Example: \f[B]func.getattr=newest\f[] .IP \[bu] 2 \f[B]category.=\f[]: Sets policy of all FUSE functions in the provided category. Example: \f[B]category.create=mfs\f[] .PP \f[B]NOTE:\f[] Options are evaluated in the order listed so if the options are \f[B]func.rmdir=rand,category.action=ff\f[] the \f[B]action\f[] category setting will override the \f[B]rmdir\f[] setting. .SS srcmounts .PP The srcmounts (source mounts) argument is a colon (\[aq]:\[aq]) delimited list of paths to be included in the pool. It does not matter if the paths are on the same or different drives nor does it matter the filesystem. Used and available space will not be duplicated for paths on the same device and any features which aren\[aq]t supported by the underlying filesystem (such as file attributes or extended attributes) will return the appropriate errors. .PP To make it easier to include multiple source mounts mergerfs supports globbing (http://linux.die.net/man/7/glob). \f[B]The globbing tokens MUST be escaped when using via the shell else the shell itself will expand it.\f[] .IP .nf \f[C] $\ mergerfs\ \-o\ defaults,allow_other,use_ino\ /mnt/disk\\*:/mnt/cdrom\ /media/drives \f[] .fi .PP The above line will use all mount points in /mnt prefixed with \f[B]disk\f[] and the \f[B]cdrom\f[]. .PP To have the pool mounted at boot or otherwise accessable from related tools use \f[B]/etc/fstab\f[]. .IP .nf \f[C] #\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ /mnt/disk*:/mnt/cdrom\ \ /media/drives\ \ fuse.mergerfs\ \ defaults,allow_other,use_ino\ \ 0\ \ \ \ \ \ \ 0 \f[] .fi .PP \f[B]NOTE:\f[] the globbing is done at mount or xattr update time (see below). If a new directory is added matching the glob after the fact it will not be automatically included. .PP \f[B]NOTE:\f[] for mounting via \f[B]fstab\f[] to work you must have \f[B]mount.fuse\f[] installed. For Ubuntu/Debian it is included in the \f[B]fuse\f[] package. .SS symlinkify .PP Due to the levels of indirection introduced by mergerfs and the underlying technology FUSE there can be varying levels of performance degredation. This feature will turn non\-directories which are not writable into symlinks to the original file found by the \f[C]readlink\f[] policy after the mtime and ctime are older than the timeout. .PP \f[B]WARNING:\f[] The current implementation has a known issue in which if the file is open and being used when the file is converted to a symlink then the application which has that file open will receive an error when using it. This is unlikely to occur in practice but is something to keep in mind. .PP \f[B]WARNING:\f[] Some backup solutions, such as CrashPlan, do not backup the target of a symlink. If using this feature it will be necessary to point any backup software to the original drives or configure the software to follow symlinks if such an option is available. Alternatively create two mounts. One for backup and one for general consumption. .SH FUNCTIONS / POLICIES / CATEGORIES .PP The POSIX filesystem API has a number of functions. \f[B]creat\f[], \f[B]stat\f[], \f[B]chown\f[], etc. In mergerfs these functions are grouped into 3 categories: \f[B]action\f[], \f[B]create\f[], and \f[B]search\f[]. Functions and categories can be assigned a policy which dictates how \f[B]mergerfs\f[] behaves. Any policy can be assigned to a function or category though some may not be very useful in practice. For instance: \f[B]rand\f[] (random) may be useful for file creation (create) but could lead to very odd behavior if used for \f[C]chmod\f[] (though only if there were more than one copy of the file). .PP Policies, when called to create, will ignore drives which are readonly. This allows for readonly and read/write drives to be mixed together. Note that the drive must be explicitly mounted with the \f[B]ro\f[] mount option for this to work. .SS Function / Category classifications .PP .TS tab(@); lw(7.9n) lw(62.1n). T{ Category T}@T{ FUSE Functions T} _ T{ action T}@T{ chmod, chown, link, removexattr, rename, rmdir, setxattr, truncate, unlink, utimens T} T{ create T}@T{ create, mkdir, mknod, symlink T} T{ search T}@T{ access, getattr, getxattr, ioctl, listxattr, open, readlink T} T{ N/A T}@T{ fallocate, fgetattr, fsync, ftruncate, ioctl, read, readdir, release, statfs, write T} .TE .PP Due to FUSE limitations \f[B]ioctl\f[] behaves differently if its acting on a directory. It\[aq]ll use the \f[B]getattr\f[] policy to find and open the directory before issuing the \f[B]ioctl\f[]. In other cases where something may be searched (to confirm a directory exists across all source mounts) \f[B]getattr\f[] will also be used. .SS Path Preservation .PP Policies, as described below, are of two core types. \f[C]path\ preserving\f[] and \f[C]non\-path\ preserving\f[]. .PP All policies which start with \f[C]ep\f[] (\f[B]epff\f[], \f[B]eplfs\f[], \f[B]eplus\f[], \f[B]epmfs\f[], \f[B]eprand\f[]) are \f[C]path\ preserving\[aq].\f[]ep\f[C]stands\ for\ \[aq]existing\ path\f[]. .PP As the descriptions explain a path preserving policy will only consider drives where the relative path being accessed already exists. .PP When using non\-path preserving policies where something is created paths will be copied to target drives as necessary. .SS Policy descriptions .PP .TS tab(@); lw(16.6n) lw(53.4n). T{ Policy T}@T{ Description T} _ T{ all T}@T{ Search category: acts like \f[B]ff\f[]. Action category: apply to all found. Create category: for \f[B]mkdir\f[], \f[B]mknod\f[], and \f[B]symlink\f[] it will apply to all found. \f[B]create\f[] works like \f[B]ff\f[]. It will exclude readonly drives and those with free space less than \f[B]minfreespace\f[]. T} T{ epall (existing path, all) T}@T{ Search category: acts like \f[B]epff\f[]. Action category: apply to all found. Create category: for \f[B]mkdir\f[], \f[B]mknod\f[], and \f[B]symlink\f[] it will apply to all existing paths found. \f[B]create\f[] works like \f[B]epff\f[]. Excludes readonly drives and those with free space less than \f[B]minfreespace\f[]. T} T{ epff (existing path, first found) T}@T{ Given the order of the drives, as defined at mount time or configured at runtime, act on the first one found where the relative path already exists. For \f[B]create\f[] category functions it will exclude readonly drives and those with free space less than \f[B]minfreespace\f[] (unless there is no other option). Falls back to \f[B]ff\f[]. T} T{ eplfs (existing path, least free space) T}@T{ Of all the drives on which the relative path exists choose the drive with the least free space. For \f[B]create\f[] category functions it will exclude readonly drives and those with free space less than \f[B]minfreespace\f[]. Falls back to \f[B]lfs\f[]. T} T{ eplus (existing path, least used space) T}@T{ Of all the drives on which the relative path exists choose the drive with the least used space. For \f[B]create\f[] category functions it will exclude readonly drives and those with free space less than \f[B]minfreespace\f[]. Falls back to \f[B]lus\f[]. T} T{ epmfs (existing path, most free space) T}@T{ Of all the drives on which the relative path exists choose the drive with the most free space. For \f[B]create\f[] category functions it will exclude readonly drives and those with free space less than \f[B]minfreespace\f[]. Falls back to \f[B]mfs\f[]. T} T{ eprand (existing path, random) T}@T{ Calls \f[B]epall\f[] and then randomizes. Otherwise behaves the same as \f[B]epall\f[]. T} T{ erofs T}@T{ Exclusively return \f[B]\-1\f[] with \f[B]errno\f[] set to \f[B]EROFS\f[] (Read\-only filesystem). By setting \f[B]create\f[] functions to this you can in effect turn the filesystem mostly readonly. T} T{ ff (first found) T}@T{ Given the order of the drives, as defined at mount time or configured at runtime, act on the first one found. For \f[B]create\f[] category functions it will exclude readonly drives and those with free space less than \f[B]minfreespace\f[] (unless there is no other option). T} T{ lfs (least free space) T}@T{ Pick the drive with the least available free space. For \f[B]create\f[] category functions it will exclude readonly drives and those with free space less than \f[B]minfreespace\f[]. Falls back to \f[B]mfs\f[]. T} T{ lus (least used space) T}@T{ Pick the drive with the least used space. For \f[B]create\f[] category functions it will exclude readonly drives and those with free space less than \f[B]minfreespace\f[]. Falls back to \f[B]mfs\f[]. T} T{ mfs (most free space) T}@T{ Pick the drive with the most available free space. For \f[B]create\f[] category functions it will exclude readonly drives. Falls back to \f[B]ff\f[]. T} T{ newest T}@T{ Pick the file / directory with the largest mtime. For \f[B]create\f[] category functions it will exclude readonly drives and those with free space less than \f[B]minfreespace\f[] (unless there is no other option). T} T{ rand (random) T}@T{ Calls \f[B]all\f[] and then randomizes. T} .TE .SS Defaults .PP .TS tab(@); l l. T{ Category T}@T{ Policy T} _ T{ action T}@T{ all T} T{ create T}@T{ epmfs T} T{ search T}@T{ ff T} .TE .SS rename & link .PP \f[B]NOTE:\f[] If you\[aq]re receiving errors from software when files are moved / renamed then you should consider changing the create policy to one which is \f[B]not\f[] path preserving or contacting the author of the offending software and requesting that \f[C]EXDEV\f[] be properly handled. .PP rename (http://man7.org/linux/man-pages/man2/rename.2.html) is a tricky function in a merged system. Under normal situations rename only works within a single filesystem or device. If a rename can\[aq]t be done atomically due to the source and destination paths existing on different mount points it will return \f[B]\-1\f[] with \f[B]errno = EXDEV\f[] (cross device). .PP Originally mergerfs would return EXDEV whenever a rename was requested which was cross directory in any way. This made the code simple and was technically complient with POSIX requirements. However, many applications fail to handle EXDEV at all and treat it as a normal error or otherwise handle it poorly. Such apps include: gvfsd\-fuse v1.20.3 and prior, Finder / CIFS/SMB client in Apple OSX 10.9+, NZBGet, Samba\[aq]s recycling bin feature. .PP As a result a compromise was made in order to get most software to work while still obeying mergerfs\[aq] policies. Below is the rather complicated logic. .IP \[bu] 2 If using a \f[B]create\f[] policy which tries to preserve directory paths (epff,eplfs,eplus,epmfs) .IP \[bu] 2 Using the \f[B]rename\f[] policy get the list of files to rename .IP \[bu] 2 For each file attempt rename: .RS 2 .IP \[bu] 2 If failure with ENOENT run \f[B]create\f[] policy .IP \[bu] 2 If create policy returns the same drive as currently evaluating then clone the path .IP \[bu] 2 Re\-attempt rename .RE .IP \[bu] 2 If \f[B]any\f[] of the renames succeed the higher level rename is considered a success .IP \[bu] 2 If \f[B]no\f[] renames succeed the first error encountered will be returned .IP \[bu] 2 On success: .RS 2 .IP \[bu] 2 Remove the target from all drives with no source file .IP \[bu] 2 Remove the source from all drives which failed to rename .RE .IP \[bu] 2 If using a \f[B]create\f[] policy which does \f[B]not\f[] try to preserve directory paths .IP \[bu] 2 Using the \f[B]rename\f[] policy get the list of files to rename .IP \[bu] 2 Using the \f[B]getattr\f[] policy get the target path .IP \[bu] 2 For each file attempt rename: .RS 2 .IP \[bu] 2 If the source drive != target drive: .IP \[bu] 2 Clone target path from target drive to source drive .IP \[bu] 2 Rename .RE .IP \[bu] 2 If \f[B]any\f[] of the renames succeed the higher level rename is considered a success .IP \[bu] 2 If \f[B]no\f[] renames succeed the first error encountered will be returned .IP \[bu] 2 On success: .RS 2 .IP \[bu] 2 Remove the target from all drives with no source file .IP \[bu] 2 Remove the source from all drives which failed to rename .RE .PP The the removals are subject to normal entitlement checks. .PP The above behavior will help minimize the likelihood of EXDEV being returned but it will still be possible. .PP \f[B]link\f[] uses the same basic strategy. .SS readdir .PP readdir (http://linux.die.net/man/3/readdir) is different from all other filesystem functions. While it could have it\[aq]s own set of policies to tweak its behavior at this time it provides a simple union of files and directories found. Remember that any action or information queried about these files and directories come from the respective function. For instance: an \f[B]ls\f[] is a \f[B]readdir\f[] and for each file/directory returned \f[B]getattr\f[] is called. Meaning the policy of \f[B]getattr\f[] is responsible for choosing the file/directory which is the source of the metadata you see in an \f[B]ls\f[]. .SS statvfs .PP statvfs (http://linux.die.net/man/2/statvfs) normalizes the source drives based on the fragment size and sums the number of adjusted blocks and inodes. This means you will see the combined space of all sources. Total, used, and free. The sources however are dedupped based on the drive so multiple sources on the same drive will not result in double counting it\[aq]s space. .SH BUILDING .PP \f[B]NOTE:\f[] Prebuilt packages can be found at: https://github.com/trapexit/mergerfs/releases .PP First get the code from github (http://github.com/trapexit/mergerfs). .IP .nf \f[C] $\ git\ clone\ https://github.com/trapexit/mergerfs.git $\ #\ or $\ wget\ https://github.com/trapexit/mergerfs/releases/download//mergerfs\-.tar.gz \f[] .fi .SS Debian / Ubuntu .IP .nf \f[C] $\ sudo\ apt\-get\ install\ g++\ pkg\-config\ git\ git\-buildpackage\ pandoc\ debhelper\ libfuse\-dev\ libattr1\-dev\ python $\ cd\ mergerfs $\ make\ deb $\ sudo\ dpkg\ \-i\ ../mergerfs_version_arch.deb \f[] .fi .SS Fedora .IP .nf \f[C] $\ su\ \- #\ dnf\ install\ rpm\-build\ fuse\-devel\ libattr\-devel\ pandoc\ gcc\-c++\ git\ make\ which\ python #\ cd\ mergerfs #\ make\ rpm #\ rpm\ \-i\ rpmbuild/RPMS//mergerfs\-..rpm \f[] .fi .SS Generically .PP Have git, python, pkg\-config, pandoc, libfuse, libattr1 installed. .IP .nf \f[C] $\ cd\ mergerfs $\ make $\ make\ man $\ sudo\ make\ install \f[] .fi .SH RUNTIME .SS \&.mergerfs pseudo file .IP .nf \f[C] /.mergerfs \f[] .fi .PP There is a pseudo file available at the mount point which allows for the runtime modification of certain \f[B]mergerfs\f[] options. The file will not show up in \f[B]readdir\f[] but can be \f[B]stat\f[]\[aq]ed and manipulated via {list,get,set}xattrs (http://linux.die.net/man/2/listxattr) calls. .PP Even if xattrs are disabled for mergerfs the {list,get,set}xattrs (http://linux.die.net/man/2/listxattr) calls against this pseudo file will still work. .PP Any changes made at runtime are \f[B]not\f[] persisted. If you wish for values to persist they must be included as options wherever you configure the mounting of mergerfs (fstab). .SS Keys .PP Use \f[C]xattr\ \-l\ /mount/point/.mergerfs\f[] to see all supported keys. Some are informational and therefore readonly. .SS user.mergerfs.srcmounts .PP Used to query or modify the list of source mounts. When modifying there are several shortcuts to easy manipulation of the list. .PP .TS tab(@); l l. T{ Value T}@T{ Description T} _ T{ [list] T}@T{ set T} T{ +<[list] T}@T{ prepend T} T{ +>[list] T}@T{ append T} T{ \-[list] T}@T{ remove all values provided T} T{ \-< T}@T{ remove first in list T} T{ \-> T}@T{ remove last in list T} .TE .SS minfreespace .PP Input: interger with an optional multiplier suffix. \f[B]K\f[], \f[B]M\f[], or \f[B]G\f[]. .PP Output: value in bytes .SS moveonenospc .PP Input: \f[B]true\f[] and \f[B]false\f[] .PP Ouput: \f[B]true\f[] or \f[B]false\f[] .SS categories / funcs .PP Input: short policy string as described elsewhere in this document .PP Output: the policy string except for categories where its funcs have multiple types. In that case it will be a comma separated list .SS Example .IP .nf \f[C] [trapexit:/tmp/mount]\ $\ xattr\ \-l\ .mergerfs user.mergerfs.srcmounts:\ /tmp/a:/tmp/b user.mergerfs.minfreespace:\ 4294967295 user.mergerfs.moveonenospc:\ false \&... [trapexit:/tmp/mount]\ $\ xattr\ \-p\ user.mergerfs.category.search\ .mergerfs ff [trapexit:/tmp/mount]\ $\ xattr\ \-w\ user.mergerfs.category.search\ newest\ .mergerfs [trapexit:/tmp/mount]\ $\ xattr\ \-p\ user.mergerfs.category.search\ .mergerfs newest [trapexit:/tmp/mount]\ $\ xattr\ \-w\ user.mergerfs.srcmounts\ +/tmp/c\ .mergerfs [trapexit:/tmp/mount]\ $\ xattr\ \-p\ user.mergerfs.srcmounts\ .mergerfs /tmp/a:/tmp/b:/tmp/c [trapexit:/tmp/mount]\ $\ xattr\ \-w\ user.mergerfs.srcmounts\ =/tmp/c\ .mergerfs [trapexit:/tmp/mount]\ $\ xattr\ \-p\ user.mergerfs.srcmounts\ .mergerfs /tmp/c [trapexit:/tmp/mount]\ $\ xattr\ \-w\ user.mergerfs.srcmounts\ \[aq]+= 2.6.3 allows upto 65535 groups per user but most other *nixs allow far less. NFS allowing only 16. The system does handle overflow gracefully. If the user has more than 32 supplemental groups only the first 32 will be used. If more than 256 users are using the system when an uncached user is found it will evict an existing user\[aq]s cache at random. So long as there aren\[aq]t more than 256 active users this should be fine. If either value is too low for your needs you will have to modify \f[C]gidcache.hpp\f[] to increase the values. Note that doing so will increase the memory needed by each thread. .SS mergerfs or libfuse crashing .PP If suddenly the mergerfs mount point disappears and \f[C]Transport\ endpoint\ is\ not\ connected\f[] is returned when attempting to perform actions within the mount directory \f[B]and\f[] the version of libfuse (use \f[C]mergerfs\ \-v\f[] to find the version) is older than \f[C]2.9.4\f[] its likely due to a bug in libfuse. Affected versions of libfuse can be found in Debian Wheezy, Ubuntu Precise and others. .PP In order to fix this please install newer versions of libfuse. If using a Debian based distro (Debian,Ubuntu,Mint) you can likely just install newer versions of libfuse (https://packages.debian.org/unstable/libfuse2) and fuse (https://packages.debian.org/unstable/fuse) from the repo of a newer release. .SS mergerfs appears to be crashing or exiting .PP There seems to be an issue with Linux version \f[C]4.9.0\f[] and above in which an invalid message appears to be transmitted to libfuse (used by mergerfs) causing it to exit. No messages will be printed in any logs as its not a proper crash. Debugging of the issue is still ongoing and can be followed via the fuse\-devel thread (https://sourceforge.net/p/fuse/mailman/message/35662577). .SS mergerfs under heavy load and memory preasure leads to kernel panic .PP https://lkml.org/lkml/2016/9/14/527 .IP .nf \f[C] [25192.515454]\ kernel\ BUG\ at\ /build/linux\-a2WvEb/linux\-4.4.0/mm/workingset.c:346! [25192.517521]\ invalid\ opcode:\ 0000\ [#1]\ SMP [25192.519602]\ Modules\ linked\ in:\ netconsole\ ip6t_REJECT\ nf_reject_ipv6\ ipt_REJECT\ nf_reject_ipv4\ configfs\ binfmt_misc\ veth\ bridge\ stp\ llc\ nf_conntrack_ipv6\ nf_defrag_ipv6\ xt_conntrack\ ip6table_filter\ ip6_tables\ xt_multiport\ iptable_filter\ ipt_MASQUERADE\ nf_nat_masquerade_ipv4\ xt_comment\ xt_nat\ iptable_nat\ nf_conntrack_ipv4\ nf_defrag_ipv4\ nf_nat_ipv4\ nf_nat\ nf_conntrack\ xt_CHECKSUM\ xt_tcpudp\ iptable_mangle\ ip_tables\ x_tables\ intel_rapl\ x86_pkg_temp_thermal\ intel_powerclamp\ eeepc_wmi\ asus_wmi\ coretemp\ sparse_keymap\ kvm_intel\ ppdev\ kvm\ irqbypass\ mei_me\ 8250_fintek\ input_leds\ serio_raw\ parport_pc\ tpm_infineon\ mei\ shpchp\ mac_hid\ parport\ lpc_ich\ autofs4\ drbg\ ansi_cprng\ dm_crypt\ algif_skcipher\ af_alg\ btrfs\ raid456\ async_raid6_recov\ async_memcpy\ async_pq\ async_xor\ async_tx\ xor\ raid6_pq\ libcrc32c\ raid0\ multipath\ linear\ raid10\ raid1\ i915\ crct10dif_pclmul\ crc32_pclmul\ aesni_intel\ i2c_algo_bit\ aes_x86_64\ drm_kms_helper\ lrw\ gf128mul\ glue_helper\ ablk_helper\ syscopyarea\ cryptd\ sysfillrect\ sysimgblt\ fb_sys_fops\ drm\ ahci\ r8169\ libahci\ mii\ wmi\ fjes\ video\ [last\ unloaded:\ netconsole] [25192.540910]\ CPU:\ 2\ PID:\ 63\ Comm:\ kswapd0\ Not\ tainted\ 4.4.0\-36\-generic\ #55\-Ubuntu [25192.543411]\ Hardware\ name:\ System\ manufacturer\ System\ Product\ Name/P8H67\-M\ PRO,\ BIOS\ 3904\ 04/27/2013 [25192.545840]\ task:\ ffff88040cae6040\ ti:\ ffff880407488000\ task.ti:\ ffff880407488000 [25192.548277]\ RIP:\ 0010:[]\ \ []\ shadow_lru_isolate+0x181/0x190 [25192.550706]\ RSP:\ 0018:ffff88040748bbe0\ \ EFLAGS:\ 00010002 [25192.553127]\ RAX:\ 0000000000001c81\ RBX:\ ffff8802f91ee928\ RCX:\ ffff8802f91eeb38 [25192.555544]\ RDX:\ ffff8802f91ee938\ RSI:\ ffff8802f91ee928\ RDI:\ ffff8804099ba2c0 [25192.557914]\ RBP:\ ffff88040748bc08\ R08:\ 000000000001a7b6\ R09:\ 000000000000003f [25192.560237]\ R10:\ 000000000001a750\ R11:\ 0000000000000000\ R12:\ ffff8804099ba2c0 [25192.562512]\ R13:\ ffff8803157e9680\ R14:\ ffff8803157e9668\ R15:\ ffff8804099ba2c8 [25192.564724]\ FS:\ \ 0000000000000000(0000)\ GS:ffff88041f280000(0000)\ knlGS:0000000000000000 [25192.566990]\ CS:\ \ 0010\ DS:\ 0000\ ES:\ 0000\ CR0:\ 0000000080050033 [25192.569201]\ CR2:\ 00007ffabb690000\ CR3:\ 0000000001e0a000\ CR4:\ 00000000000406e0 [25192.571419]\ Stack: [25192.573550]\ \ ffff8804099ba2c0\ ffff88039e4f86f0\ ffff8802f91ee928\ ffff8804099ba2c8 [25192.575695]\ \ ffff88040748bd08\ ffff88040748bc58\ ffffffff811b99bf\ 0000000000000052 [25192.577814]\ \ 0000000000000000\ ffffffff811ba380\ 000000000000008a\ 0000000000000080 [25192.579947]\ Call\ Trace: [25192.582022]\ \ []\ __list_lru_walk_one.isra.3+0x8f/0x130 [25192.584137]\ \ []\ ?\ memcg_drain_all_list_lrus+0x190/0x190 [25192.586165]\ \ []\ list_lru_walk_one+0x23/0x30 [25192.588145]\ \ []\ scan_shadow_nodes+0x34/0x50 [25192.590074]\ \ []\ shrink_slab.part.40+0x1ed/0x3d0 [25192.591985]\ \ []\ shrink_zone+0x2ca/0x2e0 [25192.593863]\ \ []\ kswapd+0x51e/0x990 [25192.595737]\ \ []\ ?\ mem_cgroup_shrink_node_zone+0x1c0/0x1c0 [25192.597613]\ \ []\ kthread+0xd8/0xf0 [25192.599495]\ \ []\ ?\ kthread_create_on_node+0x1e0/0x1e0 [25192.601335]\ \ []\ ret_from_fork+0x3f/0x70 [25192.603193]\ \ []\ ?\ kthread_create_on_node+0x1e0/0x1e0 \f[] .fi .PP There is a bug in the kernel. A work around appears to be turning off \f[C]splice\f[]. Add \f[C]no_splice_write,no_splice_move,no_splice_read\f[] to mergerfs\[aq] options. Should be placed after \f[C]defaults\f[] if it is used since it will turn them on. This however is not guaranteed to work. .SH FAQ .SS Why use mergerfs over mhddfs? .PP mhddfs is no longer maintained and has some known stability and security issues (see below). MergerFS provides a superset of mhddfs\[aq] features and should offer the same or maybe better performance. .PP If you wish to get similar behavior to mhddfs from mergerfs then set \f[C]category.create=ff\f[]. .SS Why use mergerfs over aufs? .PP While aufs can offer better peak performance mergerfs provides more configurability and is generally easier to use. mergerfs however does not offer the overlay / copy\-on\-write (COW) features which aufs and overlayfs have. .SS Why use mergerfs over LVM/ZFS/BTRFS/RAID0 drive concatenation / striping? .PP With simple JBOD / drive concatenation / stripping / RAID0 a single drive failure will result in full pool failure. mergerfs performs a similar behavior without the possibility of catastrophic failure and difficulties in recovery. Drives may fail however all other data will continue to be accessable. .PP When combined with something like SnapRaid (http://www.snapraid.it) and/or an offsite backup solution you can have the flexibilty of JBOD without the single point of failure. .SS Why use mergerfs over ZFS? .PP MergerFS is not intended to be a replacement for ZFS. MergerFS is intended to provide flexible pooling of arbitrary drives (local or remote), of arbitrary sizes, and arbitrary filesystems. For \f[C]write\ once,\ read\ many\f[] usecases such as bulk media storage. Where data integrity and backup is managed in other ways. In that situation ZFS can introduce major maintance and cost burdens as described here (http://louwrentius.com/the-hidden-cost-of-using-zfs-for-your-home-nas.html). .SS Can drives be written to directly? Outside of mergerfs while pooled? .PP Yes. It will be represented immediately in the pool as the policies perscribe. .SS Why do I get an "out of space" error even though the system says there\[aq]s lots of space left? .PP First make sure you\[aq]ve read the sections above about policies, path preserving, and the \f[B]moveonenospc\f[] option. .PP Remember that mergerfs is simply presenting a logical merging of the contents of the pooled drives. The reported free space is the aggregate space available \f[B]not\f[] the contiguous space available. MergerFS does not split files across drives. If the writing of a file fills a drive and \f[B]moveonenospc\f[] is disabled it will return an ENOSPC error. .PP If \f[B]moveonenospc\f[] is enabled but there exists no drives with enough space for the file and the data to be written (or the drive happened to fill up as the file was being moved) it will error indicating there isn\[aq]t enough space. .PP It is also possible that the filesystem selected has run out of inodes. Use \f[C]df\ \-i\f[] to list the total and available inodes per filesystem. In the future it might be worth considering the number of inodes available when making placement decisions in order to minimize this situation. .SS Can mergerfs mounts be exported over NFS? .PP Yes. Some clients (Kodi) have issues in which the contents of the NFS mount will not be presented but users have found that enabling the \f[C]use_ino\f[] option often fixes that problem. .SS Can mergerfs mounts be exported over Samba / SMB? .PP Yes. .SS How are inodes calculated? .PP mergerfs\-inode = (original\-inode | (device\-id << 32)) .PP While \f[C]ino_t\f[] is 64 bits only a few filesystems use more than 32. Similarly, while \f[C]dev_t\f[] is also 64 bits it was traditionally 16 bits. Bitwise or\[aq]ing them together should work most of the time. While totally unique inodes are preferred the overhead which would be needed does not seem to outweighted by the benefits. .SS It\[aq]s mentioned that there are some security issues with mhddfs. What are they? How does mergerfs address them? .PP mhddfs (https://github.com/trapexit/mhddfs) manages running as \f[B]root\f[] by calling getuid() (https://github.com/trapexit/mhddfs/blob/cae96e6251dd91e2bdc24800b4a18a74044f6672/src/main.c#L319) and if it returns \f[B]0\f[] then it will chown (http://linux.die.net/man/1/chown) the file. Not only is that a race condition but it doesn\[aq]t handle many other situations. Rather than attempting to simulate POSIX ACL behavior the proper way to manage this is to use seteuid (http://linux.die.net/man/2/seteuid) and setegid (http://linux.die.net/man/2/setegid), in effect becoming the user making the original call, and perform the action as them. This is what mergerfs does. .PP In Linux setreuid syscalls apply only to the thread. GLIBC hides this away by using realtime signals to inform all threads to change credentials. Taking after \f[B]Samba\f[], mergerfs uses \f[B]syscall(SYS_setreuid,...)\f[] to set the callers credentials for that thread only. Jumping back to \f[B]root\f[] as necessary should escalated privileges be needed (for instance: to clone paths between drives). .PP For non\-Linux systems mergerfs uses a read\-write lock and changes credentials only when necessary. If multiple threads are to be user X then only the first one will need to change the processes credentials. So long as the other threads need to be user X they will take a readlock allowing multiple threads to share the credentials. Once a request comes in to run as user Y that thread will attempt a write lock and change to Y\[aq]s credentials when it can. If the ability to give writers priority is supported then that flag will be used so threads trying to change credentials don\[aq]t starve. This isn\[aq]t the best solution but should work reasonably well assuming there are few users. .SH SUPPORT .SS Issues with the software .IP \[bu] 2 github.com: https://github.com/trapexit/mergerfs/issues .IP \[bu] 2 email: trapexit\@spawn.link .IP \[bu] 2 twitter: https://twitter.com/_trapexit .SS Support development .IP \[bu] 2 Gratipay: https://gratipay.com/~trapexit .IP \[bu] 2 BitCoin: 12CdMhEPQVmjz3SSynkAEuD5q9JmhTDCZA .SH LINKS .IP \[bu] 2 http://github.com/trapexit/mergerfs .IP \[bu] 2 http://github.com/trapexit/mergerfs\-tools .IP \[bu] 2 http://github.com/trapexit/scorch .IP \[bu] 2 http://github.com/trapexit/backup\-and\-recovery\-howtos .SH AUTHORS Antonio SJ Musumeci . mergerfs-2.21.0/LICENSE0000664000175000017500000000144313035712542013031 0ustar bilebile/* ISC License Copyright (c) 2016, Antonio SJ Musumeci 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. */ mergerfs-2.21.0/.travis.yml0000664000175000017500000000134013101724730014125 0ustar bilebilelanguage: cpp matrix: include: - os: linux dist: precise compiler: gcc sudo: false - os: linux dist: precise compiler: clang sudo: false - os: linux dist: trusty compiler: gcc sudo: false - os: linux dist: trusty compiler: clang sudo: false - os: osx compiler: clang addons: apt: packages: - pkg-config - debhelper - libfuse-dev - libattr1-dev - python 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: - make mergerfs-2.21.0/Makefile0000664000175000017500000001442713101724730013466 0ustar bilebile# Copyright (c) 2016, Antonio SJ Musumeci # # 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. PKGCONFIG = $(shell which pkg-config) GIT = $(shell which git) TAR = $(shell which tar) MKDIR = $(shell which mkdir) TOUCH = $(shell which touch) CP = $(shell which cp) RM = $(shell which rm) LN = $(shell which ln) FIND = $(shell which find) INSTALL = $(shell which install) MKTEMP = $(shell which mktemp) STRIP = $(shell which strip) PANDOC = $(shell which pandoc) SED = $(shell which sed) GZIP = $(shell which gzip) RPMBUILD = $(shell which rpmbuild) GIT2DEBCL = ./tools/git2debcl CPPFIND = ./tools/cppfind ifeq ($(PKGCONFIG),"") $(error "pkg-config not installed") endif ifeq ($(PANDOC),"") $(warning "pandoc does not appear available: manpage won't be buildable") endif XATTR_AVAILABLE = $(shell test ! -e /usr/include/attr/xattr.h; echo $$?) FUSE_AVAILABLE = $(shell ! pkg-config --exists fuse; echo $$?) ifeq ($(FUSE_AVAILABLE),0) FUSE_AVAILABLE = $(shell test ! -e /usr/include/fuse.h; echo $$?) endif ifeq ($(FUSE_AVAILABLE),0) $(error "FUSE development package doesn't appear available") endif FLAG_NOPATH = $(shell $(CPPFIND) "flag_nopath") FLAG_UTIME = $(shell $(CPPFIND) "flag_utime_omit_ok") FALLOCATE = $(shell $(CPPFIND) "fuse_fs_fallocate") FLOCK = $(shell $(CPPFIND) "fuse_fs_flock") READ_BUF = $(shell $(CPPFIND) "fuse_fs_read_buf") WRITE_BUF = $(shell $(CPPFIND) "fuse_fs_write_buf") UGID_USE_RWLOCK = 0 OPTS = -O2 SRC = $(wildcard src/*.cpp) OBJ = $(SRC:src/%.cpp=obj/%.o) DEPS = $(OBJ:obj/%.o=obj/%.d) TARGET = mergerfs MANPAGE = $(TARGET).1 FUSE_CFLAGS = $(shell $(PKGCONFIG) --cflags fuse) CFLAGS = -g -Wall \ $(OPTS) \ -Wno-unused-result \ $(FUSE_CFLAGS) \ -DFUSE_USE_VERSION=29 \ -MMD \ -DFLAG_NOPATH=$(FLAG_NOPATH) \ -DFLAG_UTIME=$(FLAG_UTIME) \ -DFALLOCATE=$(FALLOCATE) \ -DFLOCK=$(FLOCK) \ -DREAD_BUF=$(READ_BUF) \ -DWRITE_BUF=$(WRITE_BUF) \ -DUGID_USE_RWLOCK=$(UGID_USE_RWLOCK) LDFLAGS = $(shell $(PKGCONFIG) fuse --libs) PREFIX = /usr/local EXEC_PREFIX = $(PREFIX) DATAROOTDIR = $(PREFIX)/share DATADIR = $(DATAROOTDIR) BINDIR = $(EXEC_PREFIX)/bin SBINDIR = $(EXEC_PREFIX)/sbin MANDIR = $(DATAROOTDIR)/man MAN1DIR = $(MANDIR)/man1 INSTALLBINDIR = $(DESTDIR)$(BINDIR) INSTALLSBINDIR = $(DESTDIR)$(SBINDIR) INSTALLMAN1DIR = $(DESTDIR)$(MAN1DIR) ifeq ($(XATTR_AVAILABLE),0) $(warning "xattr not available: disabling") CFLAGS += -DWITHOUT_XATTR endif all: $(TARGET) help: @echo "usage: make" @echo "make XATTR_AVAILABLE=0 - to build program without xattrs functionality (auto discovered otherwise)" $(TARGET): src/version.hpp obj/obj-stamp $(OBJ) $(CXX) $(CFLAGS) $(OBJ) -o $@ $(LDFLAGS) mount.mergerfs: $(TARGET) $(LN) -fs "$<" "$@" changelog: $(GIT2DEBCL) --name $(TARGET) > ChangeLog authors: $(GIT) log --format='%aN <%aE>' | sort -f | uniq > AUTHORS src/version.hpp: $(eval VERSION := $(shell $(GIT) describe --always --tags --dirty)) @echo "#ifndef _VERSION_HPP" > src/version.hpp @echo "#define _VERSION_HPP" >> src/version.hpp @echo "static const char MERGERFS_VERSION[] = \"$(VERSION)\";" >> src/version.hpp @echo "#endif" >> src/version.hpp obj/obj-stamp: $(MKDIR) -p obj $(TOUCH) $@ obj/%.o: src/%.cpp $(CXX) $(CFLAGS) -c $< -o $@ clean: rpm-clean ifneq ($(GIT),) ifeq ($(shell test -e .git; echo $$?),0) $(RM) -f src/version.hpp endif endif $(RM) -rf obj $(RM) -f "$(TARGET)" mount.mergerfs $(FIND) . -name "*~" -delete distclean: clean $(GIT) clean -fd install: install-base install-mount.mergerfs install-man install-base: $(TARGET) $(MKDIR) -p "$(INSTALLBINDIR)" $(INSTALL) -v -m 0755 "$(TARGET)" "$(INSTALLBINDIR)/$(TARGET)" install-mount.mergerfs: mount.mergerfs $(MKDIR) -p "$(INSTALLBINDIR)" $(CP) -a "$<" "$(INSTALLBINDIR)/$<" install-man: $(MANPAGE) $(MKDIR) -p "$(INSTALLMAN1DIR)" $(INSTALL) -v -m 0644 "man/$(MANPAGE)" "$(INSTALLMAN1DIR)/$(MANPAGE)" install-strip: install-base $(STRIP) "$(INSTALLBINDIR)/$(TARGET)" uninstall: uninstall-base uninstall-mount.mergerfs uninstall-man uninstall-base: $(RM) -f "$(INSTALLBINDIR)/$(TARGET)" uninstall-mount.mergerfs: $(RM) -f "$(INSTALLBINDIR)/mount.mergerfs" uninstall-man: $(RM) -f "$(INSTALLMAN1DIR)/$(MANPAGE)" $(MANPAGE): README.md ifneq (,$(PANDOC)) $(PANDOC) -s -t man -o "man/$(MANPAGE)" README.md endif man: $(MANPAGE) tarball: clean man changelog authors src/version.hpp $(eval VERSION := $(shell $(GIT) describe --always --tags --dirty)) $(eval VERSION := $(subst -,_,$(VERSION))) $(eval FILENAME := $(TARGET)-$(VERSION)) $(eval TMPDIR := $(shell $(MKTEMP) --tmpdir -d .$(FILENAME).XXXXXXXX)) $(MKDIR) $(TMPDIR)/$(FILENAME) $(CP) -ar . $(TMPDIR)/$(FILENAME) $(TAR) --exclude=.git -cz -C $(TMPDIR) -f $(FILENAME).tar.gz $(FILENAME) $(RM) -rf $(TMPDIR) debian-changelog: $(GIT2DEBCL) --name $(TARGET) > debian/changelog signed-deb: debian-changelog dpkg-buildpackage deb: debian-changelog dpkg-buildpackage -uc -us rpm-clean: $(RM) -rf rpmbuild rpm: tarball $(eval VERSION := $(shell $(GIT) describe --always --tags --dirty)) $(eval VERSION := $(subst -,_,$(VERSION))) $(MKDIR) -p rpmbuild/BUILD rpmbuild/RPMS rpmbuild/SOURCES $(SED) 's/__VERSION__/$(VERSION)/g' $(TARGET).spec > \ rpmbuild/SOURCES/$(TARGET).spec cp -ar $(TARGET)-$(VERSION).tar.gz rpmbuild/SOURCES $(RPMBUILD) -ba rpmbuild/SOURCES/$(TARGET).spec \ --define "_topdir $(CURDIR)/rpmbuild" .PHONY: all clean install help include $(wildcard obj/*.d) mergerfs-2.21.0/.gitignore0000664000175000017500000000036412640604015014011 0ustar bilebile# Compiled Object files *.slo *.lo *.o # Compiled Dynamic libraries *.so *.dylib # Compiled Static libraries *.lai *.la *.a # build artifacts mergerfs obj/ src/version.hpp # Debian files debian/files debian/changelog # RPM files rpmbuild/ mergerfs-2.21.0/mergerfs.spec0000664000175000017500000000232313003720476014510 0ustar bilebileName: mergerfs Version: __VERSION__ Release: 1%{?dist} Summary: A FUSE union filesystem Group: Applications/System License: ISC URL: https://github.com/trapexit/mergerfs Source: mergerfs-%{version}.tar.gz BuildRequires: gcc-c++ BuildRequires: libattr-devel BuildRequires: fuse-devel # rpmbuild driven by the Makefile uses git to generate a version number BuildRequires: git Requires: fuse %prep %setup -q %description mergerfs is similar to mhddfs, unionfs, and aufs. Like mhddfs in that it too uses FUSE. Like aufs in that it provides multiple policies for how to handle behavior. %build make %{?_smp_mflags} %install make install PREFIX=%{_prefix} DESTDIR=%{buildroot} %files %{_bindir}/* %doc %{_mandir}/* %changelog * Mon Jan 25 2016 Antonio SJ Musumeci - Remove sbin files * Sat Sep 05 2015 Antonio SJ Musumeci - Include PREFIX to install * Mon Dec 29 2014 Joe Lawrence - Tweak rpmbuild to archive current git HEAD into a tarball, then (re)build in the rpmbuild directory -- more complicated but seemingly better suited to generate source and debug rpms. * Fri Jun 20 2014 Joe Lawrence - Initial rpm spec file. mergerfs-2.21.0/AUTHORS0000664000175000017500000000027513103514237013073 0ustar bilebileAntonio SJ Musumeci Antonio SJ Musumeci Colin Yates Jens Dieskau Waldir Pimenta mergerfs-2.21.0/ChangeLog0000664000175000017500000005324313103514237013600 0ustar bilebilemergerfs (2.21.0~ubuntu-xenial) xenial; urgency=medium * 6a7675f symlinkify: file -> symlink-to-original-file after timeout * 8ba3a08 make dropcacheonclose runtime configurable * ccaa458 better handle incomplete reads/writes in copying files * 162b99e enable nopath and nullpath_ok * f15437c tweak movefile behavior * 5f3aa6e add more travis build targets * 2fbeb67 hide fs::fadvise as it's not used directly * 8b976ab support older libfuse without utime_omit_ok flag * 1a1fa06 fadvise cleanup * 617195d enable utime_omit_ok flag * be3eb7e work around getgrouplist signature difference on osx * 0600734 handle 32bit and 64bit inode recalculation * 9d0798d restructure fadvise * e2acffe restructure fallocate abstraction * 42d454a abstract futimesat * 0b2bf17 abstract access to highres atime/mtime * e20d566 use correct integer types * 1539aca use compiler's preprocessor rather than cpp explicitly * 9d799ff setup travis-ci * c043ef9 make fs::attr return ENOTSUP on EINVAL #381 * 215f129 explicitly define path preservation, better explain move issues * bb4ec91 fix incorrect section header syntax -- Antonio SJ Musumeci Fri, 5 May 2017 00:47:24 -0400 mergerfs (2.20.0~ubuntu-xenial) xenial; urgency=medium * cf2cb54 add info on inodes running out to faq on filled drives * 94ebccc try to clarify how path preserving policies work and other tweaks to docs * 4e7e74d update docs to include dropcacheonclose and warn about directory mtime * 6aa62d0 add option to drop file caches before closing files * 492d895 check metadata on chown/chmod errors when cloning -- Antonio SJ Musumeci Mon, 13 Mar 2017 13:43:22 -0400 mergerfs (2.19.0~ubuntu-xenial) xenial; urgency=medium * 9cc9bb9 misc document updates * 16e7c72 update documentation, focus on explaining double caching & direct_io * a60d815 add ifndefs to all headers * e93c946 limit need to explicitly call .c_str() * 7b4e1ea remove clone command * 726b88e restructure error calculation * d67d5de check for system.posix_acl_default before setting umask * 1aa76a5 use different read and write functions when using direct_io -- Antonio SJ Musumeci Tue, 31 Jan 2017 19:24:48 -0500 mergerfs (2.18.0~ubuntu-xenial) xenial; urgency=medium * 67b48fc compute inode in readdir * b1459c6 only remove src/version.hpp if git repo and git available * c8fa51c support setting of inodes (using use_ino option) * 822204f replace std::set with klib's khash to increase readdir performance * 5f7a168 note that mergerfs should be run as root * 35075bb return clonepath errors -- Antonio SJ Musumeci Fri, 16 Dec 2016 11:16:59 -0500 mergerfs (2.17.0~ubuntu-xenial) xenial; urgency=medium * 05d81db update manpage * 3c5351a ignore filesystems which return zeros for statfs. closes #335 * 3d2283f clang cpp doesn't like grep exiting early * 192bb9c remove usage of -D from install * 157dae0 define O_LARGEFILE and O_NOATIME if needed * 00c814d consolidate and simplify utime * 6d6fb45 check if fdatasync is available and return ENOSYS if not * 897f20b minor correction of spelling mistake * d0b6cd1 further abstraction of system calls * 1dc7bff wrap most posix filesystem functions * 8f594e1 add flock * cd90193 add some more explination to the FAQ * cd71af8 add mergerfs.ctl and scorch to tooling section * 3fb7f89 add EDQUOT to errors which trigger moveonenospc -- Antonio SJ Musumeci Tue, 15 Nov 2016 23:35:06 -0500 mergerfs (2.16.1~ubuntu-xenial) xenial; urgency=medium * dfa8269 update manpage * d9a7906 use SYS_setgroup32 syscall if available. closes #319 * b1f2e94 add information about page cache kernel panic bug -- Antonio SJ Musumeci Mon, 19 Sep 2016 17:07:42 -0400 mergerfs (2.16.0~ubuntu-xenial) xenial; urgency=medium * a8cd9b7 recreate manpage * 7e423cd small tweaks to build on Debian kFreeBSD * 0395e7c fix futimes version of utimes wrapper * 9392317 fix #define typo * 1513c92 abstract posix_fadvise * 158dda9 Fix minor typo * 1a698e5 rename include cpp files to have icpp extension * 2ee6b4f include sys/types.h to pick up ssize_t * 709dda5 support systems without ENODATA -- Antonio SJ Musumeci Wed, 14 Sep 2016 08:50:51 -0400 mergerfs (2.15.0~ubuntu-xenial) xenial; urgency=medium * 49474f0 make futimes crossplatform * 34d38cb split sendfile wrapper into separate files * 192a9d5 make fs_attr compile on unsupported platforms * 40574bd use dynamic buffer for realpath * 064fd55 bump FUSE_USE_VERSION to 29 * 45f757d add osx version of fallocate * 0fceb8e add epall and eprand policies * 7634eb1 replace nonstandard eaccess with POSIX.1-2008 faccessat * 47f184a fix typo and clarify feature -- Antonio SJ Musumeci Sun, 7 Aug 2016 14:46:43 -0400 mergerfs (2.14.0~ubuntu-xenial) xenial; urgency=medium * a93ab6c add existing path first found policy. closes #289 * 43cbd9c move size calculations to use uint64_t. fixes #287 * 9f36ead add license title * 30cdfa6 reiterate path preserving policies -- Antonio SJ Musumeci Mon, 11 Jul 2016 20:50:32 -0400 mergerfs (2.13.1~ubuntu-xenial) xenial; urgency=medium * 3cb2045 update man page * 6dc6fde update info on mmap bug and when it was fixed * cb35a37 rework fallocate logic * 23b8e45 fix ioctl on directories -- Antonio SJ Musumeci Thu, 19 May 2016 17:30:07 -0400 mergerfs (2.13.0~ubuntu-xenial) xenial; urgency=medium * 3a50344 update man page * be6341e create eplus (existing path, least used space) policy. closes #273 * f7d3e8b create lus (least used space) policy. closes #273 * 74ed1b0 faq update on direct writes * d0414d7 clean up information regarding fstab * ef8d8f3 add fsname to readme * cd15b7a further tweak language regarding policies wrt create category * 8643d35 make policy descriptions more explicit * 1cfe1c3 tweak doc language * dbb13ef add details of mmap cache bug * 90ca14a add dual mount suggestion to mmap problem * cfaf812 add details regarding rtorrent, mmap, and direct_io * 0c6c69e update readme to include mergerfs.dedup * 309cfee change tar.gz build url -- Antonio SJ Musumeci Sat, 7 May 2016 15:19:34 -0400 mergerfs (2.12.3~ubuntu-xenial) xenial; urgency=medium * 382ca87 tweak man page creation * 070ed08 properly check errors of xattr. closes #255 -- Antonio SJ Musumeci Thu, 10 Mar 2016 18:43:12 -0500 mergerfs (2.12.2~ubuntu-xenial) xenial; urgency=medium * 6492fda update precompiled man page * 2061211 fix rename failing on non-path preserving policies * 4928944 clarify that rename uses the create policy to make decisions -- Antonio SJ Musumeci Sun, 6 Mar 2016 02:23:47 -0500 mergerfs (2.12.1~ubuntu-xenial) xenial; urgency=medium * 12cf57d re-add minfreespace check to epmfs policy * 59b08a5 change tooling names and add guide link -- Antonio SJ Musumeci Fri, 4 Mar 2016 13:56:15 -0500 mergerfs (2.12.0~ubuntu-xenial) xenial; urgency=medium * f4a4cc5 fix building of platform specific deb packages * ef4c583 fix printing of versions with no changes * 4ecf3c5 clearly separate usage of statvfs from stat for file existance * 779143f add minfreespace checks to policy ff's create and remove fwfs * 4d7148c update readme with minfreespace and readonly details * 14886a2 add readonly and minfreespace filters to all policy for creates. closes #236 * 9819cf6 fix clonepath being called on wrong source * c56b488 fix creation of changelog * e593927 normalize error handling in rename policy * 7c85cd9 ff policy tweaks * 5cf3bb7 override standard libfuse version flag * 25a0399 minor tweaks to filesystem utility functions * 792c9b9 use stat/2 rather than statvfs/2 to find file drive -- Antonio SJ Musumeci Tue, 1 Mar 2016 00:19:59 -0500 mergerfs (2.11.0~ubuntu-xenial) xenial; urgency=medium * a698a8a update / tweak readme * d4ec341 remove unnecessary policies * 5813d1e ignore drives mounted as readonly from create policies. closes #224 * a4e60d7 add eplfs info to readme -- Antonio SJ Musumeci Sun, 21 Feb 2016 18:31:02 -0500 mergerfs (2.10.0~ubuntu-xenial) xenial; urgency=medium * f3e75a0 use stat.st_dev to uniquely identify mounts for statfs. closes #213 * b3248a8 simplify policies * 7bf1ca4 add existing path, least free space policy. closes #216 * 6086620 use references to srcmounts rather than copies * 3a51ceb add some "why mergerfs instead of X" sections to the FAQ * 681f3d7 add section to readme about trash directories * 0bac344 add information on fixing libfuse crashes * 840f9b8 remove sbin from rpm spec file -- Antonio SJ Musumeci Mon, 15 Feb 2016 22:57:35 -0500 mergerfs (2.9.1~ubuntu-xenial) xenial; urgency=medium * f779f82 fix statvfs drive dedup. closes #209 -- Antonio SJ Musumeci Fri, 22 Jan 2016 10:16:01 -0500 mergerfs (2.9.0~ubuntu-xenial) xenial; urgency=medium * 3e20adb remove clone test tool * e285bde update the precompiled man page * 853769b general tweaks to readme * ea32575 make symlink function like mknod/mkdir. closes #204 * 1d1694b fix indexing of mknod targets. closes #202 * 93397ea remove incorrect warning about race condition with mkdir/mknod * 25265f4 dedup based on full statvfs struct rather than fsid. closes #183 * de776b7 remove tooling from repo. closes #198 * 62f8fc5 have link act similar to rename * 242af77 move from MIT to ISC license. closes #194 * 4c77ac4 all action functions return success should at least one succeed. closes #189 * b811522 update man page * 8a5c524 replace srcpoints with srcmounts * a3e6a03 rework rename algo to minimize likelihood of EXDEV being returned. closes #187 * eb6d1a1 change to using template for policy class * 55c4a32 add artifacts to gitignore * 51ae7d1 change make to work with non-bash shells * c731b70 fix building without xattr * 9e24796 add mergerfs pid to xattrs -- Antonio SJ Musumeci Thu, 21 Jan 2016 14:55:15 -0500 mergerfs (2.8.0~ubuntu-xenial) xenial; urgency=medium * 5e880bd use SYS_setgroups rather than setgroups * 8a651b0 add support section to readme and manpage * 93cedab fix misc issues flagged by clang scan-build * fd4ce1b include distro and codename in deb package versions -- Antonio SJ Musumeci Thu, 29 Oct 2015 23:38:45 -0400 mergerfs (2.7.0~ubuntu-xenial) xenial; urgency=medium * f3a6876 remove pandoc from build requirements * 30c29c9 remove manpage from root directory * 8ed11a0 if pandoc doesn't exist copy premade version * 46c8361 offer prebuilt manpage for platforms without easy access to pandoc * 02df441 update info on Samba client EXDEV issue * fe79609 fix typo * 873c4a9 add link to gvfs-fuse patch * 4df9b2e add documentation on SMB client EXDEV / EIO issue * 1c7de2d fix minor integer casting issues * a10de2a update build dependencies for Fedora * 3d7d2cf add sbin directory to rpm spec * 5489952 enhance git2debcl to work with older python releases * 068fbc0 set rpm dependency to fuse * 5a76c41 create mount.mergerfs symlink. closes #149 * 58446f9 misc fixes to compile on older platforms * 40f569b rewrite gid cache system * f6d396c audit (and fix) file permissions and ownership. closes #148 * 53e3284 remove usage of UINT32_MAX macro * 09ffc8c provide usage text and version info. closes #146 -- Antonio SJ Musumeci Sun, 18 Oct 2015 00:15:28 -0400 mergerfs (2.6.0~ubuntu-xenial) xenial; urgency=medium * c289daf swap deb and unsigned-deb make tagets. closes #140 * 5808ab7 move on enospc when writing feature. closes #141 * 4e5578d make note about escaping glob tokens more explicit * 4b375fa include rpm-build in Fedora dependencies * 9542e63 include link to release page in readme * de583b7 clean up options listing * 8bf0f75 create summary feature section -- Antonio SJ Musumeci Sat, 26 Sep 2015 14:14:04 -0400 mergerfs (2.5.0~ubuntu-xenial) xenial; urgency=medium * 5850fbe bump README date * a960a7e cleanup controlfile manipulation * e0cf972 include default_permissions in default arguments * f4e3f28 change README regarding setgroups cache and new rwlock ugid fallback * 08c0c2d fix typo in README. closes #134 * 3163258 make changing credentials opportunistic + per thread setgroups cache * b194272 add notes on permissions and errors to readme * c131310 include known issues section to readme -- Antonio SJ Musumeci Mon, 14 Sep 2015 22:45:45 -0400 mergerfs (2.4.0~ubuntu-xenial) xenial; urgency=medium * ce93529 realpath'ize all source mount points. closes #117 * 2d89947 fix non-suffixed setxattr of user.mergerfs.minfreespace * e98b801 remove version.hpp on clean * b22528b add user.mergerfs.version xattr * e377d54 add user.mergerfs.policies xattr * 08d07b7 add building of rpm * 305f190 add basic instructions for building on Fedora * 8178bf5 refactor and simplify getxattr for user.mergerfs.\* -- Antonio SJ Musumeci Sun, 6 Sep 2015 18:25:21 -0400 mergerfs (2.3.0~ubuntu-xenial) xenial; urgency=medium * aea5e44 use correct variable for finding version * bc77b0f add minfreespace check to epmfs create policy * 1f1e481 rework rename * 7a93198 forgot to add einval to policy * bbc75f6 create errno policies for simulating errors. closes #107 * 126df0f fix epmfs failing to pick the existing path. closes #102 * ab68ac0 enhance deb building * e73ea33 format README better for man pages -- Antonio SJ Musumeci Wed, 2 Sep 2015 08:02:26 -0400 mergerfs (2.2.0~ubuntu-xenial) xenial; urgency=medium * 9519251 update README regarding options * 8767db9 remove unused variable * 267f2d2 move requesting of FUSE flags to init from cli args * f130d07 config get and struct naming cleanup * 52d8029 passthrough ioctl args without processing. closes #90 * c60d038 use gte rather than gt for mtime comparisons. fixes #91 -- Antonio SJ Musumeci Wed, 5 Aug 2015 12:30:14 -0400 mergerfs (2.1.2~ubuntu-xenial) xenial; urgency=medium * 80b2c35 add creation of full path for open * 983fa91 change fuse functions to use the fuse namespace * e5359eb remove unused readdir function * f00cd14 use pthread_getugid_np instead of gete{u,g}id on OSX. fixes #84 -- Antonio SJ Musumeci Thu, 16 Jul 2015 16:58:14 -0400 mergerfs (2.1.1~ubuntu-xenial) xenial; urgency=medium * 4d60538 ignore ENOTSUP errors when cloning paths. fixes #82 -- Antonio SJ Musumeci Mon, 13 Jul 2015 12:21:48 -0400 mergerfs (2.1.0~ubuntu-xenial) xenial; urgency=medium * aafc1e9 add str to size_t conversion code * b3109ac add minfreespace to xattr interface * d079856 add info on lfs and fwfs policies and minfreespace option * c101430 rework category -> fuse function table * b2cd791 stop auto calculating and storing fullpath in policies * 0c60701 create different policies based on category of use * 51b6d3f add category to policies so as to distinguish between creates and searches * 6ca4389 separate policies into individual modules * 3c8f122 move policy function type from fs to policy * 2bd4456 move Path object to separate file * 8e5b796 create lfs policy. closes #73 * 58167c3 first w/ free space policy. closes #72 * ccb22c1 create minfreespace option. closes #71 -- Antonio SJ Musumeci Sun, 5 Jul 2015 21:03:34 -0400 mergerfs (2.0.1~ubuntu-xenial) xenial; urgency=medium * ad7ce48 fix readme typos and misc formatting * fe0f442 add Tips and FAQ section to readme * 1879c9c update readme with defaults option info * 45b73e5 fix calling of lgetxattr. closes #68 -- Antonio SJ Musumeci Fri, 5 Jun 2015 20:13:24 -0400 mergerfs (2.0.0~ubuntu-xenial) xenial; urgency=medium * 5fb2775 attempt to set priority to -10 on startup. closes #65 * 4b204b8 restrict who can setxattr the pseudo file. closes #64 * 33c837a provide 'defaults' option. closes #58 * 951b22b set FUSE subtype to 'mergerfs'. closes #59 * 74c334c add default policies for categories and description of `all` * 08366a3 match cli options to xattrs * 91671d7 remove FileInfo and keep only file descriptor * c022741 revert removal of 'all' policy and relevant behavior. closes #54 * 12f393a per FUSE function policies. closes #52, #53 -- Antonio SJ Musumeci Tue, 17 Mar 2015 20:40:35 -0400 mergerfs (1.7.1~ubuntu-xenial) xenial; urgency=medium * 283a2b2 Try RLIMIT_INFINITY first, then cur = max, then loop and try to increase till error. closes #50 * 1a1c9db close file after getting ioc flags. closes #48 -- Antonio SJ Musumeci Tue, 17 Feb 2015 11:48:55 -0500 mergerfs (1.7.0~ubuntu-xenial) xenial; urgency=medium * d30cae2 add user.mergerfs.allpaths and user.mergerfs.relpath to getxattr * 2e95c6e merge action and search category * b411c63 Remove 'all' policy and simplify logic * 1f90203 use standard platform macros. closes #43 * c2cbb93 elevate privileges when calling clonepath. closes #41 * 6276ce9 handle EEXIST while cloning a path. closes #40 * d1f3bd8 add clonepath tool * 031b87f slight refactoring * 5dd0729 remove longest common prefix from fsname. closes #38 -- Antonio SJ Musumeci Sat, 7 Feb 2015 18:49:36 -0500 mergerfs (1.6.0~ubuntu-xenial) xenial; urgency=medium * 6c3ff01 pass const strings by reference. closes #33 * d7ede20 provide stat to readdir filler. closes #32 * 613b996 support RHEL6. closes #29 -- Antonio SJ Musumeci Mon, 10 Nov 2014 21:11:17 -0500 mergerfs (1.5.1~ubuntu-xenial) xenial; urgency=medium * 47522a2 exclude merges in the debian changelog. closes #28 -- Antonio SJ Musumeci Mon, 29 Sep 2014 19:30:12 -0400 mergerfs (1.5.0~ubuntu-xenial) xenial; urgency=medium * 075d62d add support for ioctl on directories. closes #27 -- Antonio SJ Musumeci Fri, 26 Sep 2014 18:33:51 -0400 mergerfs (1.4.1~ubuntu-xenial) xenial; urgency=medium * cfe7609 find functions now return errors. closes #24 * 8f35406 use lstat to confirm file existance instead of eaccess. closes #25 * 4ea1adb use f_frsize rather than f_bsize for mfs calculations. closes #26 * 15f8849 add custom git log to debian changelog script -- Antonio SJ Musumeci Sat, 23 Aug 2014 11:44:40 -0400 mergerfs (1.4.0~ubuntu-xenial) xenial; urgency=medium * 7e9ccd0 support runtime setting of srcmounts. closes #12 -- Antonio SJ Musumeci Fri, 8 Aug 2014 10:20:27 -0400 mergerfs (1.3.0~ubuntu-xenial) xenial; urgency=medium * 992e05e update docs for xattr features * b82db46 getxattr for user.mergerfs.{base,full}path returns the source paths. closes #23 * 7b0d703 only allow manipulation of runtime settings via xattrs. closes #22 -- Antonio SJ Musumeci Thu, 31 Jul 2014 17:27:43 -0400 mergerfs (1.2.4~ubuntu-xenial) xenial; urgency=medium * 45cec2d use int instead of long for ioctl. fixes #21 -- Antonio SJ Musumeci Tue, 22 Jul 2014 07:07:25 -0400 mergerfs (1.2.3~ubuntu-xenial) xenial; urgency=medium * 2295714 on ENOENT try cloning the dest path to source drive. closes #20 -- Antonio SJ Musumeci Mon, 7 Jul 2014 21:54:38 -0400 mergerfs (1.2.2~ubuntu-xenial) xenial; urgency=medium * ccb0ac1 generate the controlfile data on the fly. closes #19 * 15a0416 don't flush if it's the .mergerfs pseudo file. closes #18 * ec38a9c fix rename'ing to local device -- Antonio SJ Musumeci Wed, 25 Jun 2014 15:17:26 -0400 mergerfs (1.2.1~ubuntu-xenial) xenial; urgency=medium * 3b6c748 use geteuid syscall as well -- Antonio SJ Musumeci Mon, 23 Jun 2014 12:17:09 -0400 mergerfs (1.2.0~ubuntu-xenial) xenial; urgency=medium * f385f02 add -O2 to CFLAGS * 0e12d79 platform specific code to deal with sete{u,g}id. closes #17 * 7164535 add flush callback. closes #16 * dd66607 add {read,write}_buf functions. closes #15 * 0f8fe47 add man file via markdown -> man conversion with pandoc. closes #14 * 45a2e09 reverse source and destination mount points to match fstab requirements. closes #13 * 645c823 source mount paths can contain globing. closes #10 * 1835826 fsname set to list of src mounts. closes #9 * 4a0bc4a add debian package building. closes #11 * e2e0359 fix free space calculations. closes #8 * 655436f further Makefile enhancements -- Antonio SJ Musumeci Wed, 18 Jun 2014 10:40:54 -0400 mergerfs (1.1.0~ubuntu-xenial) xenial; urgency=medium * a7d9a9b enhance Makefile * 36887e4 when readdir's filler returns non-zero return ENOMEM. closes #7 * 652a299 add fgetattr. closes #5 * aab90b0 rework policy code * 345d0bb use eaccess to determine permissions for ffwp. closes #2 * 4c7095c remove stat'ing of files in readdir. closes #3 -- Antonio SJ Musumeci Wed, 28 May 2014 21:39:07 -0400 mergerfs (1.0.2~ubuntu-xenial) xenial; urgency=medium * bbc4b59 fs::make_path should check for forward slashes, add if missing * 16fe0cf remove statfs policy * 29ed2bc add FS_IOC_{GET}VERSION to ioctl * 243a193 use long instead of int to limit possibility of overflow in switch, closes #1 * 97ce6f5 use {get,list,set}xattr to modify runtime * 428dd8c update build instructions in readme -- Antonio SJ Musumeci Tue, 27 May 2014 07:17:32 -0400 mergerfs (1.0.1~ubuntu-xenial) xenial; urgency=medium * 7f640c4 fix building without libattr -- Antonio SJ Musumeci Mon, 19 May 2014 09:34:31 -0400 mergerfs-2.21.0/debian/0000775000175000017500000000000013070735776013261 5ustar bilebilemergerfs-2.21.0/debian/control0000664000175000017500000000105512560567537014666 0ustar bilebileSource: mergerfs Section: utils Priority: optional Maintainer: Antonio SJ Musumeci Build-Depends: debhelper (>= 8.0.0), libfuse-dev, libattr1-dev, pkg-config Standards-Version: 3.9.4 Homepage: http://github.com/trapexit/mergerfs Package: mergerfs Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, libfuse2 Description: another FUSE union filesystem mergerfs is similar to mhddfs, unionfs, and aufs. Like mhddfs in that it too uses FUSE. Like aufs in that it provides multiple policies for how to handle behavior. mergerfs-2.21.0/debian/changelog0000664000175000017500000005144213070672125015125 0ustar bilebilemergerfs (2.20.0-5-gc043ef9~ubuntu-xenial) xenial; urgency=medium * c043ef9 make fs::attr return ENOTSUP on EINVAL #381 * 215f129 explicitly define path preservation, better explain move issues * bb4ec91 fix incorrect section header syntax -- Antonio SJ Musumeci Mon, 3 Apr 2017 21:11:20 -0400 mergerfs (2.20.0~ubuntu-xenial) xenial; urgency=medium * cf2cb54 add info on inodes running out to faq on filled drives * 94ebccc try to clarify how path preserving policies work and other tweaks to docs * 4e7e74d update docs to include dropcacheonclose and warn about directory mtime * 6aa62d0 add option to drop file caches before closing files * 492d895 check metadata on chown/chmod errors when cloning -- Antonio SJ Musumeci Mon, 13 Mar 2017 13:43:22 -0400 mergerfs (2.19.0~ubuntu-xenial) xenial; urgency=medium * 9cc9bb9 misc document updates * 16e7c72 update documentation, focus on explaining double caching & direct_io * a60d815 add ifndefs to all headers * e93c946 limit need to explicitly call .c_str() * 7b4e1ea remove clone command * 726b88e restructure error calculation * d67d5de check for system.posix_acl_default before setting umask * 1aa76a5 use different read and write functions when using direct_io -- Antonio SJ Musumeci Tue, 31 Jan 2017 19:24:48 -0500 mergerfs (2.18.0~ubuntu-xenial) xenial; urgency=medium * 67b48fc compute inode in readdir * b1459c6 only remove src/version.hpp if git repo and git available * c8fa51c support setting of inodes (using use_ino option) * 822204f replace std::set with klib's khash to increase readdir performance * 5f7a168 note that mergerfs should be run as root * 35075bb return clonepath errors -- Antonio SJ Musumeci Fri, 16 Dec 2016 11:16:59 -0500 mergerfs (2.17.0~ubuntu-xenial) xenial; urgency=medium * 05d81db update manpage * 3c5351a ignore filesystems which return zeros for statfs. closes #335 * 3d2283f clang cpp doesn't like grep exiting early * 192bb9c remove usage of -D from install * 157dae0 define O_LARGEFILE and O_NOATIME if needed * 00c814d consolidate and simplify utime * 6d6fb45 check if fdatasync is available and return ENOSYS if not * 897f20b minor correction of spelling mistake * d0b6cd1 further abstraction of system calls * 1dc7bff wrap most posix filesystem functions * 8f594e1 add flock * cd90193 add some more explination to the FAQ * cd71af8 add mergerfs.ctl and scorch to tooling section * 3fb7f89 add EDQUOT to errors which trigger moveonenospc -- Antonio SJ Musumeci Tue, 15 Nov 2016 23:35:06 -0500 mergerfs (2.16.1~ubuntu-xenial) xenial; urgency=medium * dfa8269 update manpage * d9a7906 use SYS_setgroup32 syscall if available. closes #319 * b1f2e94 add information about page cache kernel panic bug -- Antonio SJ Musumeci Mon, 19 Sep 2016 17:07:42 -0400 mergerfs (2.16.0~ubuntu-xenial) xenial; urgency=medium * a8cd9b7 recreate manpage * 7e423cd small tweaks to build on Debian kFreeBSD * 0395e7c fix futimes version of utimes wrapper * 9392317 fix #define typo * 1513c92 abstract posix_fadvise * 158dda9 Fix minor typo * 1a698e5 rename include cpp files to have icpp extension * 2ee6b4f include sys/types.h to pick up ssize_t * 709dda5 support systems without ENODATA -- Antonio SJ Musumeci Wed, 14 Sep 2016 08:50:51 -0400 mergerfs (2.15.0~ubuntu-xenial) xenial; urgency=medium * 49474f0 make futimes crossplatform * 34d38cb split sendfile wrapper into separate files * 192a9d5 make fs_attr compile on unsupported platforms * 40574bd use dynamic buffer for realpath * 064fd55 bump FUSE_USE_VERSION to 29 * 45f757d add osx version of fallocate * 0fceb8e add epall and eprand policies * 7634eb1 replace nonstandard eaccess with POSIX.1-2008 faccessat * 47f184a fix typo and clarify feature -- Antonio SJ Musumeci Sun, 7 Aug 2016 14:46:43 -0400 mergerfs (2.14.0~ubuntu-xenial) xenial; urgency=medium * a93ab6c add existing path first found policy. closes #289 * 43cbd9c move size calculations to use uint64_t. fixes #287 * 9f36ead add license title * 30cdfa6 reiterate path preserving policies -- Antonio SJ Musumeci Mon, 11 Jul 2016 20:50:32 -0400 mergerfs (2.13.1~ubuntu-xenial) xenial; urgency=medium * 3cb2045 update man page * 6dc6fde update info on mmap bug and when it was fixed * cb35a37 rework fallocate logic * 23b8e45 fix ioctl on directories -- Antonio SJ Musumeci Thu, 19 May 2016 17:30:07 -0400 mergerfs (2.13.0~ubuntu-xenial) xenial; urgency=medium * 3a50344 update man page * be6341e create eplus (existing path, least used space) policy. closes #273 * f7d3e8b create lus (least used space) policy. closes #273 * 74ed1b0 faq update on direct writes * d0414d7 clean up information regarding fstab * ef8d8f3 add fsname to readme * cd15b7a further tweak language regarding policies wrt create category * 8643d35 make policy descriptions more explicit * 1cfe1c3 tweak doc language * dbb13ef add details of mmap cache bug * 90ca14a add dual mount suggestion to mmap problem * cfaf812 add details regarding rtorrent, mmap, and direct_io * 0c6c69e update readme to include mergerfs.dedup * 309cfee change tar.gz build url -- Antonio SJ Musumeci Sat, 7 May 2016 15:19:34 -0400 mergerfs (2.12.3~ubuntu-xenial) xenial; urgency=medium * 382ca87 tweak man page creation * 070ed08 properly check errors of xattr. closes #255 -- Antonio SJ Musumeci Thu, 10 Mar 2016 18:43:12 -0500 mergerfs (2.12.2~ubuntu-xenial) xenial; urgency=medium * 6492fda update precompiled man page * 2061211 fix rename failing on non-path preserving policies * 4928944 clarify that rename uses the create policy to make decisions -- Antonio SJ Musumeci Sun, 6 Mar 2016 02:23:47 -0500 mergerfs (2.12.1~ubuntu-xenial) xenial; urgency=medium * 12cf57d re-add minfreespace check to epmfs policy * 59b08a5 change tooling names and add guide link -- Antonio SJ Musumeci Fri, 4 Mar 2016 13:56:15 -0500 mergerfs (2.12.0~ubuntu-xenial) xenial; urgency=medium * f4a4cc5 fix building of platform specific deb packages * ef4c583 fix printing of versions with no changes * 4ecf3c5 clearly separate usage of statvfs from stat for file existance * 779143f add minfreespace checks to policy ff's create and remove fwfs * 4d7148c update readme with minfreespace and readonly details * 14886a2 add readonly and minfreespace filters to all policy for creates. closes #236 * 9819cf6 fix clonepath being called on wrong source * c56b488 fix creation of changelog * e593927 normalize error handling in rename policy * 7c85cd9 ff policy tweaks * 5cf3bb7 override standard libfuse version flag * 25a0399 minor tweaks to filesystem utility functions * 792c9b9 use stat/2 rather than statvfs/2 to find file drive -- Antonio SJ Musumeci Tue, 1 Mar 2016 00:19:59 -0500 mergerfs (2.11.0~ubuntu-xenial) xenial; urgency=medium * a698a8a update / tweak readme * d4ec341 remove unnecessary policies * 5813d1e ignore drives mounted as readonly from create policies. closes #224 * a4e60d7 add eplfs info to readme -- Antonio SJ Musumeci Sun, 21 Feb 2016 18:31:02 -0500 mergerfs (2.10.0~ubuntu-xenial) xenial; urgency=medium * f3e75a0 use stat.st_dev to uniquely identify mounts for statfs. closes #213 * b3248a8 simplify policies * 7bf1ca4 add existing path, least free space policy. closes #216 * 6086620 use references to srcmounts rather than copies * 3a51ceb add some "why mergerfs instead of X" sections to the FAQ * 681f3d7 add section to readme about trash directories * 0bac344 add information on fixing libfuse crashes * 840f9b8 remove sbin from rpm spec file -- Antonio SJ Musumeci Mon, 15 Feb 2016 22:57:35 -0500 mergerfs (2.9.1~ubuntu-xenial) xenial; urgency=medium * f779f82 fix statvfs drive dedup. closes #209 -- Antonio SJ Musumeci Fri, 22 Jan 2016 10:16:01 -0500 mergerfs (2.9.0~ubuntu-xenial) xenial; urgency=medium * 3e20adb remove clone test tool * e285bde update the precompiled man page * 853769b general tweaks to readme * ea32575 make symlink function like mknod/mkdir. closes #204 * 1d1694b fix indexing of mknod targets. closes #202 * 93397ea remove incorrect warning about race condition with mkdir/mknod * 25265f4 dedup based on full statvfs struct rather than fsid. closes #183 * de776b7 remove tooling from repo. closes #198 * 62f8fc5 have link act similar to rename * 242af77 move from MIT to ISC license. closes #194 * 4c77ac4 all action functions return success should at least one succeed. closes #189 * b811522 update man page * 8a5c524 replace srcpoints with srcmounts * a3e6a03 rework rename algo to minimize likelihood of EXDEV being returned. closes #187 * eb6d1a1 change to using template for policy class * 55c4a32 add artifacts to gitignore * 51ae7d1 change make to work with non-bash shells * c731b70 fix building without xattr * 9e24796 add mergerfs pid to xattrs -- Antonio SJ Musumeci Thu, 21 Jan 2016 14:55:15 -0500 mergerfs (2.8.0~ubuntu-xenial) xenial; urgency=medium * 5e880bd use SYS_setgroups rather than setgroups * 8a651b0 add support section to readme and manpage * 93cedab fix misc issues flagged by clang scan-build * fd4ce1b include distro and codename in deb package versions -- Antonio SJ Musumeci Thu, 29 Oct 2015 23:38:45 -0400 mergerfs (2.7.0~ubuntu-xenial) xenial; urgency=medium * f3a6876 remove pandoc from build requirements * 30c29c9 remove manpage from root directory * 8ed11a0 if pandoc doesn't exist copy premade version * 46c8361 offer prebuilt manpage for platforms without easy access to pandoc * 02df441 update info on Samba client EXDEV issue * fe79609 fix typo * 873c4a9 add link to gvfs-fuse patch * 4df9b2e add documentation on SMB client EXDEV / EIO issue * 1c7de2d fix minor integer casting issues * a10de2a update build dependencies for Fedora * 3d7d2cf add sbin directory to rpm spec * 5489952 enhance git2debcl to work with older python releases * 068fbc0 set rpm dependency to fuse * 5a76c41 create mount.mergerfs symlink. closes #149 * 58446f9 misc fixes to compile on older platforms * 40f569b rewrite gid cache system * f6d396c audit (and fix) file permissions and ownership. closes #148 * 53e3284 remove usage of UINT32_MAX macro * 09ffc8c provide usage text and version info. closes #146 -- Antonio SJ Musumeci Sun, 18 Oct 2015 00:15:28 -0400 mergerfs (2.6.0~ubuntu-xenial) xenial; urgency=medium * c289daf swap deb and unsigned-deb make tagets. closes #140 * 5808ab7 move on enospc when writing feature. closes #141 * 4e5578d make note about escaping glob tokens more explicit * 4b375fa include rpm-build in Fedora dependencies * 9542e63 include link to release page in readme * de583b7 clean up options listing * 8bf0f75 create summary feature section -- Antonio SJ Musumeci Sat, 26 Sep 2015 14:14:04 -0400 mergerfs (2.5.0~ubuntu-xenial) xenial; urgency=medium * 5850fbe bump README date * a960a7e cleanup controlfile manipulation * e0cf972 include default_permissions in default arguments * f4e3f28 change README regarding setgroups cache and new rwlock ugid fallback * 08c0c2d fix typo in README. closes #134 * 3163258 make changing credentials opportunistic + per thread setgroups cache * b194272 add notes on permissions and errors to readme * c131310 include known issues section to readme -- Antonio SJ Musumeci Mon, 14 Sep 2015 22:45:45 -0400 mergerfs (2.4.0~ubuntu-xenial) xenial; urgency=medium * ce93529 realpath'ize all source mount points. closes #117 * 2d89947 fix non-suffixed setxattr of user.mergerfs.minfreespace * e98b801 remove version.hpp on clean * b22528b add user.mergerfs.version xattr * e377d54 add user.mergerfs.policies xattr * 08d07b7 add building of rpm * 305f190 add basic instructions for building on Fedora * 8178bf5 refactor and simplify getxattr for user.mergerfs.\* -- Antonio SJ Musumeci Sun, 6 Sep 2015 18:25:21 -0400 mergerfs (2.3.0~ubuntu-xenial) xenial; urgency=medium * aea5e44 use correct variable for finding version * bc77b0f add minfreespace check to epmfs create policy * 1f1e481 rework rename * 7a93198 forgot to add einval to policy * bbc75f6 create errno policies for simulating errors. closes #107 * 126df0f fix epmfs failing to pick the existing path. closes #102 * ab68ac0 enhance deb building * e73ea33 format README better for man pages -- Antonio SJ Musumeci Wed, 2 Sep 2015 08:02:26 -0400 mergerfs (2.2.0~ubuntu-xenial) xenial; urgency=medium * 9519251 update README regarding options * 8767db9 remove unused variable * 267f2d2 move requesting of FUSE flags to init from cli args * f130d07 config get and struct naming cleanup * 52d8029 passthrough ioctl args without processing. closes #90 * c60d038 use gte rather than gt for mtime comparisons. fixes #91 -- Antonio SJ Musumeci Wed, 5 Aug 2015 12:30:14 -0400 mergerfs (2.1.2~ubuntu-xenial) xenial; urgency=medium * 80b2c35 add creation of full path for open * 983fa91 change fuse functions to use the fuse namespace * e5359eb remove unused readdir function * f00cd14 use pthread_getugid_np instead of gete{u,g}id on OSX. fixes #84 -- Antonio SJ Musumeci Thu, 16 Jul 2015 16:58:14 -0400 mergerfs (2.1.1~ubuntu-xenial) xenial; urgency=medium * 4d60538 ignore ENOTSUP errors when cloning paths. fixes #82 -- Antonio SJ Musumeci Mon, 13 Jul 2015 12:21:48 -0400 mergerfs (2.1.0~ubuntu-xenial) xenial; urgency=medium * aafc1e9 add str to size_t conversion code * b3109ac add minfreespace to xattr interface * d079856 add info on lfs and fwfs policies and minfreespace option * c101430 rework category -> fuse function table * b2cd791 stop auto calculating and storing fullpath in policies * 0c60701 create different policies based on category of use * 51b6d3f add category to policies so as to distinguish between creates and searches * 6ca4389 separate policies into individual modules * 3c8f122 move policy function type from fs to policy * 2bd4456 move Path object to separate file * 8e5b796 create lfs policy. closes #73 * 58167c3 first w/ free space policy. closes #72 * ccb22c1 create minfreespace option. closes #71 -- Antonio SJ Musumeci Sun, 5 Jul 2015 21:03:34 -0400 mergerfs (2.0.1~ubuntu-xenial) xenial; urgency=medium * ad7ce48 fix readme typos and misc formatting * fe0f442 add Tips and FAQ section to readme * 1879c9c update readme with defaults option info * 45b73e5 fix calling of lgetxattr. closes #68 -- Antonio SJ Musumeci Fri, 5 Jun 2015 20:13:24 -0400 mergerfs (2.0.0~ubuntu-xenial) xenial; urgency=medium * 5fb2775 attempt to set priority to -10 on startup. closes #65 * 4b204b8 restrict who can setxattr the pseudo file. closes #64 * 33c837a provide 'defaults' option. closes #58 * 951b22b set FUSE subtype to 'mergerfs'. closes #59 * 74c334c add default policies for categories and description of `all` * 08366a3 match cli options to xattrs * 91671d7 remove FileInfo and keep only file descriptor * c022741 revert removal of 'all' policy and relevant behavior. closes #54 * 12f393a per FUSE function policies. closes #52, #53 -- Antonio SJ Musumeci Tue, 17 Mar 2015 20:40:35 -0400 mergerfs (1.7.1~ubuntu-xenial) xenial; urgency=medium * 283a2b2 Try RLIMIT_INFINITY first, then cur = max, then loop and try to increase till error. closes #50 * 1a1c9db close file after getting ioc flags. closes #48 -- Antonio SJ Musumeci Tue, 17 Feb 2015 11:48:55 -0500 mergerfs (1.7.0~ubuntu-xenial) xenial; urgency=medium * d30cae2 add user.mergerfs.allpaths and user.mergerfs.relpath to getxattr * 2e95c6e merge action and search category * b411c63 Remove 'all' policy and simplify logic * 1f90203 use standard platform macros. closes #43 * c2cbb93 elevate privileges when calling clonepath. closes #41 * 6276ce9 handle EEXIST while cloning a path. closes #40 * d1f3bd8 add clonepath tool * 031b87f slight refactoring * 5dd0729 remove longest common prefix from fsname. closes #38 -- Antonio SJ Musumeci Sat, 7 Feb 2015 18:49:36 -0500 mergerfs (1.6.0~ubuntu-xenial) xenial; urgency=medium * 6c3ff01 pass const strings by reference. closes #33 * d7ede20 provide stat to readdir filler. closes #32 * 613b996 support RHEL6. closes #29 -- Antonio SJ Musumeci Mon, 10 Nov 2014 21:11:17 -0500 mergerfs (1.5.1~ubuntu-xenial) xenial; urgency=medium * 47522a2 exclude merges in the debian changelog. closes #28 -- Antonio SJ Musumeci Mon, 29 Sep 2014 19:30:12 -0400 mergerfs (1.5.0~ubuntu-xenial) xenial; urgency=medium * 075d62d add support for ioctl on directories. closes #27 -- Antonio SJ Musumeci Fri, 26 Sep 2014 18:33:51 -0400 mergerfs (1.4.1~ubuntu-xenial) xenial; urgency=medium * cfe7609 find functions now return errors. closes #24 * 8f35406 use lstat to confirm file existance instead of eaccess. closes #25 * 4ea1adb use f_frsize rather than f_bsize for mfs calculations. closes #26 * 15f8849 add custom git log to debian changelog script -- Antonio SJ Musumeci Sat, 23 Aug 2014 11:44:40 -0400 mergerfs (1.4.0~ubuntu-xenial) xenial; urgency=medium * 7e9ccd0 support runtime setting of srcmounts. closes #12 -- Antonio SJ Musumeci Fri, 8 Aug 2014 10:20:27 -0400 mergerfs (1.3.0~ubuntu-xenial) xenial; urgency=medium * 992e05e update docs for xattr features * b82db46 getxattr for user.mergerfs.{base,full}path returns the source paths. closes #23 * 7b0d703 only allow manipulation of runtime settings via xattrs. closes #22 -- Antonio SJ Musumeci Thu, 31 Jul 2014 17:27:43 -0400 mergerfs (1.2.4~ubuntu-xenial) xenial; urgency=medium * 45cec2d use int instead of long for ioctl. fixes #21 -- Antonio SJ Musumeci Tue, 22 Jul 2014 07:07:25 -0400 mergerfs (1.2.3~ubuntu-xenial) xenial; urgency=medium * 2295714 on ENOENT try cloning the dest path to source drive. closes #20 -- Antonio SJ Musumeci Mon, 7 Jul 2014 21:54:38 -0400 mergerfs (1.2.2~ubuntu-xenial) xenial; urgency=medium * ccb0ac1 generate the controlfile data on the fly. closes #19 * 15a0416 don't flush if it's the .mergerfs pseudo file. closes #18 * ec38a9c fix rename'ing to local device -- Antonio SJ Musumeci Wed, 25 Jun 2014 15:17:26 -0400 mergerfs (1.2.1~ubuntu-xenial) xenial; urgency=medium * 3b6c748 use geteuid syscall as well -- Antonio SJ Musumeci Mon, 23 Jun 2014 12:17:09 -0400 mergerfs (1.2.0~ubuntu-xenial) xenial; urgency=medium * f385f02 add -O2 to CFLAGS * 0e12d79 platform specific code to deal with sete{u,g}id. closes #17 * 7164535 add flush callback. closes #16 * dd66607 add {read,write}_buf functions. closes #15 * 0f8fe47 add man file via markdown -> man conversion with pandoc. closes #14 * 45a2e09 reverse source and destination mount points to match fstab requirements. closes #13 * 645c823 source mount paths can contain globing. closes #10 * 1835826 fsname set to list of src mounts. closes #9 * 4a0bc4a add debian package building. closes #11 * e2e0359 fix free space calculations. closes #8 * 655436f further Makefile enhancements -- Antonio SJ Musumeci Wed, 18 Jun 2014 10:40:54 -0400 mergerfs (1.1.0~ubuntu-xenial) xenial; urgency=medium * a7d9a9b enhance Makefile * 36887e4 when readdir's filler returns non-zero return ENOMEM. closes #7 * 652a299 add fgetattr. closes #5 * aab90b0 rework policy code * 345d0bb use eaccess to determine permissions for ffwp. closes #2 * 4c7095c remove stat'ing of files in readdir. closes #3 -- Antonio SJ Musumeci Wed, 28 May 2014 21:39:07 -0400 mergerfs (1.0.2~ubuntu-xenial) xenial; urgency=medium * bbc4b59 fs::make_path should check for forward slashes, add if missing * 16fe0cf remove statfs policy * 29ed2bc add FS_IOC_{GET}VERSION to ioctl * 243a193 use long instead of int to limit possibility of overflow in switch, closes #1 * 97ce6f5 use {get,list,set}xattr to modify runtime * 428dd8c update build instructions in readme -- Antonio SJ Musumeci Tue, 27 May 2014 07:17:32 -0400 mergerfs (1.0.1~ubuntu-xenial) xenial; urgency=medium * 7f640c4 fix building without libattr -- Antonio SJ Musumeci Mon, 19 May 2014 09:34:31 -0400 mergerfs-2.21.0/debian/copyright0000664000175000017500000000203513003720476015177 0ustar bilebileFormat: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: mergerfs-1.1.0 Source: http://github.com/trapexit/mergerfs Files: * Copyright: 2014 Antonio SJ Musumeci License: ISC Files: debian/* Copyright: 2014 Antonio SJ Musumeci License: ISC License: ISC 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. n mergerfs-2.21.0/debian/docs0000664000175000017500000000001212560567537014126 0ustar bilebileREADME.md mergerfs-2.21.0/debian/mergerfs/0000755000175000017500000000000013070672157015062 5ustar bilebilemergerfs-2.21.0/debian/mergerfs/DEBIAN/0000755000175000017500000000000013070672161015777 5ustar bilebilemergerfs-2.21.0/debian/mergerfs/DEBIAN/control0000644000175000017500000000102013070672161017373 0ustar bilebilePackage: mergerfs Version: 2.20.0-5-gc043ef9~ubuntu-xenial Architecture: amd64 Maintainer: Antonio SJ Musumeci Installed-Size: 210 Depends: libc6 (>= 2.14), libfuse2 (>= 2.9), libgcc1 (>= 1:3.0), libstdc++6 (>= 5.2) Section: utils Priority: optional Homepage: http://github.com/trapexit/mergerfs Description: another FUSE union filesystem mergerfs is similar to mhddfs, unionfs, and aufs. Like mhddfs in that it too uses FUSE. Like aufs in that it provides multiple policies for how to handle behavior. mergerfs-2.21.0/debian/mergerfs/DEBIAN/md5sums0000644000175000017500000000051413070672161017317 0ustar bilebilea4b7e60f93b6c8de563df806d9f3b51d usr/bin/mergerfs 21be664160fd2279dc2394993fee56be usr/share/doc/mergerfs/README.md.gz c03da493da3200630e52ac7ed7d5fae9 usr/share/doc/mergerfs/changelog.Debian.gz c4bab07f7b3957d7521624c726ba25e2 usr/share/doc/mergerfs/copyright a3a7aad29f4c6ff4a98228249016465c usr/share/man/man1/mergerfs.1.gz mergerfs-2.21.0/debian/mergerfs/usr/0000755000175000017500000000000013070672156015672 5ustar bilebilemergerfs-2.21.0/debian/mergerfs/usr/bin/0000755000175000017500000000000013070672157016443 5ustar bilebilemergerfs-2.21.0/debian/mergerfs/usr/bin/mount.mergerfs0000777000175000017500000000000013070672156023072 2mergerfsustar bilebilemergerfs-2.21.0/debian/mergerfs/usr/bin/mergerfs0000755000175000017500000047643013070672157020221 0ustar bilebileELF>~@@u@8 @@@@@@00pp@p@@@kk mmbmb mmbmb@@DDmmbmbPtdBBQtdRtdmmbmbXX/lib64/ld-linux-x86-64.so.2GNU GNU&"҅6=0tcYvzA,0@ er:k-&@prL C xIk)EL ( z  ' 1   7#   < hy T      :   z  h 6 go e x F D    X   .  [   aK   ! 1   0  9 z   ] |Y  (        M   l  F      \<   &   o   P    8 >  * M o  - !ub !tb -"PyAY!vb!tbP! ub"0.A ub "XA."XA.8@"@XA6i:@libfuse.so.2_ITM_deregisterTMCloneTable__gmon_start___Jv_RegisterClasses_ITM_registerTMCloneTablefuse_opt_add_argfuse_main_realfuse_get_contextfuse_opt_parsefuse_opt_insert_argfuse_buf_copyfuse_buf_sizelibstdc++.so.6_ZNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEED1Ev_ZSt29_Rb_tree_insert_and_rebalancebPSt18_Rb_tree_node_baseS0_RS__ZNSt8ios_base4InitD1Ev_ZTVSt15basic_streambufIcSt11char_traitsIcEE__gxx_personality_v0_ZNSo3putEc_ZNKSt5ctypeIcE13_M_widen_initEv_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignEPKc_ZSt18_Rb_tree_decrementPSt18_Rb_tree_node_base_ZdlPv__cxa_begin_catch_ZSt20__throw_length_errorPKc_ZTVSt9basic_iosIcSt11char_traitsIcEE_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l_ZNSt6localeD1Ev_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4findEcm__cxa_end_catch_ZSt24__throw_out_of_range_fmtPKcz_ZNSt8ios_baseD2Ev_ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEED1Ev_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEm_ZSt16__throw_bad_castv_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareEPKc_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE8_M_eraseEmm_ZSt17__throw_bad_allocv_ZNSt8ios_base4InitC1Ev_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4swapERS4__ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_RKS8__ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE7_M_syncEPcmm_ZTVNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEE__cxa_guard_release_ZSt18_Rb_tree_incrementPSt18_Rb_tree_node_base_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEmmPKcm_ZNSt9basic_iosIcSt11char_traitsIcEE4initEPSt15basic_streambufIcS1_E_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_appendEPKcm_Znwm__cxa_rethrow_ZNSt6localeC1Ev_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE14_M_replace_auxEmmmc_ZSt18_Rb_tree_incrementPKSt18_Rb_tree_node_base_ZNSt8ios_baseC2Ev_ZSt19__throw_logic_errorPKc_ZNKSt5ctypeIcE8do_widenEc__cxa_guard_acquire_ZTTNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEE_ZTVNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEE_ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEED0Ev_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm_ZSt4cout_ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEED2Ev_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareEmmRKS4__ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_assignERKS4__ZNSo5flushEv_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5rfindEcm_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_libgcc_s.so.1_Unwind_Resumelibpthread.so.0writeopen64readpthread_rwlock_wrlockpthread_rwlock_unlockfsync__errno_locationpread64lseek64fcntlpthread_rwlock_initpwrite64pthread_rwlock_rdlockcloselibc.so.6globfree64fchmodfnmatchsrandstatvfs64__open64_2ftruncate64closedirglob64time__stack_chk_failunlinkmkdirreallocstrtolllsetxattrgetpidstrdupflocklchownsymlinkfgetxattrfdatasynccallocfutimensstrlen__cxa_atexitmemsetutimensatrmdirmemcmp__fxstat64fallocate64getpwuid_rfchownmemcpymallocumaskrealpathremovegetgid__lxstat64opendir__xstat64ioctlsetrlimit64__snprintf_chkgetuidreadlink__xmknodsendfile64lgetxattrrenameflistxattrlremovexattrreaddir64llistxattrsyscallgetrlimit64fsetxattrmemmovegetgrouplistfaccessatstrcmp__libc_start_maindirfdsetpriorityposix_fadvise64freeGCC_3.0FUSE_2.9FUSE_2.8FUSE_2.6FUSE_2.5GLIBC_2.10GLIBC_2.4GLIBC_2.14GLIBC_2.3.4GLIBC_2.6GLIBC_2.3GLIBC_2.7GLIBC_2.2.5GLIBCXX_3.4.20GLIBCXX_3.4.11GLIBCXX_3.4.9CXXABI_1.3GLIBCXX_3.4.21GLIBCXX_3.4        P&y  P!{  !{ !{ !{ u #ii . 8ti Cii Oii Yii cui m  ui mpya)ӯkqt)obtbtb ubububvbpb pb(pb0pb8pb@pbHpbPpbXpb `pb hpb ppb xpb pbpbpbpbpbpbpbpbpbpbpbpbpbpbpbpbqbqbqb qb! qb"(qb#0qb$8qb%@qb&Hqb'Pqb(Xqb)`qb*hqb+pqb,xqb-qb.qb/qb0qb1qb2qb3qb4qb5qb6qb7qb8qb9qb:qb;qb<qb=rb>rb?rb@rbA rbB(rbC0rbD8rbE@rbFHrbGPrbHXrbI`rbJhrbLprbMxrbNrbOrbPrbQrbRrbSrbTrbUrbVrbWrbXrbYrbZrb[rb\rb]rb^sb_sb`sbasbb sbc(sbd0sbe8sbf@sbgHsbhPsbiXsbj`sbkhsblpsbmxsbnsbosbpsbqsbrsbssbtsbsbusbvsbwsbxsbysbzsb|sb}sb~tbtbtbtb tb(tb0tb8tb@tbHtbPtbXtb`tbhtbptbHH>"HtH5>"%>"@%>"h%>"h%>"h%>"h%>"h%>"h%>"h%z>"hp%r>"h`%j>"h P%b>"h @%Z>"h 0%R>"h %J>"h %B>"h%:>"h%2>"h%*>"h%">"h%>"h%>"h% >"h%>"h%="hp%="h`%="hP%="h@%="h0%="h %="h%="h%="h%="h %="h!%="h"%="h#%="h$%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H`HhHPH9t.H2HHB8,1҃u +ډHf.H121H@f.SH HH$HD$dH%(HD$1-1҅uHt$dH34%(uLH [fH6/t1HD$H$H-HL$H HT$H$tg.VfDFfD11u*DATUISHHdH%(HD$1HuHtB,fDHL)HH$w8HUHHt[HuBH$HEHD$dH3%(uGH[]A\ÐH1H31HHEH$HEHL,HUA$HUn-@f.AWAVAUATUSHdH%(HD$x1HH;FH|$DHHIH9HT$ HLH|$HT$HH0HHUHEH)H?HJ(HB I9bLl$@Lt$`HHHHHI93Ll$0HLH0H|$0HVHD$8H|$PLt$PHD$XD$`Hp.Ht$XH|$PE170HT$8Ht$0H|$P(HT$XHt$PH|$(H|$PL9t+H|$0L9tq+HUHEHH)HH9-Ht$H\$HHT$HHHHH|$HD$ H9t+H\$xdH3%(HD$unHĈ[]A\A]A^A_HHGGHHLXBpB1:-HH|$HT$ H9t*H.XBpB1 -%+H|$PHHD$`H9t~*H|$0HD$@H9tj*H|$PHT$`HH9u@S1HHdH%(HD$1^H|$dH3<%(u HH[*HWLHI9ttMQMtkHM1L)HHEvAI9A(vKIQ D:uLIQ@H9BHv&H6H D:u"HH9uHL9uHff.USHHHHLHu&HCHCCHHH[]fHUHKHH H9BH2HFBHmHH[]ATUHSHIHdH%(HD$1HLHDHHHt$dH34%(u HH[]A\))fAVAUIATUISH.IEH9tI$I;\$uH H9u[]A\A]A^fDH;Hu1H *I9\$tutIEfIUH] H9t this->size() (which is %zu)vector::_M_range_insert++<+>--<->=falsetruecategoryfunc-ofsnamemergerfssubtype-h--help-v-V--versiondefaultsatomic_o_truncauto_cachebig_writesdefault_permissionssplice_movesplice_readsplice_writedirect_iodropcacheonclose-homergerfs version: Usage: mergerfs [options] -o [opt,...] mount options -h --help print help -v --version print version mergerfs options: ':' delimited list of directories. Supports shell globbing (must be escaped in shell) -o defaults Default FUSE options which seem to provide the best performance: atomic_o_trunc, auto_cache, big_writes, default_permissions, splice_read, splice_write, splice_move -o func.=

Set function to policy

-o category.=

Set functions in category to

-o direct_io Bypass additional caching, increases write speeds at the cost of reads. Please read docs for more details as there are tradeoffs. -o use_ino Have mergerfs generate inode values rather than autogenerated by libfuse. Suggested. -o minfreespace= minimum free space needed for certain policies. default=4G -o moveonenospc= try to move file to another drive when ENOSPC on write. default=false -o dropcacheonclose= when a file is closed suggest to OS it drop the file's cache. This is useful when direct_io is disabled. default=false BBBBB2.20.0-5-gc043ef9system.posix_acl_defaultvector::_M_fill_insertsearchcreateactioninvaliduser.mergerfs.piduser.mergerfs.versionuser.mergerfs.policiesuser.mergerfs.moveonenospcuser.mergerfs.minfreespaceuser.mergerfs.srcmountsuser.mergerfs.category.user.mergerfs.func.newesterofseprandepmfsepluseplfsepffepalluser%llu%duser.mergerfs.basepathrelpathfullpathallpaths2.20.0-5-gc043ef9utimensunlinktruncatesymlinksetxattrrmdirrenameremovexattrreadlinkopenmknodmkdirlistxattrgetxattrgetattrchownchmodaccess;d\ $!#!#$"T&'&,&,/t-/-2424E3DE6F6DFd9L9Tb9db4dc4dTdd4e4eTe|Dfg th\ ht i k\ l tp p Tq$ q q q DuT 4x x x |T d} t} } } D~TT\tDĜDTD4\tD$t$Թd|$t,$,T4dt<4LdlT$D|T44Tdl$lT \T!$"D"d""4##<$l%t&T' $(< )l ) * + ",\"3"D4":4#;l;;4<< !=t!@#AD$DA\#A\$B$F$DG%DH\%I%K&M&M'N'Y'\<'d]4(t]L(4`(4h(th)hL)i|)m)n)o<*p*u+dwt*4zd+4}+,l,,t-$D-č-$.|.-T.$/0d04|/|0ġ0T1ĦT111T2Ԯ343L3343|5ĸ53D44t4D556t<7T6T7$7T7,8l8D8,99 :$:L:d:|:::4$;tL;d;;;<,<t<<T<zRx ([*zRx $X FJ w?;*3$"4D[BAD G0l  AABB |h\DYp\OGB A 4\BAD Jg  AABA \OGB A $ (]UAGF AA $4`]ZAGK AA zPLRx8@ T$x]|YBBBB B(D0A8Q 8A0A(B BBBK <^UBD A(F0d(A ABB_L,_BBB B(A0A8G 8A0A(B BBBA L$bYBBBB B(D0A8J 8A0A(B BBBA Dth_YBBBE A(F0DA 0A(A BBBC T`YBBBB B(A0A8J) 8A0A(B BBBI lePDb J T A LeBBA A(G0P (D ABBJ U(D ABB4(f}BDA c ABK AAB<@YBBAD O  AABA Tl&D]f eT\eBZBBBB B(A0A8G 8A0A(B BBBH Th5ZBBBB B(D0A8D 8A0A(B BBBB <dkrBBF A(M0L (A ABBA kLdkYZBBBB A(D0Pj 0A(A BBBC L xoBBA A(G0P (D ABBJ U(D ABB\otooDT,oAAM0T AAK < pBBA A(L@ (A ABBD <xBIB A(A0A (A BBBI TpoZBBBB B(A0A8G- 8A0A(B BBBH L|BBB B(D0A8GPN 8A0A(B BBBD T(yZBBBE B(D0A8D/ 8A0A(B BBBC T}ZBBBB B(A0A8M 8A0A(B BBBB LBBA A(D0{ (D ABBJ D(A ABBTx [BBBB B(A0A8J 8A0A(B BBBA L)[BBBE B(A0A8DP 8C0A(B BBBA TLi<[BBBE B(D0A8G 8A0A(B BBBA  &Da М4, xBAD V0  AABD d @JAHT, pBc[BBBB B(A0A8G 8A0A(B BBBH L h[BBBE B(D0A8JPo 8D0A(B BBBJ L 8[BBBE B(D0A8JPr 8D0A(B BBBG 4| ȤBAD Mph  AABA d\ [BBBE B(D0A8GP` 8A0A(B BBBG  8C0A(B BBBG  h4 `;Ai F HT GD } A t (DcT4 ȦB[BBBB B(A0A8G 8A0A(B BBBH T *[BBBB B(A0A8Gp 8A0A(B BBBE T z\BBBB B(A0A8G  8A0A(B BBBH L< i4\BBBB B(D0A8FN 8A0A(B BBBE 4 BAD G0l  AABB 4UBAA x DBN AAB, @T\BAAD@ AAA 4, ~g\BBAD O`C  AABA d x\BKEB B(D0A8Pp8A0A(B BBBJp 8A0A(B BBBJ  8A0A(B BBBE 4 \BAC G. A TD4  ]BBBE B(D0A8ML 8A0A(B BBBE T0i]BBBE B(D0A8G 8A0A(B BBBA ,LHBBAA zAB4|hBAD G0l  AABB L{BBB A(A0T (F BBBH A(C BBBT0]BBBB B(A0A8JE 8A0A(B BBBE T9d^BBBB B(D0A8G 8A0A(B BBBD T\^BBBE B(D0A8G 8A0A(B BBBA  H, Q^BAAJp AAA <TPTAAO Q AAD Y AAE DFA4pBAD G0l  AABB ,t^BAAJ AAA 4h,^BBAD T  AABJ D`_BBBD A(J! (A ABBF |(&D]T<A_BBBE B(D0A8G\ 8A0A(B BBBA +A^ A H &Da,C_BAAD` AAE LTeEEB A(A0r (D BBBF M(A BBB| 2KBE B(A0A8JP` 8D0A(B BBBK 8A0A(B BBBIPTp_BBBB B(D0A8PJ 8A0A(B BBBG <|BBD A(D0] (A BBBG TdHR_BBBB B(A0A8G 8A0A(B BBBH 4PBAD J0g  AABD 4LBAD G0l  AABB PX4`_BAE E ABH ACB4GAAN ] CAO DAA$.AhD 6Apd@2Ab M A,`ZGDA IAB<BBD A(JP (A ABBA ,`BAAGp AAA 4$PBAC G@  AABA ,+`BAAGp AAA ,4>`BAAGp AAA 4HBAD G@  AABA ,Q`BAAGp AAA ,d`BAAGp AAA <T@ BBD A(JP (A ABBA ,< w`BAAGp AAA dWBBB B(A0A8DP 8F0A(B BBBK Y 8F0A(B BBBA ,xBFB B(D0A8GPs 8A0A(B BBBK  8D0A(B BBBE  8A0A(B BBBB d 8F0A(B BBBE Ll _`BBBB B(D0A8G@~ 8A0A(B BBBD T `BBBB B(A0A8G+ 8A0A(B BBBA $aBAFPu AC T<`aBBBB B(A0A8G+ 8A0A(B BBBA $\aBAGPv AA 4UBAA y DBM AAB4LBAD G0l  AABA $9AAR XGALgBBD A(D0i (A ABBD ](D ABB#D@laBBBL A(D0 (A BBBA TaBBBE B(D0A8G 8A0A(B BBBA !WAE J F<| "aBBBD A(S` (A ABBA d"\aBBBB B(A0A8D 8A0A(B BBBF DIFAT$#ObBEBF B(D0A8Qz 8A0A(B BBBG 4|%bBAJ DZ.^ A <1bBAC HDM.Y A f.4(bBAH S.y.H A I.&AU4&BAD G0l  AABB D5bBBBE A(D0g (A BBBA T' bBBBG B(D0A8O^ 8A0A(B BBBG T<1cBBBE B(A0A8G 8A0A(B BBBG  (5T 5cBBBE B(D0A8D 8A0A(B BBBK T 7cBBBB B(A0A8GP 8A0A(B BBBE !0?7De G ,!P?lBAD v ABH ,"?BAD n ABA L @ dBBBG A(E0WE 0A(A BBBA "CG A L"DBBB B(A0A8G 8A0A(B BBBA 4"E$BAC L!  AABH $,#LAM( AI dT#PFBBB B(A0A8GVcuOWg 8A0A(B BBBA \#JBBB A(E0! (D BBBA x (D BBBA L(D BBBT"NdBBBE B(D0A8G 8A0A(B BBBA T#pQB>dBBBB B(A0A8G 8A0A(B BBBH Tt#hTbdBBBB B(D0A8U2 8A0A(B BBBA T# WxdBBBB B(D0A8G 8A0A(B BBBJ T$$YdBBBE B(D0A8G, 8A0A(B BBBC $%P\AL P AB T$\dBBBB B(D0A8J3 8A0A(B BBBD T$ `dBBBB B(D0A8D 8A0A(B BBBH ,&k6GDA eABT%hbeBBBB B(D0A8G 8A0A(B BBBA L%iweBBBB B(D0A8D@~ 8C0A(B BBBE T,&jZ0eBBBB B(A0A8G 8A0A(B BBBH T&mTeBBBE B(D0A8DZ 8A0A(B BBBA 44(pUBAA y DBM AAB4l(BAD G0l  AABA $(9AAR XGAL(horBBD A(D0G (D ABBC K(A ABB)o-D'p'teBBBL A(D0 (A BBBA T$(peBBBB B(D0A8JN 8A0A(B BBBA 4)0upBAD R ABD LAB<(hu'eBBBD A(Sp (A ABBA d(XveBBBB B(A0A8D9 8A0A(B BBBG DIFAT\)wC fBEBF B(D0A8Q, 8A0A(B BBBE 4)zfBAJ DZ.^ A <) 69fBAC HD.Y A v.4,* ?fBAH S<.}.R A I.+(+{+{DTT*{ggBBBE B(D0A8Gl 8A0A(B BBBA \,h~DT4t,p~BAD G0l  AABB L,BBD A(G0p (D ABBG } (D ABBJ <+gBBBA A(G` (A ABBA d+hxgBBBB B(A0A8DZIFA 8A0A(B BBBA TL,gBEBF B(D0A8Q 8A0A(B BBBA 4,8ZgBAF DP.M A 4,}gBAI HK.N A D-OhBAC HD& J G.k.+.S.T\-hBBBB B(A0A8G 8A0A(B BBBH 4 /HUBAA y DBM AAB4D/BAD G0l  AABA $|/89AAR XGAL/rBBD A(D0G (D ABBC K(A ABB/0#D.hBBBL A(D0 (A BBBA T.0iBBBB B(D0A8J+ 8A0A(B BBBD 40XhBAD H ABF LAB</ `iBBBD A(Sp (A ABBA d/`lsiBBBB B(A0A8D 8A0A(B BBBB DIFAT40hiBEBF B(D0A8Q 8A0A(B BBBG 40iBAJ DZ.^ A <0 diBAC HD.Y A m.41jBAH SL .}. A I.2p(2ȯ&Da2DM$2AF0E AC 3` 3X 43P 4L3HBAD G0l  AABB T,2|,kBBBB B(A0A8G 8A0A(B BBBA $3@AL i DA 4 44mAAM b DAJ gDA4T4gBAD L0G  DABA <4BBE A(D0d (A BBBG 4(TSD3дkBBBD A(S (A ABBH ,5X DD5PeBBE B(H0H8M@r8A0A(B BBB5x E8M2} <] !5 *5',VJ  `*[   8#E? %5!L E/. &5(. &5sNa c}r 1               }gCDh6 ;    $  2$#6F9#E?,&D%#C&#' G$ & $%#$8''&$%$!'#$##$$$%%&$$ME^?XC'Ok-F?UBR              _#E?9qwYZ &56)g6)i6)g6)i6)g6)g)1Pl}GJ            CGK            D%[E8V9!}N#$/` Gc  n    K-    B>+\m        :MdT            (M!8'2Y XEf? !5 $S.4Q%M  |8 )5En=%[E8YJ0}N14/y2gc++r% ( +  ( K @   % B+\y               9?3ZQqn2   57z&#&""  " #%&#"$R"g$$"N%"="%"?%%%"#$ K""#&'1Zo  %[E8YA'}N(+/j(Uc! " r  !  K 7    B+\t ))))**))))))++******** * * * * * * ( ( ( ( ( ( (  )))(!e2lE8M2}4i @P=@=@0I@a@~@@  u 01@ Bmb0mbo@@0@  pb $@h#@ o!@oo @mbf1@v1@1@1@1@1@1@1@1@1@2@2@&2@62@F2@V2@f2@v2@2@2@2@2@2@2@2@2@3@3@&3@63@F3@V3@f3@v3@3@3@3@3@3@3@3@3@4@4@&4@64@F4@V4@f4@v4@4@4@4@4@4@4@4@4@5@5@&5@65@F5@V5@f5@v5@5@5@5@5@5@5@5@5@6@6@&6@66@F6@V6@f6@v6@6@6@6@6@6@6@6@6@7@7@&7@67@F7@V7@f7@v7@7@7@7@7@7@7@7@7@8@8@&8@68@F8@V8@f8@v8@8@8@8@8@8@8@8@8@9@9@&9@69@F9@V9@f9@v9@9@9@9@9@9@9@9@9@:@:@.shstrtab.interp.note.ABI-tag.note.gnu.build-id.gnu.hash.dynsym.dynstr.gnu.version.gnu.version_r.rela.dyn.rela.plt.init.plt.got.text.fini.rodata.eh_frame_hdr.eh_frame.gcc_except_table.tbss.init_array.fini_array.jcr.dynamic.got.plt.data.bss p@p@ !@$4o@`> 0@0F@No @ 8[o!@!jh#@h#tB$@$ ~01@01yP1@P1 :@ :0:@0:B B B#B#5|YB|YXmbmmbm0mbmmbmmbmobopbpxxtbxttbt t mergerfs-2.21.0/debian/mergerfs/usr/share/0000755000175000017500000000000013070672156016774 5ustar bilebilemergerfs-2.21.0/debian/mergerfs/usr/share/man/0000755000175000017500000000000013070672156017547 5ustar bilebilemergerfs-2.21.0/debian/mergerfs/usr/share/man/man1/0000755000175000017500000000000013070672156020403 5ustar bilebilemergerfs-2.21.0/debian/mergerfs/usr/share/man/man1/mergerfs.1.gz0000644000175000017500000003545513070672156022732 0ustar bilebile*ݽ&tn+owKP(L)W|yqW*ndf;&nRbVyMAV*%D_ u~?.i򾯽517:3h)m}Q wֵ~4d7k;UVOs.P>IHфlOv2@@wV ھVګֹnvys7KV* 8koZnVN "m3&[E K!׭E R孽CLiSً$`6S Jd0On ݗ1_R2QY{aw3Ds7HQ3ׅ]0=/eƴA2s̑څze *ocN59{;IŶ&ncd45pŦѠ"@j jP1/M 1`4tG>Du]L +®c@>ʒPQ#HQ`#5 xUʵbeV}uksg WUr!-իpyM@+QzkSH"(5p۹[.R-wН5$%H+K?LM)fRp?dC&/jjs2lq xAx]:5Apu9Bj=z pMڥr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KL;Pmm9}3(nXCtRuo+>]j+b; MXb @͠E5^"OJKvC^!)3d+5ژ*i ab ^f9/3"0_թArR pNdLxy]ΣmXH J`[@}o\P幩_TzYA {sz񺮐E*WQ XsIZc @^3mcZR %ysHd{xp $ȳlmW\,~Qb{4|E]Qe׊r|. _|[ ^ ]h@Y]#N6; ӥxAJiEf5~-ObV7!采jNy+^M j%rɹRoP}ma86*@Sbz܋֧5.CE+tj R+faHd&0e:Z6`"+a6g΅.:;#Ӑ89Ōְ4k%26QR 4[ᯍc`L\mT܀F*?%3Rҡn*$aT^XoXHCy`Aoqݥ:ÔGڑW85>1X= YPA#K N %/ L!sI-AɴEe(dRq.J54t p?sZByf0q d.Q^-S([9TD541*LH{c5xMcDwt=>{ a2jOݢ D"STUNy[p'wD+(h]-ƓyT>l|wN^f\N'1;ġeS&6}=^fsZ`(#kÑ @IY >ݻWg+nUD3e@'t ֊Bz)RVzQOFC )#=<BVՊS/,@L t6+bo՗Nj^/<"+7 gKu0-f`fhTr!%tQ`cH$~`G"B_R-;iõY4Vd@B`gX$y]˘M*[ a\adN1JKc{/?~g捊DJ~60Utv4ZNsC8u.CqBpćy4+!p3j˼ SR%NrSDڤ G "Z&뫛[Y|ԧvyG ]J#aIh7mU9ٻ,|id$ DKui%=DY.OFlryw~_ ίw~|w-ߩ}/P/LIkпTҧmergerfs-2.21.0/debian/mergerfs/usr/share/doc/0000755000175000017500000000000013070672156017541 5ustar bilebilemergerfs-2.21.0/debian/mergerfs/usr/share/doc/mergerfs/0000755000175000017500000000000013070672156021353 5ustar bilebilemergerfs-2.21.0/debian/mergerfs/usr/share/doc/mergerfs/copyright0000644000175000017500000000203513003720476023301 0ustar bilebileFormat: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: mergerfs-1.1.0 Source: http://github.com/trapexit/mergerfs Files: * Copyright: 2014 Antonio SJ Musumeci License: ISC Files: debian/* Copyright: 2014 Antonio SJ Musumeci License: ISC License: ISC 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. n mergerfs-2.21.0/debian/mergerfs/usr/share/doc/mergerfs/changelog.Debian.gz0000644000175000017500000001652213070672125025027 0ustar bilebile[iGr_X >\4] xGˮQX. wQ $/2T&BjeۖT76触hQ7O~eb*'zNd_'q>Z3~h{!-vhn51-N{0iܷδ O q޲bIDZ>22t{m;>z#f] 8h ҚW~Ie2xJ݋%&( m^cLCs ua,IaK];Kʪԃ"b%f&Wy1=?ǁ6=l۩nyBS2,ýה*Lc=fxj㜊F\aH:##( I;!LM?\@;]@:xRnp9!;p,'eTL5=ٶ>Sä1216 +'r_dRdJV˰Udnҙ'o Kv&i2@GbՋO8Wlpb_%-A?O>HQae*1L]b|l{O;QR0xA@nwrfޅ`f[KjsfhZyX8ܵADB%vAqiUas}L250ۥs/; ?jp켓{XqJQ8Vw~7};873 mn&EEl) P[34ߍpp=KоPO΅f MF z%lqxxMs-M0?_ykه^~|58NU- >&A֐3[%3cK0WUo #(s!qҀ5tp GGEA) -1e>fCOZ啵A `J:nE6EU.ӡ=F o^Ci 0ZgMlTm[bȁV-J~~|iN=y޷E.NwAv֋/VQV"]ʼ[( }N]q@l',=Ȕ.; 8uCqrEܛ1|JT3F)ng]Z#gdLU9\3&b 2Uv77e u2۲r 9H靸bEgk=aqnԟG e)`u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ǨXG o,VL/L(M¾IRACpB.{2IG=.cPʇx1\Rd̬hʶm;-;)g. 0$zrrjF:THnAynlFŀ=[#f6J$݌O_ HHT0遏74V,nX14i gt!E91c3΢l,a%x`5&RBƒcì?)\Of2i2,eF 6V1U~NA_NjDZadL^h_iQup`znu "r8i,FqoqDwka<ݭDI Ӝ?֢Yɬ)cqj)X^ Zʥ4UulRR7zQ:f;*jFM@<˄,+ݸ O4u׆DF` 6m 3W=vIc}%~òd8w j@_C]ͦ_Rj}'$NtL[iI'nNәzGzI^Ւ_dԐ'S_9LO;!1dȰ]kS^U mZE`{M1$En#Jܣ |t hLj1xJv%sA0ÊGb9ɘ~\DF E T *!4!c惒W?8z]}&wg ) - 8'UW*>ǏY zOjP4X 2*j/zAPΟK6y³MxON: h*g(TΦR* ,(@u, _ir +΋ 'ٜX{G@5&:! z (ٗgdFˆ~/cXBZ1 ^1*/|%IRƆZ\#q`'_UV%< )$KI8<'TpϳE<.tܩ({^eyoLZ|~lBvx.*7t V؍:|{yym+=v']VKO$GvǿN~C?//S/p#{&U|4Џ61 wA _PsNs~˿}nusr}}ͳs^yh$iݥLW?yǩn,ONmergerfs-2.21.0/debian/compat0000664000175000017500000000000212560567537014460 0ustar bilebile9 mergerfs-2.21.0/debian/files0000644000175000017500000000010213070672161014261 0ustar bilebilemergerfs_2.20.0-5-gc043ef9~ubuntu-xenial_amd64.deb utils optional mergerfs-2.21.0/debian/rules0000775000175000017500000000031312640604005014314 0ustar bilebile#!/usr/bin/make -f # -*- makefile -*- # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 %: dh $@ override_dh_auto_install: $(MAKE) DESTDIR=$(CURDIR)/debian/mergerfs PREFIX=/usr install