Merge branch 'cleanup-sysstatvfs' into 'master'
Cleanup sysstatvfs See merge request redox-os/relibc!743
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
//! statvfs implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/sysstatvfs.h.html
|
||||
//! `sys_statvfs.h` implementation.
|
||||
//!
|
||||
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_statvfs.h.html>.
|
||||
|
||||
use crate::{
|
||||
c_str::CStr,
|
||||
error::ResultExt,
|
||||
header::fcntl::O_PATH,
|
||||
out::Out,
|
||||
platform::{Pal, Sys, types::*},
|
||||
platform::{
|
||||
Pal, Sys,
|
||||
types::{c_char, c_int, c_ulong, fsblkcnt_t, fsfilcnt_t},
|
||||
},
|
||||
};
|
||||
|
||||
//pub const ST_RDONLY
|
||||
@@ -27,12 +32,14 @@ pub struct statvfs {
|
||||
pub f_namemax: c_ulong,
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fstatvfs.html>.
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn fstatvfs(fildes: c_int, buf: *mut statvfs) -> c_int {
|
||||
let buf = Out::nonnull(buf);
|
||||
Sys::fstatvfs(fildes, buf).map(|()| 0).or_minus_one_errno()
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fstatvfs.html>.
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn statvfs(file: *const c_char, buf: *mut statvfs) -> c_int {
|
||||
let file = CStr::from_ptr(file);
|
||||
|
||||
Reference in New Issue
Block a user