src/pxar/encoder.rs: refactoring: use ioctl calls from src/tools/fs.rs instead of local

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2019-06-06 12:28:25 +02:00 committed by Dietmar Maurer
parent 9b77388f2a
commit 1f319e766e
1 changed files with 2 additions and 12 deletions

View File

@ -187,7 +187,7 @@ impl <'a, W: Write> Encoder<'a, W> {
let mut attr: usize = 0; let mut attr: usize = 0;
let res = unsafe { read_attr_fd(fd, &mut attr)}; let res = unsafe { fs::read_attr_fd(fd, &mut attr)};
if let Err(err) = res { if let Err(err) = res {
if let nix::Error::Sys(errno) = err { if let nix::Error::Sys(errno) = err {
if errno_is_unsupported(errno) { return Ok(()) }; if errno_is_unsupported(errno) { return Ok(()) };
@ -207,7 +207,7 @@ impl <'a, W: Write> Encoder<'a, W> {
let mut attr: u32 = 0; let mut attr: u32 = 0;
let res = unsafe { read_fat_attr_fd(fd, &mut attr)}; let res = unsafe { fs::read_fat_attr_fd(fd, &mut attr)};
if let Err(err) = res { if let Err(err) = res {
if let nix::Error::Sys(errno) = err { if let nix::Error::Sys(errno) = err {
if errno_is_unsupported(errno) { return Ok(()) }; if errno_is_unsupported(errno) { return Ok(()) };
@ -933,16 +933,6 @@ fn detect_fs_type(fd: RawFd) -> Result<i64, Error> {
Ok(fs_stat.f_type) Ok(fs_stat.f_type)
} }
use nix::{convert_ioctl_res, request_code_read, ioc};
// /usr/include/linux/fs.h: #define FS_IOC_GETFLAGS _IOR('f', 1, long)
// read Linux file system attributes (see man chattr)
nix::ioctl_read!(read_attr_fd, b'f', 1, usize);
// /usr/include/linux/msdos_fs.h: #define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32)
// read FAT file system attributes
nix::ioctl_read!(read_fat_attr_fd, b'r', 0x10, u32);
// from /usr/include/linux/magic.h // from /usr/include/linux/magic.h
// and from casync util.h // and from casync util.h