Skip to content
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
35 changes: 2 additions & 33 deletions src/uucore/src/lib/features/fsext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,37 +420,6 @@ fn mount_dev_id(mount_dir: &OsStr) -> String {
}
}

#[cfg(any(
target_os = "freebsd",
target_vendor = "apple",
target_os = "netbsd",
target_os = "openbsd"
))]
use libc::c_int;
#[cfg(any(
target_os = "freebsd",
target_vendor = "apple",
target_os = "netbsd",
target_os = "openbsd"
))]
unsafe extern "C" {
#[cfg(all(target_vendor = "apple", target_arch = "x86_64"))]
#[link_name = "getmntinfo$INODE64"]
fn get_mount_info(mount_buffer_p: *mut *mut StatFs, flags: c_int) -> c_int;

#[cfg(any(
target_os = "netbsd",
target_os = "openbsd",
all(target_vendor = "apple", target_arch = "aarch64")
))]
#[link_name = "getmntinfo"]
fn get_mount_info(mount_buffer_p: *mut *mut StatFs, flags: c_int) -> c_int;

#[cfg(target_os = "freebsd")]
#[link_name = "getmntinfo"]
fn get_mount_info(mount_buffer_p: *mut *mut StatFs, flags: c_int) -> c_int;
}

use crate::error::UResult;
#[cfg(any(
target_os = "freebsd",
Expand Down Expand Up @@ -505,9 +474,9 @@ pub fn read_fs_list() -> UResult<Vec<MountInfo>> {
))]
{
let mut mount_buffer_ptr: *mut StatFs = ptr::null_mut();
let len = unsafe { get_mount_info(&raw mut mount_buffer_ptr, 1_i32) };
let len = unsafe { libc::getmntinfo(&raw mut mount_buffer_ptr, 1_i32) };
if len < 0 {
return Err(USimpleError::new(1, "get_mount_info() failed"));
return Err(USimpleError::new(1, "getmntinfo() failed"));
}
let mounts = unsafe { slice::from_raw_parts(mount_buffer_ptr, len as usize) };
Ok(mounts
Expand Down
Loading