mirror of https://github.com/trapexit/mergerfs.git
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
177 changed files with 6121 additions and 6012 deletions
-
2LICENSE
-
33src/error.hpp
-
24src/fs_acl.cpp
-
12src/fs_attr_linux.icpp
-
30src/fs_attr_unsupported.icpp
-
225src/fs_clonepath.cpp
-
24src/fs_clonepath.hpp
-
22src/fs_close.hpp
-
22src/fs_closedir.hpp
-
102src/fs_copy_file_range_linux.icpp
-
41src/fs_copy_file_range_unsupported.icpp
-
47src/fs_copydata.cpp
-
31src/fs_copydata_copy_file_range.cpp
-
41src/fs_copydata_readwrite.cpp
-
40src/fs_copyfile.cpp
-
2src/fs_cow.cpp
-
2src/fs_devid.hpp
-
8src/fs_dirfd.hpp
-
8src/fs_dup.hpp
-
4src/fs_dup2.hpp
-
8src/fs_faccessat.hpp
-
9src/fs_fadvise_posix.icpp
-
4src/fs_fadvise_unsupported.icpp
-
10src/fs_fallocate_linux.icpp
-
68src/fs_fallocate_osx.icpp
-
11src/fs_fallocate_posix.icpp
-
4src/fs_fallocate_unsupported.icpp
-
21src/fs_fchmod.hpp
-
10src/fs_fchmodat.hpp
-
18src/fs_fchown.hpp
-
25src/fs_fcntl.hpp
-
10src/fs_fdatasync.hpp
-
16src/fs_fgetxattr.hpp
-
2src/fs_ficlone_unsupported.icpp
-
2src/fs_file_size.cpp
-
18src/fs_file_unchanged.hpp
-
35src/fs_findallfiles.cpp
-
87src/fs_findonfs.cpp
-
10src/fs_flistxattr.hpp
-
8src/fs_flock.hpp
-
10src/fs_fsetxattr.hpp
-
5src/fs_fstat.hpp
-
7src/fs_fstatat.hpp
-
40src/fs_fstatvfs.hpp
-
8src/fs_fsync.hpp
-
9src/fs_ftruncate.hpp
-
8src/fs_futimens_freebsd_11.hpp
-
381src/fs_futimens_generic.hpp
-
8src/fs_futimens_linux.hpp
-
8src/fs_futimesat_generic.icpp
-
32src/fs_futimesat_osx.icpp
-
16src/fs_getdents64.cpp
-
6src/fs_getdents64.hpp
-
4src/fs_getfl.cpp
-
25src/fs_glob.cpp
-
27src/fs_has_space.cpp
-
35src/fs_info.cpp
-
246src/fs_inode.cpp
-
8src/fs_ioctl.hpp
-
3src/fs_is_rofs.hpp
-
31src/fs_lchmod.hpp
-
19src/fs_lchown.hpp
-
16src/fs_lgetxattr.hpp
-
10src/fs_link.hpp
-
4src/fs_llistxattr.hpp
-
10src/fs_lremovexattr.hpp
-
8src/fs_lseek.hpp
-
18src/fs_lsetxattr.hpp
-
8src/fs_lstat.hpp
-
55src/fs_lstatvfs.hpp
-
8src/fs_mkdir.hpp
-
19src/fs_mknod.hpp
-
133src/fs_mktemp.cpp
-
6src/fs_mounts.cpp
-
16src/fs_movefile_and_open.cpp
-
14src/fs_open.hpp
-
5src/fs_openat.hpp
-
10src/fs_opendir.hpp
-
50src/fs_path.cpp
-
2src/fs_path.hpp
-
4src/fs_pread.hpp
-
6src/fs_pwrite.hpp
-
17src/fs_read.hpp
-
20src/fs_readahead.cpp
-
10src/fs_readlink.hpp
-
32src/fs_realpathize.cpp
-
8src/fs_remove.hpp
-
8src/fs_rename.hpp
-
8src/fs_rmdir.hpp
-
7src/fs_sendfile_linux.icpp
-
15src/fs_sendfile_unsupported.icpp
-
15src/fs_setfl.cpp
-
8src/fs_stat.hpp
-
44src/fs_statvfs.hpp
-
184src/fs_statvfs_cache.cpp
-
2src/fs_statvfs_cache.hpp
-
4src/fs_statx.hpp
-
14src/fs_symlink.hpp
-
8src/fs_truncate.hpp
-
7src/fs_umount2.hpp
@ -0,0 +1,33 @@ |
|||
#pragma once
|
|||
|
|||
#include "errno.hpp"
|
|||
|
|||
#include <optional>
|
|||
|
|||
|
|||
struct Err |
|||
{ |
|||
private: |
|||
std::optional<int> _err; |
|||
|
|||
public: |
|||
Err() |
|||
{ |
|||
} |
|||
|
|||
operator int() |
|||
{ |
|||
return (_err.has_value() ? _err.value() : -ENOENT); |
|||
} |
|||
|
|||
Err& |
|||
operator=(int v_) |
|||
{ |
|||
if(!_err.has_value()) |
|||
_err = v_; |
|||
else if(v_ >= 0) |
|||
_err = v_; |
|||
|
|||
return *this; |
|||
} |
|||
}; |
|||
@ -0,0 +1,40 @@ |
|||
/*
|
|||
ISC License |
|||
|
|||
Copyright (c) 2019, Antonio SJ Musumeci <trapexit@spawn.link> |
|||
|
|||
Permission to use, copy, modify, and/or distribute this software for any |
|||
purpose with or without fee is hereby granted, provided that the above |
|||
copyright notice and this permission notice appear in all copies. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
|||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
|||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
|||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
|||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|||
*/ |
|||
|
|||
#pragma once
|
|||
|
|||
#include "to_neg_errno.hpp"
|
|||
|
|||
#include <sys/statvfs.h>
|
|||
|
|||
|
|||
namespace fs |
|||
{ |
|||
static |
|||
inline |
|||
int |
|||
fstatvfs(const int fd_, |
|||
struct statvfs *st_) |
|||
{ |
|||
int rv; |
|||
|
|||
rv = ::fstatvfs(fd_,st_); |
|||
|
|||
return ::to_neg_errno(rv); |
|||
} |
|||
} |
|||
@ -0,0 +1,55 @@ |
|||
/*
|
|||
ISC License |
|||
|
|||
Copyright (c) 2019, Antonio SJ Musumeci <trapexit@spawn.link> |
|||
|
|||
Permission to use, copy, modify, and/or distribute this software for any |
|||
purpose with or without fee is hereby granted, provided that the above |
|||
copyright notice and this permission notice appear in all copies. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
|||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
|||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
|||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
|||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|||
*/ |
|||
|
|||
#pragma once
|
|||
|
|||
#include "errno.hpp"
|
|||
#include "fs_close.hpp"
|
|||
#include "fs_open.hpp"
|
|||
#include "fs_fstatvfs.hpp"
|
|||
|
|||
#include <cstdint>
|
|||
#include <string>
|
|||
|
|||
#ifndef O_PATH
|
|||
# define O_PATH 0
|
|||
#endif
|
|||
|
|||
|
|||
namespace fs |
|||
{ |
|||
static |
|||
inline |
|||
int |
|||
lstatvfs(const std::string &path_, |
|||
struct statvfs *st_) |
|||
{ |
|||
int fd; |
|||
int rv; |
|||
|
|||
fd = fs::open(path_,O_RDONLY|O_NOFOLLOW|O_PATH); |
|||
if(fd < 0) |
|||
return fd; |
|||
|
|||
rv = fs::fstatvfs(fd,st_); |
|||
|
|||
fs::close(fd); |
|||
|
|||
return rv; |
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue