sinf 0.1.0

Library for obtaining in-depth system information at both the hardware and software levels
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::ffi::CStr;

#[cfg(target_os = "macos")]
pub(super) fn get_bsd_name(disk: &libc::statfs) -> Option<Vec<u8>> {
    // Remove the `/dev/` prefix from the value.
    unsafe {
        CStr::from_ptr(disk.f_mntfromname.as_ptr())
            .to_bytes_with_nul()
            .strip_prefix(b"/dev/")
            .map(|slice| slice.to_vec())
            .or_else(|| {
                sinf_debug!("unknown disk mount path format");
                None
            })
    }
}