Skip to content

Instantly share code, notes, and snippets.

@a1ien
Created October 31, 2018 21:51
Show Gist options
  • Save a1ien/0f88df0d0ff8b2cbf4f7595245df24c5 to your computer and use it in GitHub Desktop.
Save a1ien/0f88df0d0ff8b2cbf4f7595245df24c5 to your computer and use it in GitHub Desktop.
fn mount_(
c_source: Option<&CString>,
c_target: &CString,
c_fstype: &CString,
flags: MountFlags,
c_data: *const c_void,
) -> io::Result<()> {
let result = unsafe {
mount(
c_source.map_or_else(ptr::null, |s| s.as_ptr()),
c_target.as_ptr(),
c_fstype.as_ptr(),
flags.bits(),
c_data
)
};
match result {
0 => Ok(()),
_err => Err(io::Error::last_os_error()),
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment