Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use libc::off_t instead of std::*::off_t #2

Merged
merged 1 commit into from
Feb 6, 2016
Merged
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
5 changes: 2 additions & 3 deletions src/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use std::mem;
use std::os::unix::ffi::OsStrExt;
use std::os::unix::fs::MetadataExt;
use std::os::unix::io::{AsRawFd, FromRawFd};
use std::os::unix::raw::off_t;
use std::path::Path;

pub fn duplicate(file: &File) -> Result<File> {
Expand Down Expand Up @@ -60,7 +59,7 @@ pub fn allocated_size(file: &File) -> Result<u64> {
target_os = "android",
target_os = "nacl"))]
pub fn allocate(file: &File, len: u64) -> Result<()> {
let ret = unsafe { libc::posix_fallocate(file.as_raw_fd(), 0, len as off_t) };
let ret = unsafe { libc::posix_fallocate(file.as_raw_fd(), 0, len as libc::off_t) };
if ret == 0 { Ok(()) } else { Err(Error::last_os_error()) }
}

Expand All @@ -73,7 +72,7 @@ pub fn allocate(file: &File, len: u64) -> Result<()> {
fst_flags: libc::F_ALLOCATECONTIG,
fst_posmode: libc::F_PEOFPOSMODE,
fst_offset: 0,
fst_length: len as off_t,
fst_length: len as libc::off_t,
fst_bytesalloc: 0,
};

Expand Down