Skip to content
This repository was archived by the owner on Jul 4, 2023. It is now read-only.

Commit 4d6e5f4

Browse files
authored
Merge pull request #1 from ariasuni/fix-typo
Fix statx_timestamp types/field names
2 parents 50e895b + 1d6f826 commit 4d6e5f4

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ readme = "README.md"
1414
libc = { version = "^0.2.51", default-features = false }
1515

1616
[dev-dependencies]
17-
memoffset = "^0.3.0"
17+
memoffset = "^0.5.1"

src/lib.rs

+26-26
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#![deny(warnings)]
99

1010
use libc::syscall;
11-
use libc::{__s32, __u16, __u32, __u64, c_char, c_int, c_long, c_uint};
11+
use libc::{c_char, c_long, c_int, c_uint};
1212

1313
/// Timestamp structure for the timestamps in struct statx.
1414
///
@@ -22,8 +22,8 @@ use libc::{__s32, __u16, __u32, __u64, c_char, c_int, c_long, c_uint};
2222
#[derive(Clone, Copy, Debug)]
2323
pub struct statx_timestamp {
2424
pub tv_sec: i64,
25-
pub tc_nsec: __u32,
26-
pub __reserved: __s32,
25+
pub tv_nsec: u32,
26+
pub __reserved: i32,
2727
}
2828

2929
/// Structures for the extended file attribute retrieval system call
@@ -66,32 +66,32 @@ pub struct statx_timestamp {
6666
pub struct statx {
6767
// 0x00
6868
/// What results were written [uncond]
69-
pub stx_mask: __u32,
69+
pub stx_mask: u32,
7070
/// Preferred general I/O size [uncond]
71-
pub stx_blksize: __u32,
71+
pub stx_blksize: u32,
7272
/// Flags conveying information about the file [uncond]
73-
pub stx_attributes: __u64,
73+
pub stx_attributes: u64,
7474

7575
// 0x10
7676
/// Number of hard links
77-
pub stx_nlink: __u32,
77+
pub stx_nlink: u32,
7878
/// User ID of owner
79-
pub stx_uid: __u32,
79+
pub stx_uid: u32,
8080
/// Group ID of owner
81-
pub stx_gid: __u32,
81+
pub stx_gid: u32,
8282
/// File mode
83-
pub stx_mode: __u16,
84-
pub __spare0: [__u16; 1],
83+
pub stx_mode: u16,
84+
pub __spare0: [u16; 1],
8585

8686
// 0x20
8787
/// Inode number
88-
pub stx_ino: __u64,
88+
pub stx_ino: u64,
8989
/// File size
90-
pub stx_size: __u64,
90+
pub stx_size: u64,
9191
/// Number of 512-byte blocks allocated
92-
pub stx_blocks: __u64,
92+
pub stx_blocks: u64,
9393
/// Mask to show what's supported in stx_attributes
94-
pub stx_attributes_mask: __u64,
94+
pub stx_attributes_mask: u64,
9595

9696
// 0x40
9797
pub stx_atime: statx_timestamp, /* Last access time */
@@ -101,15 +101,15 @@ pub struct statx {
101101

102102
/* 0x80 */
103103
/// Device ID of special file [if bdev/cdev]
104-
pub stx_rdev_major: __u32,
105-
pub stx_rdev_minor: __u32,
104+
pub stx_rdev_major: u32,
105+
pub stx_rdev_minor: u32,
106106
/// ID of device containing file [uncond]
107-
pub stx_dev_major: __u32,
108-
pub stx_dev_minor: __u32,
107+
pub stx_dev_major: u32,
108+
pub stx_dev_minor: u32,
109109

110110
// 0x90
111111
/// Spare space for future expansion
112-
pub __spare2: [__u64; 14],
112+
pub __spare2: [u64; 14],
113113
// 0x100
114114
}
115115

@@ -140,13 +140,13 @@ pub const STATX__RESERVED: c_uint = 0x8000_0000;
140140

141141
// File attributes.
142142

143-
pub const STATX_ATTR_COMPRESSED: __u64 = 0x0000_0004;
144-
pub const STATX_ATTR_IMMUTABLE: __u64 = 0x0000_0010;
145-
pub const STATX_ATTR_APPEND: __u64 = 0x0000_0020;
146-
pub const STATX_ATTR_NODUMP: __u64 = 0x0000_0040;
147-
pub const STATX_ATTR_ENCRYPTED: __u64 = 0x0000_0800;
143+
pub const STATX_ATTR_COMPRESSED: c_int = 0x0000_0004;
144+
pub const STATX_ATTR_IMMUTABLE: c_int = 0x0000_0010;
145+
pub const STATX_ATTR_APPEND: c_int = 0x0000_0020;
146+
pub const STATX_ATTR_NODUMP: c_int = 0x0000_0040;
147+
pub const STATX_ATTR_ENCRYPTED: c_int = 0x0000_0800;
148148

149-
pub const STATX_ATTR_AUTOMOUNT: __u64 = 0x0000_1000;
149+
pub const STATX_ATTR_AUTOMOUNT: c_int = 0x0000_1000;
150150

151151
/// statx - get file status (extended)
152152
///

0 commit comments

Comments
 (0)