diff options
author | Bryant Mairs <bryantmairs@google.com> | 2017-11-21 22:27:15 -0800 |
---|---|---|
committer | Bryant Mairs <bryantmairs@google.com> | 2017-12-02 10:46:34 -0800 |
commit | e1baab9dc132f18e13f446df0271a5e46723848d (patch) | |
tree | 3e4e6714d843edc493dfc3cf879d659bbd264e65 /test/test_mount.rs | |
parent | d374a1ecd3f69027a2ce28e87806f459ef3f9105 (diff) | |
download | nix-e1baab9dc132f18e13f446df0271a5e46723848d.zip |
Upgrade to Bitflags 1.0
The libc_bitflags! macro was replaced with a non-recursive one supporting
only public structs. I could not figure out how to make the old macro work
with the upgrade, so I reworked part of the bitflags! macro directly to suit
our needs, much as the original recursive macro was made. There are no uses
of this macro for non-public structs, so this is not a problem for internal code.
Diffstat (limited to 'test/test_mount.rs')
-rw-r--r-- | test/test_mount.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/test/test_mount.rs b/test/test_mount.rs index 57ff2106..e4cd6ba7 100644 --- a/test/test_mount.rs +++ b/test/test_mount.rs @@ -18,9 +18,9 @@ mod test_mount { use libc::{EACCES, EROFS}; use nix::errno::Errno; - use nix::mount::{mount, umount, MsFlags, MS_BIND, MS_RDONLY, MS_NOEXEC}; - use nix::sched::{unshare, CLONE_NEWNS, CLONE_NEWUSER}; - use nix::sys::stat::{self, S_IRWXU, S_IRWXG, S_IRWXO, S_IXUSR, S_IXGRP, S_IXOTH}; + use nix::mount::{mount, umount, MsFlags}; + use nix::sched::{unshare, CloneFlags}; + use nix::sys::stat::{self, Mode}; use nix::unistd::getuid; use tempdir::TempDir; @@ -48,7 +48,7 @@ exit 23"; fs::OpenOptions::new() .create(true) .write(true) - .mode((S_IRWXU | S_IRWXG | S_IRWXO).bits()) + .mode((Mode::S_IRWXU | Mode::S_IRWXG | Mode::S_IRWXO).bits()) .open(&test_path) .or_else(|e| if Errno::from_i32(e.raw_os_error().unwrap()) == Errno::EOVERFLOW { @@ -95,7 +95,7 @@ exit 23"; mount(NONE, tempdir.path(), Some(b"tmpfs".as_ref()), - MS_RDONLY, + MsFlags::MS_RDONLY, NONE) .unwrap_or_else(|e| panic!("mount failed: {}", e)); @@ -113,7 +113,7 @@ exit 23"; mount(NONE, tempdir.path(), Some(b"tmpfs".as_ref()), - MS_NOEXEC, + MsFlags::MS_NOEXEC, NONE) .unwrap_or_else(|e| panic!("mount failed: {}", e)); @@ -122,7 +122,7 @@ exit 23"; fs::OpenOptions::new() .create(true) .write(true) - .mode((S_IRWXU | S_IRWXG | S_IRWXO).bits()) + .mode((Mode::S_IRWXU | Mode::S_IRWXG | Mode::S_IRWXO).bits()) .open(&test_path) .and_then(|mut f| f.write(SCRIPT_CONTENTS)) .unwrap_or_else(|e| panic!("write failed: {}", e)); @@ -134,7 +134,7 @@ exit 23"; panic!("metadata failed: {}", e) })); - assert!(mode.contains(S_IXUSR | S_IXGRP | S_IXOTH), + assert!(mode.contains(Mode::S_IXUSR | Mode::S_IXGRP | Mode::S_IXOTH), "{:?} did not have execute permissions", &test_path); @@ -157,14 +157,14 @@ exit 23"; mount(Some(tempdir.path()), mount_point.path(), NONE, - MS_BIND, + MsFlags::MS_BIND, NONE) .unwrap_or_else(|e| panic!("mount failed: {}", e)); fs::OpenOptions::new() .create(true) .write(true) - .mode((S_IRWXU | S_IRWXG | S_IRWXO).bits()) + .mode((Mode::S_IRWXU | Mode::S_IRWXG | Mode::S_IRWXO).bits()) .open(mount_point.path().join(file_name)) .and_then(|mut f| f.write(SCRIPT_CONTENTS)) .unwrap_or_else(|e| panic!("write failed: {}", e)); @@ -186,7 +186,7 @@ exit 23"; // Hold on to the uid in the parent namespace. let uid = getuid(); - unshare(CLONE_NEWNS | CLONE_NEWUSER).unwrap_or_else(|e| { + unshare(CloneFlags::CLONE_NEWNS | CloneFlags::CLONE_NEWUSER).unwrap_or_else(|e| { let stderr = io::stderr(); let mut handle = stderr.lock(); writeln!(handle, |