|
@ -376,37 +376,48 @@ namespace fs |
|
|
return setxattrs(to,attrs); |
|
|
return setxattrs(to,attrs); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static |
|
|
int |
|
|
int |
|
|
copyattr(const string &from, |
|
|
|
|
|
const string &to) |
|
|
|
|
|
|
|
|
get_fs_ioc_flags(const string &file, |
|
|
|
|
|
int &flags) |
|
|
{ |
|
|
{ |
|
|
int fd; |
|
|
int fd; |
|
|
int rv; |
|
|
int rv; |
|
|
int flags; |
|
|
|
|
|
int error; |
|
|
|
|
|
const int openflags = O_RDONLY|O_NONBLOCK; |
|
|
const int openflags = O_RDONLY|O_NONBLOCK; |
|
|
|
|
|
|
|
|
fd = ::open(from.c_str(),openflags); |
|
|
|
|
|
|
|
|
fd = ::open(file.c_str(),openflags); |
|
|
if(fd == -1) |
|
|
if(fd == -1) |
|
|
return -1; |
|
|
return -1; |
|
|
|
|
|
|
|
|
rv = ::ioctl(fd,FS_IOC_GETFLAGS,&flags); |
|
|
rv = ::ioctl(fd,FS_IOC_GETFLAGS,&flags); |
|
|
if(rv == -1) |
|
|
if(rv == -1) |
|
|
{ |
|
|
{ |
|
|
error = errno; |
|
|
|
|
|
|
|
|
int error = errno; |
|
|
::close(fd); |
|
|
::close(fd); |
|
|
errno = error; |
|
|
errno = error; |
|
|
return -1; |
|
|
return -1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
fd = ::open(to.c_str(),openflags); |
|
|
|
|
|
|
|
|
return ::close(fd); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static |
|
|
|
|
|
int |
|
|
|
|
|
set_fs_ioc_flags(const string &file, |
|
|
|
|
|
const int flags) |
|
|
|
|
|
{ |
|
|
|
|
|
int fd; |
|
|
|
|
|
int rv; |
|
|
|
|
|
const int openflags = O_RDONLY|O_NONBLOCK; |
|
|
|
|
|
|
|
|
|
|
|
fd = ::open(file.c_str(),openflags); |
|
|
if(fd == -1) |
|
|
if(fd == -1) |
|
|
return -1; |
|
|
return -1; |
|
|
|
|
|
|
|
|
rv = ::ioctl(fd,FS_IOC_SETFLAGS,&flags); |
|
|
rv = ::ioctl(fd,FS_IOC_SETFLAGS,&flags); |
|
|
if(rv == -1) |
|
|
if(rv == -1) |
|
|
{ |
|
|
{ |
|
|
error = errno; |
|
|
|
|
|
|
|
|
int error = errno; |
|
|
::close(fd); |
|
|
::close(fd); |
|
|
errno = error; |
|
|
errno = error; |
|
|
return -1; |
|
|
return -1; |
|
@ -415,6 +426,20 @@ namespace fs |
|
|
return ::close(fd); |
|
|
return ::close(fd); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int |
|
|
|
|
|
copyattr(const string &from, |
|
|
|
|
|
const string &to) |
|
|
|
|
|
{ |
|
|
|
|
|
int rv; |
|
|
|
|
|
int flags; |
|
|
|
|
|
|
|
|
|
|
|
rv = get_fs_ioc_flags(from,flags); |
|
|
|
|
|
if(rv == -1) |
|
|
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
|
|
return set_fs_ioc_flags(to,flags); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
int |
|
|
int |
|
|
clonepath(const string &fromsrc, |
|
|
clonepath(const string &fromsrc, |
|
|
const string &tosrc, |
|
|
const string &tosrc, |
|
|