mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-03-15 02:35:12 +08:00
passthrough ioctl args without processing. closes #90
This commit is contained in:
parent
416cb4a084
commit
52d80299b5
@ -43,43 +43,25 @@ static
|
|||||||
int
|
int
|
||||||
_ioctl(const int fd,
|
_ioctl(const int fd,
|
||||||
const int cmd,
|
const int cmd,
|
||||||
void *arg,
|
|
||||||
const unsigned int flags,
|
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
switch(cmd)
|
|
||||||
{
|
|
||||||
#ifdef FS_IOC_GETFLAGS
|
|
||||||
case FS_IOC_GETFLAGS:
|
|
||||||
case FS_IOC_SETFLAGS:
|
|
||||||
#endif
|
|
||||||
#ifdef FS_IOC32_GETFLAGS
|
|
||||||
case FS_IOC32_SETFLAGS:
|
|
||||||
case FS_IOC32_GETFLAGS:
|
|
||||||
#endif
|
|
||||||
#ifdef FS_IOC_GETVERSION
|
|
||||||
case FS_IOC_GETVERSION:
|
|
||||||
case FS_IOC_SETVERSION:
|
|
||||||
#endif
|
|
||||||
#ifdef FS_IOC32_GETVERSION
|
|
||||||
case FS_IOC32_GETVERSION:
|
|
||||||
case FS_IOC32_SETVERSION:
|
|
||||||
#endif
|
|
||||||
rv = ::ioctl(fd,cmd,data);
|
rv = ::ioctl(fd,cmd,data);
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
rv = -1;
|
|
||||||
errno = ENOTTY;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ((rv == -1) ? -errno : rv);
|
return ((rv == -1) ? -errno : rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FUSE_IOCTL_DIR
|
#ifdef FUSE_IOCTL_DIR
|
||||||
|
|
||||||
|
#ifndef O_DIRECTORY
|
||||||
|
#define O_DIRECTORY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef O_NOATIME
|
||||||
|
#define O_NOATIME 0
|
||||||
|
#endif
|
||||||
|
|
||||||
static
|
static
|
||||||
int
|
int
|
||||||
_ioctl_dir_base(Policy::Func::Search searchFunc,
|
_ioctl_dir_base(Policy::Func::Search searchFunc,
|
||||||
@ -87,8 +69,6 @@ _ioctl_dir_base(Policy::Func::Search searchFunc,
|
|||||||
const size_t minfreespace,
|
const size_t minfreespace,
|
||||||
const string &fusepath,
|
const string &fusepath,
|
||||||
const int cmd,
|
const int cmd,
|
||||||
void *arg,
|
|
||||||
const unsigned int flags,
|
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
@ -101,11 +81,11 @@ _ioctl_dir_base(Policy::Func::Search searchFunc,
|
|||||||
|
|
||||||
fs::path::append(path[0],fusepath);
|
fs::path::append(path[0],fusepath);
|
||||||
|
|
||||||
fd = ::open(path[0].c_str(),flags);
|
fd = ::open(path[0].c_str(),O_RDWR|O_NOATIME|O_DIRECTORY);
|
||||||
if(fd == -1)
|
if(fd == -1)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
rv = _ioctl(fd,cmd,arg,flags,data);
|
rv = _ioctl(fd,cmd,data);
|
||||||
|
|
||||||
::close(fd);
|
::close(fd);
|
||||||
|
|
||||||
@ -116,8 +96,6 @@ static
|
|||||||
int
|
int
|
||||||
_ioctl_dir(const string &fusepath,
|
_ioctl_dir(const string &fusepath,
|
||||||
const int cmd,
|
const int cmd,
|
||||||
void *arg,
|
|
||||||
const unsigned int flags,
|
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
const struct fuse_context *fc = fuse_get_context();
|
const struct fuse_context *fc = fuse_get_context();
|
||||||
@ -130,8 +108,6 @@ _ioctl_dir(const string &fusepath,
|
|||||||
config.minfreespace,
|
config.minfreespace,
|
||||||
fusepath,
|
fusepath,
|
||||||
cmd,
|
cmd,
|
||||||
arg,
|
|
||||||
flags,
|
|
||||||
data);
|
data);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -152,15 +128,11 @@ namespace mergerfs
|
|||||||
if(flags & FUSE_IOCTL_DIR)
|
if(flags & FUSE_IOCTL_DIR)
|
||||||
return _ioctl_dir(fusepath,
|
return _ioctl_dir(fusepath,
|
||||||
cmd,
|
cmd,
|
||||||
arg,
|
|
||||||
flags,
|
|
||||||
data);
|
data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return _ioctl(ffi->fh,
|
return _ioctl(ffi->fh,
|
||||||
cmd,
|
cmd,
|
||||||
arg,
|
|
||||||
flags,
|
|
||||||
data);
|
data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user