4 mount
::{unmount, MntFlags, Nmount}
,
6 use std
::{ffi::CString, fs::File, path::Path}
;
11 require_mount
!("nullfs");
13 let mountpoint
= tempdir().unwrap();
14 let target
= tempdir().unwrap();
15 let _sentry
= File
::create(target
.path().join("sentry")).unwrap();
17 let fstype
= CString
::new("fstype").unwrap();
18 let nullfs
= CString
::new("nullfs").unwrap();
20 .str_opt(&fstype
, &nullfs
)
21 .str_opt_owned("fspath", mountpoint
.path().to_str().unwrap())
22 .str_opt_owned("target", target
.path().to_str().unwrap())
23 .nmount(MntFlags
::empty())
26 // Now check that the sentry is visible through the mountpoint
27 let exists
= Path
::exists(&mountpoint
.path().join("sentry"));
29 // Cleanup the mountpoint before asserting
30 unmount(mountpoint
.path(), MntFlags
::empty()).unwrap();
37 let mountpoint
= tempdir().unwrap();
38 let target
= tempdir().unwrap();
39 let _sentry
= File
::create(target
.path().join("sentry")).unwrap();
42 .str_opt_owned("fspath", mountpoint
.path().to_str().unwrap())
43 .str_opt_owned("target", target
.path().to_str().unwrap())
44 .nmount(MntFlags
::empty())
47 assert_eq
!(e
.error(), Errno
::EINVAL
);
48 assert_eq
!(e
.errmsg(), Some("Invalid fstype"));