diff options
author | Bryant Mairs <bryantmairs@google.com> | 2017-12-05 19:37:10 -0800 |
---|---|---|
committer | Bryant Mairs <bryantmairs@google.com> | 2017-12-10 20:47:59 -0800 |
commit | 3924361d8517e367ee8eef4779390e49e5f77e49 (patch) | |
tree | 1449d0ae7349fd1dcfce5f7c5c761da759b163a0 | |
parent | e95cf8827ce26f4ebb99523ac9dabf827a31966c (diff) | |
download | nix-3924361d8517e367ee8eef4779390e49e5f77e49.zip |
Migrate more bitflags to use libc_bitflags!
-rw-r--r-- | src/mount.rs | 69 | ||||
-rw-r--r-- | src/sys/statvfs.rs | 26 |
2 files changed, 53 insertions, 42 deletions
diff --git a/src/mount.rs b/src/mount.rs index 29691543..8fe99513 100644 --- a/src/mount.rs +++ b/src/mount.rs @@ -3,36 +3,47 @@ use libc; use {Result, NixPath}; use errno::Errno; -bitflags!( +libc_bitflags!( pub struct MsFlags: c_ulong { - const MS_RDONLY = libc::MS_RDONLY; // Mount read-only - const MS_NOSUID = libc::MS_NOSUID; // Ignore suid and sgid bits - const MS_NODEV = libc::MS_NODEV; // Disallow access to device special files - const MS_NOEXEC = libc::MS_NOEXEC; // Disallow program execution - const MS_SYNCHRONOUS = libc::MS_SYNCHRONOUS; // Writes are synced at once - const MS_REMOUNT = libc::MS_REMOUNT; // Alter flags of a mounted FS - const MS_MANDLOCK = libc::MS_MANDLOCK; // Allow mandatory locks on a FS - const MS_DIRSYNC = libc::MS_DIRSYNC; // Directory modifications are synchronous - const MS_NOATIME = libc::MS_NOATIME; // Do not update access times - const MS_NODIRATIME = libc::MS_NODIRATIME; // Do not update directory access times - const MS_BIND = libc::MS_BIND; // Linux 2.4.0 - Bind directory at different place - const MS_MOVE = libc::MS_MOVE; - const MS_REC = libc::MS_REC; - const MS_SILENT = libc::MS_SILENT; - const MS_POSIXACL = libc::MS_POSIXACL; - const MS_UNBINDABLE = libc::MS_UNBINDABLE; - const MS_PRIVATE = libc::MS_PRIVATE; - const MS_SLAVE = libc::MS_SLAVE; - const MS_SHARED = libc::MS_SHARED; - const MS_RELATIME = libc::MS_RELATIME; - const MS_KERNMOUNT = libc::MS_KERNMOUNT; - const MS_I_VERSION = libc::MS_I_VERSION; - const MS_STRICTATIME = libc::MS_STRICTATIME; - const MS_ACTIVE = libc::MS_ACTIVE; - const MS_NOUSER = libc::MS_NOUSER; - const MS_RMT_MASK = libc::MS_RMT_MASK; - const MS_MGC_VAL = libc::MS_MGC_VAL; - const MS_MGC_MSK = libc::MS_MGC_MSK; + /// Mount read-only + MS_RDONLY; + /// Ignore suid and sgid bits + MS_NOSUID; + /// Disallow access to device special files + MS_NODEV; + /// Disallow program execution + MS_NOEXEC; + /// Writes are synced at once + MS_SYNCHRONOUS; + /// Alter flags of a mounted FS + MS_REMOUNT; + /// Allow mandatory locks on a FS + MS_MANDLOCK; + /// Directory modifications are synchronous + MS_DIRSYNC; + /// Do not update access times + MS_NOATIME; + /// Do not update directory access times + MS_NODIRATIME; + /// Linux 2.4.0 - Bind directory at different place + MS_BIND; + MS_MOVE; + MS_REC; + MS_SILENT; + MS_POSIXACL; + MS_UNBINDABLE; + MS_PRIVATE; + MS_SLAVE; + MS_SHARED; + MS_RELATIME; + MS_KERNMOUNT; + MS_I_VERSION; + MS_STRICTATIME; + MS_ACTIVE; + MS_NOUSER; + MS_RMT_MASK; + MS_MGC_VAL; + MS_MGC_MSK; } ); diff --git a/src/sys/statvfs.rs b/src/sys/statvfs.rs index 0a0dab7f..fbd0570e 100644 --- a/src/sys/statvfs.rs +++ b/src/sys/statvfs.rs @@ -10,45 +10,45 @@ use libc::{self, c_ulong}; use {Result, NixPath}; use errno::Errno; -bitflags!( +libc_bitflags!( /// File system mount Flags #[repr(C)] #[derive(Default)] pub struct FsFlags: c_ulong { /// Read Only - const RDONLY = libc::ST_RDONLY; + ST_RDONLY; /// Do not allow the set-uid bits to have an effect - const NOSUID = libc::ST_NOSUID; + ST_NOSUID; /// Do not interpret character or block-special devices #[cfg(any(target_os = "android", target_os = "linux"))] - const NODEV = libc::ST_NODEV; + ST_NODEV; /// Do not allow execution of binaries on the filesystem #[cfg(any(target_os = "android", target_os = "linux"))] - const NOEXEC = libc::ST_NOEXEC; + ST_NOEXEC; /// All IO should be done synchronously #[cfg(any(target_os = "android", target_os = "linux"))] - const SYNCHRONOUS = libc::ST_SYNCHRONOUS; + ST_SYNCHRONOUS; /// Allow mandatory locks on the filesystem #[cfg(any(target_os = "android", target_os = "linux"))] - const MANDLOCK = libc::ST_MANDLOCK; + ST_MANDLOCK; /// Write on file/directory/symlink #[cfg(any(target_os = "android", target_os = "linux"))] - const WRITE = libc::ST_WRITE; + ST_WRITE; /// Append-only file #[cfg(any(target_os = "android", target_os = "linux"))] - const APPEND = libc::ST_APPEND; + ST_APPEND; /// Immutable file #[cfg(any(target_os = "android", target_os = "linux"))] - const IMMUTABLE = libc::ST_IMMUTABLE; + ST_IMMUTABLE; /// Do not update access times on files #[cfg(any(target_os = "android", target_os = "linux"))] - const NOATIME = libc::ST_NOATIME; + ST_NOATIME; /// Do not update access times on files #[cfg(any(target_os = "android", target_os = "linux"))] - const NODIRATIME = libc::ST_NODIRATIME; + ST_NODIRATIME; /// Update access time relative to modify/change time #[cfg(any(target_os = "android", all(target_os = "linux", not(target_env = "musl"))))] - const RELATIME = libc::ST_RELATIME; + ST_RELATIME; } ); |