mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-12-04 22:00:15 -05:00
Rework of runtime interface (#1498)
Also have special error handling for when branches are invalid and ENOENT would be returned for getattr and readdir so users understand what is going on and the runtime interface can still be used to fix the problem.
This commit is contained in:
parent
e87867cd2a
commit
2b500f194a
37 changed files with 3376 additions and 822 deletions
|
|
@ -36,8 +36,8 @@ _get_fs_ioc_flags(const int fd,
|
|||
int rv;
|
||||
|
||||
rv = fs::ioctl(fd,FS_IOC_GETFLAGS,(void*)&flags);
|
||||
if((rv == -1) && (errno == EINVAL))
|
||||
errno = ENOTSUP;
|
||||
if(rv == -EINVAL)
|
||||
rv = ENOTSUP;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
@ -53,15 +53,13 @@ _get_fs_ioc_flags(const string &file,
|
|||
|
||||
fd = fs::open(file,openflags);
|
||||
if(fd == -1)
|
||||
return -1;
|
||||
return -errno;
|
||||
|
||||
rv = ::_get_fs_ioc_flags(fd,flags);
|
||||
if(rv == -1)
|
||||
if(rv < 0)
|
||||
{
|
||||
int error = errno;
|
||||
fs::close(fd);
|
||||
errno = error;
|
||||
return -1;
|
||||
return rv;
|
||||
}
|
||||
|
||||
return fs::close(fd);
|
||||
|
|
@ -75,8 +73,8 @@ _set_fs_ioc_flags(const int fd,
|
|||
int rv;
|
||||
|
||||
rv = fs::ioctl(fd,FS_IOC_SETFLAGS,(void*)&flags);
|
||||
if((rv == -1) && (errno == EINVAL))
|
||||
errno = ENOTSUP;
|
||||
if(rv == -EINVAL)
|
||||
rv = ENOTSUP;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
@ -92,15 +90,13 @@ _set_fs_ioc_flags(const string &file,
|
|||
|
||||
fd = fs::open(file,openflags);
|
||||
if(fd == -1)
|
||||
return -1;
|
||||
return -errno;
|
||||
|
||||
rv = ::_set_fs_ioc_flags(fd,flags);
|
||||
if(rv == -1)
|
||||
if(rv < 0)
|
||||
{
|
||||
int error = errno;
|
||||
fs::close(fd);
|
||||
errno = error;
|
||||
return -1;
|
||||
return rv;
|
||||
}
|
||||
|
||||
return fs::close(fd);
|
||||
|
|
@ -115,8 +111,8 @@ fs::attr::copy(const int fdin,
|
|||
int flags;
|
||||
|
||||
rv = ::_get_fs_ioc_flags(fdin,flags);
|
||||
if(rv == -1)
|
||||
return -1;
|
||||
if(rv < 0)
|
||||
return rv;
|
||||
|
||||
if(flags_ & FS_ATTR_CLEAR_IMMUTABLE)
|
||||
flags = (flags & ~FS_IMMUTABLE_FL);
|
||||
|
|
@ -132,8 +128,8 @@ fs::attr::copy(const string &from,
|
|||
int flags;
|
||||
|
||||
rv = ::_get_fs_ioc_flags(from,flags);
|
||||
if(rv == -1)
|
||||
return -1;
|
||||
if(rv < 0)
|
||||
return rv;
|
||||
|
||||
return ::_set_fs_ioc_flags(to,flags);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue