Skip to content

Commit 3973509

Browse files
committed
Add Linux 6.11 statx fields/constants
1 parent 6bdc655 commit 3973509

File tree

2 files changed

+94
-1
lines changed

2 files changed

+94
-1
lines changed

src/unix/linux_like/linux_statx.rs

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
s! {
2+
pub struct statx {
3+
pub stx_mask: ::__u32,
4+
pub stx_blksize: ::__u32,
5+
pub stx_attributes: ::__u64,
6+
pub stx_nlink: ::__u32,
7+
pub stx_uid: ::__u32,
8+
pub stx_gid: ::__u32,
9+
pub stx_mode: ::__u16,
10+
__statx_pad1: [::__u16; 1],
11+
pub stx_ino: ::__u64,
12+
pub stx_size: ::__u64,
13+
pub stx_blocks: ::__u64,
14+
pub stx_attributes_mask: ::__u64,
15+
pub stx_atime: statx_timestamp,
16+
pub stx_btime: statx_timestamp,
17+
pub stx_ctime: statx_timestamp,
18+
pub stx_mtime: statx_timestamp,
19+
pub stx_rdev_major: ::__u32,
20+
pub stx_rdev_minor: ::__u32,
21+
pub stx_dev_major: ::__u32,
22+
pub stx_dev_minor: ::__u32,
23+
pub stx_mnt_id: ::__u64,
24+
pub stx_dio_mem_align: ::__u32,
25+
pub stx_dio_offset_align: ::__u32,
26+
pub stx_subvol: ::__u64,
27+
pub stx_atomic_write_unit_min: ::__u32,
28+
pub stx_atomic_write_unit_max: ::__u32,
29+
pub stx_atomic_write_segments_max: ::__u32,
30+
__statx_pad2: [::__u32; 1],
31+
__statx_pad3: [::__u64; 9],
32+
}
33+
34+
pub struct statx_timestamp {
35+
pub tv_sec: ::__s64,
36+
pub tv_nsec: ::__u32,
37+
__statx_timestamp_pad1: [::__s32; 1],
38+
}
39+
}
40+
41+
pub const AT_STATX_SYNC_TYPE: ::c_int = 0x6000;
42+
pub const AT_STATX_SYNC_AS_STAT: ::c_int = 0x0000;
43+
pub const AT_STATX_FORCE_SYNC: ::c_int = 0x2000;
44+
pub const AT_STATX_DONT_SYNC: ::c_int = 0x4000;
45+
pub const STATX_TYPE: ::c_uint = 0x0001;
46+
pub const STATX_MODE: ::c_uint = 0x0002;
47+
pub const STATX_NLINK: ::c_uint = 0x0004;
48+
pub const STATX_UID: ::c_uint = 0x0008;
49+
pub const STATX_GID: ::c_uint = 0x0010;
50+
pub const STATX_ATIME: ::c_uint = 0x0020;
51+
pub const STATX_MTIME: ::c_uint = 0x0040;
52+
pub const STATX_CTIME: ::c_uint = 0x0080;
53+
pub const STATX_INO: ::c_uint = 0x0100;
54+
pub const STATX_SIZE: ::c_uint = 0x0200;
55+
pub const STATX_BLOCKS: ::c_uint = 0x0400;
56+
pub const STATX_BASIC_STATS: ::c_uint = 0x07ff;
57+
pub const STATX_BTIME: ::c_uint = 0x0800;
58+
pub const STATX_ALL: ::c_uint = 0x0fff;
59+
pub const STATX_MNT_ID: ::c_uint = 0x1000;
60+
pub const STATX_DIOALIGN: ::c_uint = 0x2000;
61+
pub const STATX_MNT_ID_UNIQUE: ::c_uint = 0x4000;
62+
pub const STATX_SUBVOL: ::c_uint = 0x8000;
63+
pub const STATX_WRITE_ATOMIC: ::c_uint = 0x10000;
64+
pub const STATX__RESERVED: ::c_int = 0x80000000;
65+
pub const STATX_ATTR_COMPRESSED: ::c_int = 0x0004;
66+
pub const STATX_ATTR_IMMUTABLE: ::c_int = 0x0010;
67+
pub const STATX_ATTR_APPEND: ::c_int = 0x0020;
68+
pub const STATX_ATTR_NODUMP: ::c_int = 0x0040;
69+
pub const STATX_ATTR_ENCRYPTED: ::c_int = 0x0800;
70+
pub const STATX_ATTR_AUTOMOUNT: ::c_int = 0x1000;
71+
pub const STATX_ATTR_MOUNT_ROOT: ::c_int = 0x2000;
72+
pub const STATX_ATTR_VERITY: ::c_int = 0x100000;
73+
pub const STATX_ATTR_DAX: ::c_int = 0x200000;
74+
pub const STATX_ATTR_WRITE_ATOMIC: ::c_int = 0x400000;
75+
76+
extern "C" {
77+
pub fn statx(
78+
dirfd: ::c_int,
79+
pathname: *const ::c_char,
80+
flags: ::c_int,
81+
mask: ::c_uint,
82+
statxbuf: *mut statx,
83+
) -> ::c_int;
84+
}

src/unix/linux_like/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1909,6 +1909,9 @@ cfg_if! {
19091909
pub const STATX_ALL: ::c_uint = 0x0fff;
19101910
pub const STATX_MNT_ID: ::c_uint = 0x1000;
19111911
pub const STATX_DIOALIGN: ::c_uint = 0x2000;
1912+
pub const STATX_MNT_ID_UNIQUE: ::c_uint = 0x4000;
1913+
pub const STATX_SUBVOL: ::c_uint = 0x8000;
1914+
pub const STATX_WRITE_ATOMIC: ::c_uint = 0x10000;
19121915
pub const STATX__RESERVED: ::c_int = 0x80000000;
19131916
pub const STATX_ATTR_COMPRESSED: ::c_int = 0x0004;
19141917
pub const STATX_ATTR_IMMUTABLE: ::c_int = 0x0010;
@@ -1919,6 +1922,7 @@ cfg_if! {
19191922
pub const STATX_ATTR_MOUNT_ROOT: ::c_int = 0x2000;
19201923
pub const STATX_ATTR_VERITY: ::c_int = 0x100000;
19211924
pub const STATX_ATTR_DAX: ::c_int = 0x200000;
1925+
pub const STATX_ATTR_WRITE_ATOMIC: ::c_int = 0x400000;
19221926

19231927
extern "C" {
19241928
pub fn statx(
@@ -1955,7 +1959,12 @@ cfg_if! {
19551959
pub stx_mnt_id: ::__u64,
19561960
pub stx_dio_mem_align: ::__u32,
19571961
pub stx_dio_offset_align: ::__u32,
1958-
__statx_pad3: [::__u64; 12],
1962+
pub stx_subvol: ::__u64,
1963+
pub stx_atomic_write_unit_min: ::__u32,
1964+
pub stx_atomic_write_unit_max: ::__u32,
1965+
pub stx_atomic_write_segments_max: ::__u32,
1966+
__statx_pad2: [::__u32; 1],
1967+
__statx_pad3: [::__u64; 9],
19591968
}
19601969

19611970
pub struct statx_timestamp {

0 commit comments

Comments
 (0)