Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/file_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ fn test_bit(mode: u32, flag: u32) -> bool {
(mode & libc::S_IFMT) == flag
}

fn is_file_or_blk_(info: &libc::stat64) -> bool {
fn is_file_or_blk_(info: &libc::stat) -> bool {
test_bit(info.st_mode, libc::S_IFBLK) || test_bit(info.st_mode, libc::S_IFREG)
}

// wrapper of libc::stat64
fn libc_stat64(path: &Path) -> io::Result<libc::stat64> {
fn libc_stat64(path: &Path) -> io::Result<libc::stat> {
let c_path = std::ffi::CString::new(path.as_os_str().as_bytes())
.map_err(|e| io::Error::new(io::ErrorKind::InvalidInput, e.to_string()))?;

unsafe {
let mut st: libc::stat64 = std::mem::zeroed();
let r = libc::stat64(c_path.as_ptr(), &mut st);
let mut st: libc::stat = std::mem::zeroed();
let r = libc::stat(c_path.as_ptr(), &mut st);
if r == 0 {
Ok(st)
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/io_engine/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub trait VectoredIo {

fn read_vectored_at(file: &File, bufs: &mut [libc::iovec], pos: u64) -> io::Result<usize> {
let ptr = bufs.as_ptr();
let ret = match unsafe { libc::preadv64(file.as_raw_fd(), ptr, bufs.len() as i32, pos as i64) }
let ret = match unsafe { libc::preadv(file.as_raw_fd(), ptr, bufs.len() as i32, pos as i64) }
{
-1 => return Err(io::Error::last_os_error()),
n => n,
Expand All @@ -125,7 +125,7 @@ fn read_vectored_at(file: &File, bufs: &mut [libc::iovec], pos: u64) -> io::Resu

fn write_vectored_at(file: &File, bufs: &[libc::iovec], pos: u64) -> io::Result<usize> {
let ptr = bufs.as_ptr();
let ret = match unsafe { libc::pwritev64(file.as_raw_fd(), ptr, bufs.len() as i32, pos as i64) }
let ret = match unsafe { libc::pwritev(file.as_raw_fd(), ptr, bufs.len() as i32, pos as i64) }
{
-1 => return Err(io::Error::last_os_error()),
n => n,
Expand Down