Skip to content

Commit ed79cfb

Browse files
author
Bryant Mairs
committed
Migrate more bitflags to use libc_bitflags!
1 parent a055e9a commit ed79cfb

File tree

2 files changed

+53
-42
lines changed

2 files changed

+53
-42
lines changed

src/mount.rs

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,47 @@ use libc;
33
use {Result, NixPath};
44
use errno::Errno;
55

6-
bitflags!(
6+
libc_bitflags!(
77
pub struct MsFlags: c_ulong {
8-
const MS_RDONLY = libc::MS_RDONLY; // Mount read-only
9-
const MS_NOSUID = libc::MS_NOSUID; // Ignore suid and sgid bits
10-
const MS_NODEV = libc::MS_NODEV; // Disallow access to device special files
11-
const MS_NOEXEC = libc::MS_NOEXEC; // Disallow program execution
12-
const MS_SYNCHRONOUS = libc::MS_SYNCHRONOUS; // Writes are synced at once
13-
const MS_REMOUNT = libc::MS_REMOUNT; // Alter flags of a mounted FS
14-
const MS_MANDLOCK = libc::MS_MANDLOCK; // Allow mandatory locks on a FS
15-
const MS_DIRSYNC = libc::MS_DIRSYNC; // Directory modifications are synchronous
16-
const MS_NOATIME = libc::MS_NOATIME; // Do not update access times
17-
const MS_NODIRATIME = libc::MS_NODIRATIME; // Do not update directory access times
18-
const MS_BIND = libc::MS_BIND; // Linux 2.4.0 - Bind directory at different place
19-
const MS_MOVE = libc::MS_MOVE;
20-
const MS_REC = libc::MS_REC;
21-
const MS_SILENT = libc::MS_SILENT;
22-
const MS_POSIXACL = libc::MS_POSIXACL;
23-
const MS_UNBINDABLE = libc::MS_UNBINDABLE;
24-
const MS_PRIVATE = libc::MS_PRIVATE;
25-
const MS_SLAVE = libc::MS_SLAVE;
26-
const MS_SHARED = libc::MS_SHARED;
27-
const MS_RELATIME = libc::MS_RELATIME;
28-
const MS_KERNMOUNT = libc::MS_KERNMOUNT;
29-
const MS_I_VERSION = libc::MS_I_VERSION;
30-
const MS_STRICTATIME = libc::MS_STRICTATIME;
31-
const MS_ACTIVE = libc::MS_ACTIVE;
32-
const MS_NOUSER = libc::MS_NOUSER;
33-
const MS_RMT_MASK = libc::MS_RMT_MASK;
34-
const MS_MGC_VAL = libc::MS_MGC_VAL;
35-
const MS_MGC_MSK = libc::MS_MGC_MSK;
8+
/// Mount read-only
9+
MS_RDONLY;
10+
/// Ignore suid and sgid bits
11+
MS_NOSUID;
12+
/// Disallow access to device special files
13+
MS_NODEV;
14+
/// Disallow program execution
15+
MS_NOEXEC;
16+
/// Writes are synced at once
17+
MS_SYNCHRONOUS;
18+
/// Alter flags of a mounted FS
19+
MS_REMOUNT;
20+
/// Allow mandatory locks on a FS
21+
MS_MANDLOCK;
22+
/// Directory modifications are synchronous
23+
MS_DIRSYNC;
24+
/// Do not update access times
25+
MS_NOATIME;
26+
/// Do not update directory access times
27+
MS_NODIRATIME;
28+
/// Linux 2.4.0 - Bind directory at different place
29+
MS_BIND;
30+
MS_MOVE;
31+
MS_REC;
32+
MS_SILENT;
33+
MS_POSIXACL;
34+
MS_UNBINDABLE;
35+
MS_PRIVATE;
36+
MS_SLAVE;
37+
MS_SHARED;
38+
MS_RELATIME;
39+
MS_KERNMOUNT;
40+
MS_I_VERSION;
41+
MS_STRICTATIME;
42+
MS_ACTIVE;
43+
MS_NOUSER;
44+
MS_RMT_MASK;
45+
MS_MGC_VAL;
46+
MS_MGC_MSK;
3647
}
3748
);
3849

src/sys/statvfs.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,45 +10,45 @@ use libc::{self, c_ulong};
1010
use {Result, NixPath};
1111
use errno::Errno;
1212

13-
bitflags!(
13+
libc_bitflags!(
1414
/// File system mount Flags
1515
#[repr(C)]
1616
#[derive(Default)]
1717
pub struct FsFlags: c_ulong {
1818
/// Read Only
19-
const RDONLY = libc::ST_RDONLY;
19+
ST_RDONLY;
2020
/// Do not allow the set-uid bits to have an effect
21-
const NOSUID = libc::ST_NOSUID;
21+
ST_NOSUID;
2222
/// Do not interpret character or block-special devices
2323
#[cfg(any(target_os = "android", target_os = "linux"))]
24-
const NODEV = libc::ST_NODEV;
24+
ST_NODEV;
2525
/// Do not allow execution of binaries on the filesystem
2626
#[cfg(any(target_os = "android", target_os = "linux"))]
27-
const NOEXEC = libc::ST_NOEXEC;
27+
ST_NOEXEC;
2828
/// All IO should be done synchronously
2929
#[cfg(any(target_os = "android", target_os = "linux"))]
30-
const SYNCHRONOUS = libc::ST_SYNCHRONOUS;
30+
ST_SYNCHRONOUS;
3131
/// Allow mandatory locks on the filesystem
3232
#[cfg(any(target_os = "android", target_os = "linux"))]
33-
const MANDLOCK = libc::ST_MANDLOCK;
33+
ST_MANDLOCK;
3434
/// Write on file/directory/symlink
3535
#[cfg(any(target_os = "android", target_os = "linux"))]
36-
const WRITE = libc::ST_WRITE;
36+
ST_WRITE;
3737
/// Append-only file
3838
#[cfg(any(target_os = "android", target_os = "linux"))]
39-
const APPEND = libc::ST_APPEND;
39+
ST_APPEND;
4040
/// Immutable file
4141
#[cfg(any(target_os = "android", target_os = "linux"))]
42-
const IMMUTABLE = libc::ST_IMMUTABLE;
42+
ST_IMMUTABLE;
4343
/// Do not update access times on files
4444
#[cfg(any(target_os = "android", target_os = "linux"))]
45-
const NOATIME = libc::ST_NOATIME;
45+
ST_NOATIME;
4646
/// Do not update access times on files
4747
#[cfg(any(target_os = "android", target_os = "linux"))]
48-
const NODIRATIME = libc::ST_NODIRATIME;
48+
ST_NODIRATIME;
4949
/// Update access time relative to modify/change time
5050
#[cfg(any(target_os = "android", all(target_os = "linux", not(target_env = "musl"))))]
51-
const RELATIME = libc::ST_RELATIME;
51+
ST_RELATIME;
5252
}
5353
);
5454

0 commit comments

Comments
 (0)