mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-21 15:36:31 -05:00
remove .fuse_hidden file creation
addresses #521 mergerfs is written using libfuse's high level API. The HLAPI forces a certain behavior with regard to unlinking or rename overwriting of open files. It renames the file to .fuse_hiddenXXXXXX and when incoming requests refer to the unlinked file it will use path based calls and use that path. This behavior leads to rmdirs failing or some software noticing the .fuse_hidden files. This patch changes the HLAPI and removes entirely the .fuse_hidden behavior. See the README for more.
This commit is contained in:
parent
46be946672
commit
6ecc618d83
23 changed files with 880 additions and 299 deletions
|
|
@ -35,24 +35,6 @@ namespace fs
|
|||
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
|
||||
|
|
@ -78,30 +60,4 @@ namespace fs
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,25 +66,6 @@ namespace fs
|
|||
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
|
||||
|
|
@ -111,31 +92,4 @@ namespace fs
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
72
src/fs_base_fchmod.hpp
Normal file
72
src/fs_base_fchmod.hpp
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
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 "fs_base_stat.hpp"
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define MODE_BITS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)
|
||||
|
||||
namespace fs
|
||||
{
|
||||
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
|
||||
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;
|
||||
}
|
||||
}
|
||||
74
src/fs_base_fchown.hpp
Normal file
74
src/fs_base_fchown.hpp
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
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 "fs_base_stat.hpp"
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace fs
|
||||
{
|
||||
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
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -45,15 +45,15 @@ namespace fs
|
|||
static
|
||||
inline
|
||||
int
|
||||
utime(const int fd_,
|
||||
const struct stat &st_)
|
||||
futime(const int fd_,
|
||||
const struct stat &st_)
|
||||
{
|
||||
struct timespec times[2];
|
||||
struct timespec ts[2];
|
||||
|
||||
times[0] = *fs::stat_atime(&st_);
|
||||
times[1] = *fs::stat_mtime(&st_);
|
||||
ts[0] = *fs::stat_atime(&st_);
|
||||
ts[1] = *fs::stat_mtime(&st_);
|
||||
|
||||
return fs::utime(fd_,times);
|
||||
return fs::futimens(fd_,ts);
|
||||
}
|
||||
|
||||
static
|
||||
|
|
|
|||
|
|
@ -292,8 +292,8 @@ namespace fs
|
|||
static
|
||||
inline
|
||||
int
|
||||
utime(const int fd_,
|
||||
const struct timespec ts_[2])
|
||||
futimens(const int fd_,
|
||||
const struct timespec ts_[2])
|
||||
{
|
||||
int rv;
|
||||
struct timeval tv[2];
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ namespace fs
|
|||
static
|
||||
inline
|
||||
int
|
||||
utime(const int fd,
|
||||
const struct timespec times[2])
|
||||
futimens(const int fd_,
|
||||
const struct timespec ts_[2])
|
||||
{
|
||||
return ::futimens(fd,times);
|
||||
return ::futimens(fd_,ts_);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
#include "fs_base_chown.hpp"
|
||||
#include "fs_base_fadvise.hpp"
|
||||
#include "fs_base_fallocate.hpp"
|
||||
#include "fs_base_fchmod.hpp"
|
||||
#include "fs_base_fchown.hpp"
|
||||
#include "fs_base_ftruncate.hpp"
|
||||
#include "fs_base_stat.hpp"
|
||||
#include "fs_base_utime.hpp"
|
||||
|
|
@ -109,7 +111,7 @@ namespace fs
|
|||
if(rv == -1)
|
||||
return -1;
|
||||
|
||||
rv = fs::utime(dst_fd_,src_st);
|
||||
rv = fs::futime(dst_fd_,src_st);
|
||||
if(rv == -1)
|
||||
return -1;
|
||||
|
||||
|
|
|
|||
52
src/fuse_fchmod.cpp
Normal file
52
src/fuse_fchmod.cpp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "errno.hpp"
|
||||
#include "fileinfo.hpp"
|
||||
#include "fs_base_fchmod.hpp"
|
||||
|
||||
#include <fuse.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
namespace l
|
||||
{
|
||||
static
|
||||
int
|
||||
fchmod(const int fd_,
|
||||
const mode_t mode_)
|
||||
{
|
||||
int rv;
|
||||
|
||||
rv = fs::fchmod(fd_,mode_);
|
||||
if(rv == -1)
|
||||
return -errno;
|
||||
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
fchmod(const struct fuse_file_info *ffi_,
|
||||
const mode_t mode_)
|
||||
{
|
||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
||||
|
||||
return l::fchmod(fi->fd,mode_);
|
||||
}
|
||||
}
|
||||
28
src/fuse_fchmod.hpp
Normal file
28
src/fuse_fchmod.hpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
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 <fuse.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
fchmod(const struct fuse_file_info *ffi_,
|
||||
const mode_t mode_);
|
||||
}
|
||||
54
src/fuse_fchown.cpp
Normal file
54
src/fuse_fchown.cpp
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "errno.hpp"
|
||||
#include "fileinfo.hpp"
|
||||
#include "fs_base_fchown.hpp"
|
||||
|
||||
#include <fuse.h>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
namespace l
|
||||
{
|
||||
static
|
||||
int
|
||||
fchown(const int fd_,
|
||||
const uid_t uid_,
|
||||
const gid_t gid_)
|
||||
{
|
||||
int rv;
|
||||
|
||||
rv = fs::fchown(fd_,uid_,gid_);
|
||||
if(rv == -1)
|
||||
return -errno;
|
||||
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
fchown(const struct fuse_file_info *ffi_,
|
||||
const uid_t uid_,
|
||||
const gid_t gid_)
|
||||
{
|
||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
||||
|
||||
return l::fchown(fi->fd,uid_,gid_);
|
||||
}
|
||||
}
|
||||
27
src/fuse_fchown.hpp
Normal file
27
src/fuse_fchown.hpp
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
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 <fuse.h>
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
fchown(const struct fuse_file_info *ffi_,
|
||||
uid_t uid_,
|
||||
gid_t gid_);
|
||||
}
|
||||
37
src/fuse_free_hide.cpp
Normal file
37
src/fuse_free_hide.cpp
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "fileinfo.hpp"
|
||||
#include "fs_base_close.hpp"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
free_hide(const uint64_t fh_)
|
||||
{
|
||||
FileInfo *fi = reinterpret_cast<FileInfo*>(fh_);
|
||||
|
||||
fs::close(fi->fd);
|
||||
|
||||
delete fi;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
27
src/fuse_free_hide.hpp
Normal file
27
src/fuse_free_hide.hpp
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
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 <stdint.h>
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
free_hide(const uint64_t fh_);
|
||||
}
|
||||
52
src/fuse_futimens.cpp
Normal file
52
src/fuse_futimens.cpp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "errno.hpp"
|
||||
#include "fileinfo.hpp"
|
||||
#include "fs_base_utime.hpp"
|
||||
|
||||
#include <fuse.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
namespace l
|
||||
{
|
||||
static
|
||||
int
|
||||
futimens(const int fd_,
|
||||
const struct timespec ts_[2])
|
||||
{
|
||||
int rv;
|
||||
|
||||
rv = fs::futimens(fd_,ts_);
|
||||
if(rv == -1)
|
||||
return -errno;
|
||||
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
futimens(const struct fuse_file_info *ffi_,
|
||||
const struct timespec ts_[2])
|
||||
{
|
||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
|
||||
|
||||
return l::futimens(fi->fd,ts_);
|
||||
}
|
||||
}
|
||||
28
src/fuse_futimens.hpp
Normal file
28
src/fuse_futimens.hpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
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 <fuse.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
futimens(const struct fuse_file_info *ffi_,
|
||||
const timespec ts_[2]);
|
||||
}
|
||||
44
src/fuse_prepare_hide.cpp
Normal file
44
src/fuse_prepare_hide.cpp
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "fuse_open.hpp"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
prepare_hide(const char *fusepath_,
|
||||
uint64_t *fh_,
|
||||
int type_)
|
||||
{
|
||||
int rv;
|
||||
struct fuse_file_info ffi = {0};
|
||||
|
||||
ffi.flags = O_RDONLY|O_NOFOLLOW;
|
||||
rv = FUSE::open(fusepath_,&ffi);
|
||||
if(rv < 0)
|
||||
return rv;
|
||||
|
||||
*fh_ = ffi.fh;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
29
src/fuse_prepare_hide.hpp
Normal file
29
src/fuse_prepare_hide.hpp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
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 <stdint.h>
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
prepare_hide(const char *name_,
|
||||
uint64_t *fh_,
|
||||
int type_);
|
||||
}
|
||||
|
|
@ -25,12 +25,16 @@
|
|||
#include "fuse_create.hpp"
|
||||
#include "fuse_destroy.hpp"
|
||||
#include "fuse_fallocate.hpp"
|
||||
#include "fuse_fchmod.hpp"
|
||||
#include "fuse_fchown.hpp"
|
||||
#include "fuse_fgetattr.hpp"
|
||||
#include "fuse_flock.hpp"
|
||||
#include "fuse_flush.hpp"
|
||||
#include "fuse_free_hide.hpp"
|
||||
#include "fuse_fsync.hpp"
|
||||
#include "fuse_fsyncdir.hpp"
|
||||
#include "fuse_ftruncate.hpp"
|
||||
#include "fuse_futimens.hpp"
|
||||
#include "fuse_getattr.hpp"
|
||||
#include "fuse_getxattr.hpp"
|
||||
#include "fuse_init.hpp"
|
||||
|
|
@ -41,6 +45,7 @@
|
|||
#include "fuse_mknod.hpp"
|
||||
#include "fuse_open.hpp"
|
||||
#include "fuse_opendir.hpp"
|
||||
#include "fuse_prepare_hide.hpp"
|
||||
#include "fuse_read.hpp"
|
||||
#include "fuse_read_buf.hpp"
|
||||
#include "fuse_readdir.hpp"
|
||||
|
|
@ -77,6 +82,12 @@ namespace l
|
|||
ops.flag_nopath = true;
|
||||
ops.flag_utime_omit_ok = true;
|
||||
|
||||
ops.prepare_hide = FUSE::prepare_hide;
|
||||
ops.free_hide = FUSE::free_hide;
|
||||
ops.fchown = FUSE::fchown;
|
||||
ops.fchmod = FUSE::fchmod;
|
||||
ops.futimens = FUSE::futimens;
|
||||
|
||||
ops.access = FUSE::access;
|
||||
ops.bmap = NULL;
|
||||
ops.chmod = FUSE::chmod;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue