xref: /DragonOS/user/apps/test-mount/src/main.rs (revision 8cb2e9b344230227fe5f3ab3ebeb2522f1c5e289)
1 use core::ffi::{c_char, c_void};
2 use libc::{mount, MS_BIND};
3 
4 fn main() {
5     let source = b"\0".as_ptr() as *const c_char;
6     let target = b"/mnt/tmp\0".as_ptr() as *const c_char;
7     let fstype = b"ramfs\0".as_ptr() as *const c_char;
8     let flags = MS_BIND;
9     let data = std::ptr::null() as *const c_void;
10     let result = unsafe { mount(source, target, fstype, flags, data) };
11 
12     if result == 0 {
13         println!("Mount successful");
14     } else {
15         println!("Mount failed");
16     }
17 }
18