Skip to content

Commit fbd0f2d

Browse files
ETKNeilsunfishcode
andauthored
Add NO_AUTOMOUNT AtFlags, STATX_DIOALIGN mask and reorder bitflag to follow numbering (#523)
* Add NO_AUTOMOUNT AtFlags and reorder bitflag to follow numbering * Add STATX_DIOALIGN flag to StatxFlags * Enable `NO_AUTOMOUNT` on Musl, Android, and Fuchsia too. --------- Co-authored-by: Dan Gohman <[email protected]>
1 parent 87f07d4 commit fbd0f2d

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

src/backend/libc/fs/types.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,22 @@ bitflags! {
3030
/// [`statat`]: crate::fs::statat
3131
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
3232
pub struct AtFlags: c::c_int {
33+
/// `AT_SYMLINK_NOFOLLOW`
34+
const SYMLINK_NOFOLLOW = c::AT_SYMLINK_NOFOLLOW;
35+
36+
/// `AT_EACCESS`
37+
#[cfg(not(any(target_os = "emscripten", target_os = "android")))]
38+
const EACCESS = c::AT_EACCESS;
39+
3340
/// `AT_REMOVEDIR`
3441
const REMOVEDIR = c::AT_REMOVEDIR;
3542

3643
/// `AT_SYMLINK_FOLLOW`
3744
const SYMLINK_FOLLOW = c::AT_SYMLINK_FOLLOW;
3845

39-
/// `AT_SYMLINK_NOFOLLOW`
40-
const SYMLINK_NOFOLLOW = c::AT_SYMLINK_NOFOLLOW;
46+
/// `AT_NO_AUTOMOUNT`
47+
#[cfg(any(linux_like, target_os = "fuchsia"))]
48+
const NO_AUTOMOUNT = c::AT_NO_AUTOMOUNT;
4149

4250
/// `AT_EMPTY_PATH`
4351
#[cfg(any(
@@ -51,10 +59,6 @@ bitflags! {
5159
#[cfg(target_os = "freebsd")]
5260
const RESOLVE_BENEATH = c::AT_RESOLVE_BENEATH;
5361

54-
/// `AT_EACCESS`
55-
#[cfg(not(any(target_os = "emscripten", target_os = "android")))]
56-
const EACCESS = c::AT_EACCESS;
57-
5862
/// `AT_STATX_SYNC_AS_STAT`
5963
#[cfg(all(target_os = "linux", target_env = "gnu"))]
6064
const STATX_SYNC_AS_STAT = c::AT_STATX_SYNC_AS_STAT;
@@ -644,6 +648,9 @@ bitflags! {
644648
/// `STATX_MNT_ID` (since Linux 5.8)
645649
const MNT_ID = c::STATX_MNT_ID;
646650

651+
/// `STATX_DIOALIGN` (since Linux 6.1)
652+
const DIOALIGN = c::STATX_DIOALIGN;
653+
647654
/// `STATX_ALL`
648655
const ALL = c::STATX_ALL;
649656
}

src/backend/linux_raw/fs/types.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,24 @@ bitflags! {
2929
/// [`statat`]: crate::fs::statat
3030
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
3131
pub struct AtFlags: c::c_uint {
32+
/// `AT_SYMLINK_NOFOLLOW`
33+
const SYMLINK_NOFOLLOW = linux_raw_sys::general::AT_SYMLINK_NOFOLLOW;
34+
35+
/// `AT_EACCESS`
36+
const EACCESS = linux_raw_sys::general::AT_EACCESS;
37+
3238
/// `AT_REMOVEDIR`
3339
const REMOVEDIR = linux_raw_sys::general::AT_REMOVEDIR;
3440

3541
/// `AT_SYMLINK_FOLLOW`
3642
const SYMLINK_FOLLOW = linux_raw_sys::general::AT_SYMLINK_FOLLOW;
3743

38-
/// `AT_SYMLINK_NOFOLLOW`
39-
const SYMLINK_NOFOLLOW = linux_raw_sys::general::AT_SYMLINK_NOFOLLOW;
44+
/// `AT_NO_AUTOMOUNT`
45+
const NO_AUTOMOUNT = linux_raw_sys::general::AT_NO_AUTOMOUNT;
4046

4147
/// `AT_EMPTY_PATH`
4248
const EMPTY_PATH = linux_raw_sys::general::AT_EMPTY_PATH;
4349

44-
/// `AT_EACCESS`
45-
const EACCESS = linux_raw_sys::general::AT_EACCESS;
46-
4750
/// `AT_STATX_SYNC_AS_STAT`
4851
const STATX_SYNC_AS_STAT = linux_raw_sys::general::AT_STATX_SYNC_AS_STAT;
4952

@@ -494,6 +497,9 @@ bitflags! {
494497
/// `STATX_MNT_ID` (since Linux 5.8)
495498
const MNT_ID = linux_raw_sys::general::STATX_MNT_ID;
496499

500+
/// `STATX_DIOALIGN` (since Linux 6.1)
501+
const DIOALIGN = linux_raw_sys::general::STATX_DIOALIGN;
502+
497503
/// `STATX_ALL`
498504
const ALL = linux_raw_sys::general::STATX_ALL;
499505
}

0 commit comments

Comments
 (0)