Skip to content

Commit 7891640

Browse files
committed
Use libc::quotactl
1 parent d7453e4 commit 7891640

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/sys/quota.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use {Errno, Result, NixPath};
2-
use libc::{c_int, c_char};
2+
use libc::{self, c_int, c_char};
33

44
#[cfg(all(target_os = "linux",
55
any(target_arch = "x86",
@@ -70,23 +70,15 @@ pub mod quota {
7070
}
7171
}
7272

73-
mod ffi {
74-
use libc::{c_int, c_char};
75-
76-
extern {
77-
pub fn quotactl(cmd: c_int, special: * const c_char, id: c_int, data: *mut c_char) -> c_int;
78-
}
79-
}
80-
8173
use std::ptr;
8274

8375
fn quotactl<P: ?Sized + NixPath>(cmd: quota::QuotaCmd, special: Option<&P>, id: c_int, addr: *mut c_char) -> Result<()> {
8476
unsafe {
8577
Errno::clear();
8678
let res = try!(
8779
match special {
88-
Some(dev) => dev.with_nix_path(|path| ffi::quotactl(cmd.as_int(), path.as_ptr(), id, addr)),
89-
None => Ok(ffi::quotactl(cmd.as_int(), ptr::null(), id, addr)),
80+
Some(dev) => dev.with_nix_path(|path| libc::quotactl(cmd.as_int(), path.as_ptr(), id, addr)),
81+
None => Ok(libc::quotactl(cmd.as_int(), ptr::null(), id, addr)),
9082
}
9183
);
9284

0 commit comments

Comments
 (0)