diff options
author | Bryant Mairs <bryant@mai.rs> | 2017-08-09 22:29:23 -0700 |
---|---|---|
committer | Bryant Mairs <bryant@mai.rs> | 2017-08-16 19:36:51 -0700 |
commit | 5515a5cc6e46b1046cad414b27aa1edfcbde4f9d (patch) | |
tree | 59ce2b4171cde21ef3d31bb66eb74080f7608bf5 /src/sys | |
parent | 26c9e1a0e3f3c248929d537d9af0d10740db77d3 (diff) | |
download | nix-5515a5cc6e46b1046cad414b27aa1edfcbde4f9d.zip |
Use libc::quotactl
Diffstat (limited to 'src/sys')
-rw-r--r-- | src/sys/quota.rs | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/sys/quota.rs b/src/sys/quota.rs index 5990aae5..635af407 100644 --- a/src/sys/quota.rs +++ b/src/sys/quota.rs @@ -1,5 +1,5 @@ use {Errno, Result, NixPath}; -use libc::{c_int, c_char}; +use libc::{self, c_int, c_char}; #[cfg(all(target_os = "linux", any(target_arch = "x86", @@ -70,14 +70,6 @@ pub mod quota { } } -mod ffi { - use libc::{c_int, c_char}; - - extern { - pub fn quotactl(cmd: c_int, special: * const c_char, id: c_int, data: *mut c_char) -> c_int; - } -} - use std::ptr; fn quotactl<P: ?Sized + NixPath>(cmd: quota::QuotaCmd, special: Option<&P>, id: c_int, addr: *mut c_char) -> Result<()> { @@ -85,8 +77,8 @@ fn quotactl<P: ?Sized + NixPath>(cmd: quota::QuotaCmd, special: Option<&P>, id: Errno::clear(); let res = try!( match special { - Some(dev) => dev.with_nix_path(|path| ffi::quotactl(cmd.as_int(), path.as_ptr(), id, addr)), - None => Ok(ffi::quotactl(cmd.as_int(), ptr::null(), id, addr)), + Some(dev) => dev.with_nix_path(|path| libc::quotactl(cmd.as_int(), path.as_ptr(), id, addr)), + None => Ok(libc::quotactl(cmd.as_int(), ptr::null(), id, addr)), } ); |