mirror of https://github.com/trapexit/mergerfs.git
committed by
GitHub
38 changed files with 572 additions and 207 deletions
-
2Makefile
-
4src/fs.cpp
-
4src/fs_acl.cpp
-
23src/fs_base_futimesat.cpp
-
30src/fs_base_futimesat.hpp
-
31src/fs_base_futimesat_generic.icpp
-
83src/fs_base_futimesat_osx.icpp
-
13src/fs_base_getxattr.hpp
-
6src/fs_base_ioctl.hpp
-
10src/fs_base_listxattr.hpp
-
2src/fs_base_readlink.hpp
-
8src/fs_base_removexattr.hpp
-
13src/fs_base_setxattr.hpp
-
50src/fs_base_stat.hpp
-
10src/fs_base_utime.hpp
-
24src/fs_base_utime_generic.hpp
-
43src/fs_clonefile.cpp
-
39src/fs_fallocate_osx.icpp
-
6src/fs_inode.hpp
-
2src/fs_movefile.cpp
-
171src/fs_xattr.cpp
-
48src/getxattr.cpp
-
5src/getxattr.hpp
-
16src/gidcache.cpp
-
18src/ioctl.cpp
-
12src/listxattr.cpp
-
2src/mergerfs.cpp
-
2src/num.cpp
-
16src/read.cpp
-
6src/readdir.cpp
-
10src/readlink.cpp
-
17src/setxattr.cpp
-
5src/setxattr.hpp
-
6src/ugid_rwlock.hpp
-
24src/write.cpp
-
8src/write_buf.cpp
-
6src/xattr.hpp
-
2tools/cppfind
@ -0,0 +1,23 @@ |
|||||
|
/*
|
||||
|
ISC License |
||||
|
|
||||
|
Copyright (c) 2017, 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. |
||||
|
*/ |
||||
|
|
||||
|
#if __APPLE__
|
||||
|
# include "fs_base_futimesat_osx.icpp"
|
||||
|
#else
|
||||
|
# include "fs_base_futimesat_generic.icpp"
|
||||
|
#endif
|
||||
@ -0,0 +1,30 @@ |
|||||
|
/*
|
||||
|
ISC License |
||||
|
|
||||
|
Copyright (c) 2017, 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. |
||||
|
*/ |
||||
|
|
||||
|
#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
|
||||
@ -0,0 +1,31 @@ |
|||||
|
/* |
||||
|
ISC License |
||||
|
|
||||
|
Copyright (c) 2017, Antonio SJ Musumeci <trapexit@spawn.link> |
||||
|
|
||||
|
Permission to use, copy, modify, and/or distribute this software for any |
||||
|
purpose with or without fee is hereby granted, provided that the above |
||||
|
copyright notice and this permission notice appear in all copies. |
||||
|
|
||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
||||
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
||||
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
||||
|
*/ |
||||
|
|
||||
|
#include <fcntl.h> |
||||
|
#include <sys/time.h> |
||||
|
|
||||
|
namespace fs |
||||
|
{ |
||||
|
int |
||||
|
futimesat(const int dirfd, |
||||
|
const char *pathname, |
||||
|
const struct timeval times[2]) |
||||
|
{ |
||||
|
return ::futimesat(dirfd,pathname,times); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,83 @@ |
|||||
|
/* |
||||
|
ISC License |
||||
|
|
||||
|
Copyright (c) 2017, Antonio SJ Musumeci <trapexit@spawn.link> |
||||
|
|
||||
|
Permission to use, copy, modify, and/or distribute this software for any |
||||
|
purpose with or without fee is hereby granted, provided that the above |
||||
|
copyright notice and this permission notice appear in all copies. |
||||
|
|
||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
||||
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
||||
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
||||
|
*/ |
||||
|
|
||||
|
#include <err.h> |
||||
|
#include <fcntl.h> |
||||
|
#include <stdio.h> |
||||
|
#include <string.h> |
||||
|
#include <sys/errno.h> |
||||
|
#include <sys/param.h> |
||||
|
#include <sys/stat.h> |
||||
|
#include <sys/time.h> |
||||
|
#include <unistd.h> |
||||
|
|
||||
|
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 = (int)::strlcat(fullpath,"/",MAXPATHLEN); |
||||
|
if(rv > MAXPATHLEN) |
||||
|
return (errno=ENAMETOOLONG,-1); |
||||
|
|
||||
|
rv = (int)::strlcat(fullpath,path,MAXPATHLEN); |
||||
|
if(rv > MAXPATHLEN) |
||||
|
return (errno=ENAMETOOLONG,-1); |
||||
|
|
||||
|
return 0; |
||||
|
} |
||||
|
|
||||
|
namespace fs |
||||
|
{ |
||||
|
int |
||||
|
futimesat(const int dirfd, |
||||
|
const char *path, |
||||
|
const struct timeval times[2]) |
||||
|
{ |
||||
|
int rv; |
||||
|
char fullpath[MAXPATHLEN]; |
||||
|
|
||||
|
if((dirfd == AT_FDCWD) || |
||||
|
((path != NULL) && (path[0] == '/'))) |
||||
|
return ::utimes(path,times); |
||||
|
|
||||
|
if(dirfd < 0) |
||||
|
return (errno=EBADF,-1); |
||||
|
|
||||
|
rv = getpath(dirfd,path,fullpath); |
||||
|
if(rv == -1) |
||||
|
return -1; |
||||
|
|
||||
|
return ::utimes(fullpath,times); |
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue