mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-02-23 07:35:41 +08:00
Merge pull request #402 from trapexit/nopath
enable nopath and nullpath_ok
This commit is contained in:
commit
f95b07f83b
@ -77,6 +77,16 @@ namespace mergerfs
|
|||||||
const std::string controlfile;
|
const std::string controlfile;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static
|
||||||
|
const
|
||||||
|
Config &
|
||||||
|
get(void)
|
||||||
|
{
|
||||||
|
const fuse_context *fc = fuse_get_context();
|
||||||
|
|
||||||
|
return get(fc);
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
const Config &
|
const Config &
|
||||||
get(const fuse_context *fc)
|
get(const fuse_context *fc)
|
||||||
|
@ -75,7 +75,7 @@ _create_core(const string &existingpath,
|
|||||||
if(rv == -1)
|
if(rv == -1)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
fh = reinterpret_cast<uint64_t>(new FileInfo(rv));
|
fh = reinterpret_cast<uint64_t>(new FileInfo(rv,fusepath));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
34
src/dirinfo.hpp
Normal file
34
src/dirinfo.hpp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
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 __DIRINFO_HPP__
|
||||||
|
#define __DIRINFO_HPP__
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class DirInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DirInfo(const char *fusepath_)
|
||||||
|
: fusepath(fusepath_)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
std::string fusepath;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -48,7 +48,7 @@ namespace mergerfs
|
|||||||
{
|
{
|
||||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi->fh);
|
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi->fh);
|
||||||
|
|
||||||
return _fgetattr(fi->fd,*st);
|
return ::_fgetattr(fi->fd,*st);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,16 +17,21 @@
|
|||||||
#ifndef __FILEINFO_HPP__
|
#ifndef __FILEINFO_HPP__
|
||||||
#define __FILEINFO_HPP__
|
#define __FILEINFO_HPP__
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class FileInfo
|
class FileInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FileInfo(int _fd) :
|
FileInfo(const int fd_,
|
||||||
fd(_fd)
|
const char *fusepath_)
|
||||||
|
: fd(fd_),
|
||||||
|
fusepath(fusepath_)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int fd;
|
int fd;
|
||||||
|
std::string fusepath;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -46,7 +46,7 @@ namespace mergerfs
|
|||||||
{
|
{
|
||||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi->fh);
|
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi->fh);
|
||||||
|
|
||||||
return _flush(fi->fd);
|
return ::_flush(fi->fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,10 @@
|
|||||||
#ifndef __FS_BASE_FSYNC_HPP__
|
#ifndef __FS_BASE_FSYNC_HPP__
|
||||||
#define __FS_BASE_FSYNC_HPP__
|
#define __FS_BASE_FSYNC_HPP__
|
||||||
|
|
||||||
|
#ifndef _GNU_SOURCE
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "errno.hpp"
|
#include "errno.hpp"
|
||||||
|
@ -26,9 +26,9 @@ namespace fs
|
|||||||
static
|
static
|
||||||
inline
|
inline
|
||||||
int
|
int
|
||||||
ioctl(const int fd,
|
ioctl(const int fd,
|
||||||
const int request,
|
const unsigned long request,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
return ::ioctl(fd,request,data);
|
return ::ioctl(fd,request,data);
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,6 @@
|
|||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _GNU_SOURCE
|
|
||||||
#define _GNU_SOURCE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <fuse.h>
|
#include <fuse.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -52,8 +48,7 @@ namespace mergerfs
|
|||||||
{
|
{
|
||||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi->fh);
|
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi->fh);
|
||||||
|
|
||||||
return _fsync(fi->fd,
|
return ::_fsync(fi->fd,isdatasync);
|
||||||
isdatasync);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
53
src/fsyncdir.cpp
Normal file
53
src/fsyncdir.cpp
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
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 <fuse.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#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<DirInfo*>(ffi->fh);
|
||||||
|
|
||||||
|
return ::_fsyncdir(di,isdatasync);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
33
src/fsyncdir.hpp
Normal file
33
src/fsyncdir.hpp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
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 __FSYNCDIR_HPP__
|
||||||
|
#define __FSYNCDIR_HPP__
|
||||||
|
|
||||||
|
#include <fuse.h>
|
||||||
|
|
||||||
|
namespace mergerfs
|
||||||
|
{
|
||||||
|
namespace fuse
|
||||||
|
{
|
||||||
|
int
|
||||||
|
fsyncdir(const char *fusepath,
|
||||||
|
int isdatasync,
|
||||||
|
fuse_file_info *ffi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -43,8 +43,7 @@ namespace mergerfs
|
|||||||
{
|
{
|
||||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi->fh);
|
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi->fh);
|
||||||
|
|
||||||
return _ftruncate(fi->fd,
|
return ::_ftruncate(fi->fd,size);
|
||||||
size);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
|
#include "dirinfo.hpp"
|
||||||
#include "errno.hpp"
|
#include "errno.hpp"
|
||||||
#include "fileinfo.hpp"
|
#include "fileinfo.hpp"
|
||||||
#include "fs_base_close.hpp"
|
#include "fs_base_close.hpp"
|
||||||
@ -37,9 +38,9 @@ using namespace mergerfs;
|
|||||||
|
|
||||||
static
|
static
|
||||||
int
|
int
|
||||||
_ioctl(const int fd,
|
_ioctl(const int fd,
|
||||||
const int cmd,
|
const unsigned long cmd,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
@ -48,6 +49,17 @@ _ioctl(const int fd,
|
|||||||
return ((rv == -1) ? -errno : rv);
|
return ((rv == -1) ? -errno : rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
int
|
||||||
|
_ioctl_file(fuse_file_info *ffi,
|
||||||
|
const unsigned long cmd,
|
||||||
|
void *data)
|
||||||
|
{
|
||||||
|
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi->fh);
|
||||||
|
|
||||||
|
return _ioctl(fi->fd,cmd,data);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef FUSE_IOCTL_DIR
|
#ifdef FUSE_IOCTL_DIR
|
||||||
|
|
||||||
#ifndef O_NOATIME
|
#ifndef O_NOATIME
|
||||||
@ -60,7 +72,7 @@ _ioctl_dir_base(Policy::Func::Search searchFunc,
|
|||||||
const vector<string> &srcmounts,
|
const vector<string> &srcmounts,
|
||||||
const uint64_t minfreespace,
|
const uint64_t minfreespace,
|
||||||
const char *fusepath,
|
const char *fusepath,
|
||||||
const int cmd,
|
const unsigned long cmd,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
@ -88,10 +100,11 @@ _ioctl_dir_base(Policy::Func::Search searchFunc,
|
|||||||
|
|
||||||
static
|
static
|
||||||
int
|
int
|
||||||
_ioctl_dir(const char *fusepath,
|
_ioctl_dir(fuse_file_info *ffi,
|
||||||
const int cmd,
|
const unsigned long cmd,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
|
DirInfo *di = reinterpret_cast<DirInfo*>(ffi->fh);
|
||||||
const fuse_context *fc = fuse_get_context();
|
const fuse_context *fc = fuse_get_context();
|
||||||
const Config &config = Config::get(fc);
|
const Config &config = Config::get(fc);
|
||||||
const ugid::Set ugid(fc->uid,fc->gid);
|
const ugid::Set ugid(fc->uid,fc->gid);
|
||||||
@ -100,7 +113,7 @@ _ioctl_dir(const char *fusepath,
|
|||||||
return _ioctl_dir_base(config.getattr,
|
return _ioctl_dir_base(config.getattr,
|
||||||
config.srcmounts,
|
config.srcmounts,
|
||||||
config.minfreespace,
|
config.minfreespace,
|
||||||
fusepath,
|
di->fusepath.c_str(),
|
||||||
cmd,
|
cmd,
|
||||||
data);
|
data);
|
||||||
}
|
}
|
||||||
@ -120,15 +133,10 @@ namespace mergerfs
|
|||||||
{
|
{
|
||||||
#ifdef FUSE_IOCTL_DIR
|
#ifdef FUSE_IOCTL_DIR
|
||||||
if(flags & FUSE_IOCTL_DIR)
|
if(flags & FUSE_IOCTL_DIR)
|
||||||
return _ioctl_dir(fusepath,
|
return ::_ioctl_dir(ffi,cmd,data);
|
||||||
cmd,
|
|
||||||
data);
|
|
||||||
#endif
|
#endif
|
||||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi->fh);
|
|
||||||
|
|
||||||
return _ioctl(fi->fd,
|
return ::_ioctl_file(ffi,cmd,data);
|
||||||
cmd,
|
|
||||||
data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "flock.hpp"
|
#include "flock.hpp"
|
||||||
#include "flush.hpp"
|
#include "flush.hpp"
|
||||||
#include "fsync.hpp"
|
#include "fsync.hpp"
|
||||||
|
#include "fsyncdir.hpp"
|
||||||
#include "ftruncate.hpp"
|
#include "ftruncate.hpp"
|
||||||
#include "getattr.hpp"
|
#include "getattr.hpp"
|
||||||
#include "getxattr.hpp"
|
#include "getxattr.hpp"
|
||||||
@ -71,9 +72,9 @@ namespace local
|
|||||||
get_fuse_operations(struct fuse_operations &ops,
|
get_fuse_operations(struct fuse_operations &ops,
|
||||||
const bool direct_io)
|
const bool direct_io)
|
||||||
{
|
{
|
||||||
ops.flag_nullpath_ok = false;
|
ops.flag_nullpath_ok = true;
|
||||||
#if FLAG_NOPATH
|
#if FLAG_NOPATH
|
||||||
ops.flag_nopath = false;
|
ops.flag_nopath = true;
|
||||||
#endif
|
#endif
|
||||||
#if FLAG_UTIME
|
#if FLAG_UTIME
|
||||||
ops.flag_utime_omit_ok = true;
|
ops.flag_utime_omit_ok = true;
|
||||||
@ -94,7 +95,7 @@ namespace local
|
|||||||
#endif
|
#endif
|
||||||
ops.flush = mergerfs::fuse::flush;
|
ops.flush = mergerfs::fuse::flush;
|
||||||
ops.fsync = mergerfs::fuse::fsync;
|
ops.fsync = mergerfs::fuse::fsync;
|
||||||
ops.fsyncdir = NULL;
|
ops.fsyncdir = mergerfs::fuse::fsyncdir;
|
||||||
ops.ftruncate = mergerfs::fuse::ftruncate;
|
ops.ftruncate = mergerfs::fuse::ftruncate;
|
||||||
ops.getattr = mergerfs::fuse::getattr;
|
ops.getattr = mergerfs::fuse::getattr;
|
||||||
ops.getdir = NULL; /* deprecated; use readdir */
|
ops.getdir = NULL; /* deprecated; use readdir */
|
||||||
|
@ -49,7 +49,7 @@ _open_core(const string *basepath,
|
|||||||
if(fd == -1)
|
if(fd == -1)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
fh = reinterpret_cast<uint64_t>(new FileInfo(fd));
|
fh = reinterpret_cast<uint64_t>(new FileInfo(fd,fusepath));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
#include <fuse.h>
|
#include <fuse.h>
|
||||||
|
|
||||||
|
#include "dirinfo.hpp"
|
||||||
|
|
||||||
namespace mergerfs
|
namespace mergerfs
|
||||||
{
|
{
|
||||||
namespace fuse
|
namespace fuse
|
||||||
@ -24,7 +26,7 @@ namespace mergerfs
|
|||||||
opendir(const char *fusepath,
|
opendir(const char *fusepath,
|
||||||
fuse_file_info *ffi)
|
fuse_file_info *ffi)
|
||||||
{
|
{
|
||||||
ffi->fh = 0;
|
ffi->fh = reinterpret_cast<uint64_t>(new DirInfo(fusepath));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ namespace mergerfs
|
|||||||
{
|
{
|
||||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi->fh);
|
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi->fh);
|
||||||
|
|
||||||
return _read(fi->fd,buf,count,offset);
|
return ::_read(fi->fd,buf,count,offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -85,7 +85,7 @@ namespace mergerfs
|
|||||||
{
|
{
|
||||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi->fh);
|
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi->fh);
|
||||||
|
|
||||||
return _read_direct_io(fi->fd,buf,count,offset);
|
return ::_read_direct_io(fi->fd,buf,count,offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
|
#include "dirinfo.hpp"
|
||||||
#include "errno.hpp"
|
#include "errno.hpp"
|
||||||
#include "fs_base_closedir.hpp"
|
#include "fs_base_closedir.hpp"
|
||||||
#include "fs_base_dirfd.hpp"
|
#include "fs_base_dirfd.hpp"
|
||||||
@ -39,7 +40,6 @@
|
|||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::pair;
|
|
||||||
|
|
||||||
#define NO_OFFSET 0
|
#define NO_OFFSET 0
|
||||||
|
|
||||||
@ -103,17 +103,18 @@ namespace mergerfs
|
|||||||
void *buf,
|
void *buf,
|
||||||
fuse_fill_dir_t filler,
|
fuse_fill_dir_t filler,
|
||||||
off_t offset,
|
off_t offset,
|
||||||
fuse_file_info *fi)
|
fuse_file_info *ffi)
|
||||||
{
|
{
|
||||||
|
DirInfo *di = reinterpret_cast<DirInfo*>(ffi->fh);
|
||||||
const fuse_context *fc = fuse_get_context();
|
const fuse_context *fc = fuse_get_context();
|
||||||
const Config &config = Config::get(fc);
|
const Config &config = Config::get(fc);
|
||||||
const ugid::Set ugid(fc->uid,fc->gid);
|
const ugid::Set ugid(fc->uid,fc->gid);
|
||||||
const rwlock::ReadGuard readlock(&config.srcmountslock);
|
const rwlock::ReadGuard readlock(&config.srcmountslock);
|
||||||
|
|
||||||
return _readdir(config.srcmounts,
|
return ::_readdir(config.srcmounts,
|
||||||
fusepath,
|
di->fusepath.c_str(),
|
||||||
buf,
|
buf,
|
||||||
filler);
|
filler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,9 +52,8 @@ namespace mergerfs
|
|||||||
release(const char *fusepath,
|
release(const char *fusepath,
|
||||||
fuse_file_info *ffi)
|
fuse_file_info *ffi)
|
||||||
{
|
{
|
||||||
const fuse_context *fc = fuse_get_context();
|
const Config &config = Config::get();
|
||||||
const Config &config = Config::get(fc);
|
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi->fh);
|
||||||
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi->fh);
|
|
||||||
|
|
||||||
return _release(fi,config.dropcacheonclose);
|
return _release(fi,config.dropcacheonclose);
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,17 @@
|
|||||||
|
|
||||||
#include <fuse.h>
|
#include <fuse.h>
|
||||||
|
|
||||||
|
#include "dirinfo.hpp"
|
||||||
|
|
||||||
|
static
|
||||||
|
int
|
||||||
|
_releasedir(DirInfo *di)
|
||||||
|
{
|
||||||
|
delete di;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
namespace mergerfs
|
namespace mergerfs
|
||||||
{
|
{
|
||||||
namespace fuse
|
namespace fuse
|
||||||
@ -24,7 +35,9 @@ namespace mergerfs
|
|||||||
releasedir(const char *fusepath,
|
releasedir(const char *fusepath,
|
||||||
fuse_file_info *ffi)
|
fuse_file_info *ffi)
|
||||||
{
|
{
|
||||||
return 0;
|
DirInfo *di = reinterpret_cast<DirInfo*>(ffi->fh);
|
||||||
|
|
||||||
|
return ::_releasedir(di);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,9 +72,6 @@ _write_direct_io(const int fd,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace mergerfs
|
namespace mergerfs
|
||||||
{
|
{
|
||||||
namespace fuse
|
namespace fuse
|
||||||
@ -83,7 +80,6 @@ namespace mergerfs
|
|||||||
inline
|
inline
|
||||||
int
|
int
|
||||||
write(WriteFunc func,
|
write(WriteFunc func,
|
||||||
const char *fusepath,
|
|
||||||
const char *buf,
|
const char *buf,
|
||||||
const size_t count,
|
const size_t count,
|
||||||
const off_t offset,
|
const off_t offset,
|
||||||
@ -103,7 +99,7 @@ namespace mergerfs
|
|||||||
const ugid::Set ugid(0,0);
|
const ugid::Set ugid(0,0);
|
||||||
const rwlock::ReadGuard readlock(&config.srcmountslock);
|
const rwlock::ReadGuard readlock(&config.srcmountslock);
|
||||||
|
|
||||||
rv = fs::movefile(config.srcmounts,fusepath,count,fi->fd);
|
rv = fs::movefile(config.srcmounts,fi->fusepath,count,fi->fd);
|
||||||
if(rv == -1)
|
if(rv == -1)
|
||||||
return -ENOSPC;
|
return -ENOSPC;
|
||||||
|
|
||||||
@ -121,7 +117,7 @@ namespace mergerfs
|
|||||||
off_t offset,
|
off_t offset,
|
||||||
fuse_file_info *ffi)
|
fuse_file_info *ffi)
|
||||||
{
|
{
|
||||||
return write(_write,fusepath,buf,count,offset,ffi);
|
return write(_write,buf,count,offset,ffi);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -131,7 +127,7 @@ namespace mergerfs
|
|||||||
off_t offset,
|
off_t offset,
|
||||||
fuse_file_info *ffi)
|
fuse_file_info *ffi)
|
||||||
{
|
{
|
||||||
return write(_write_direct_io,fusepath,buf,count,offset,ffi);
|
return write(_write_direct_io,buf,count,offset,ffi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user