mirror of
https://github.com/ziglang/zig.git
synced 2024-11-16 00:57:04 +00:00
improve docs and field names of Statx struct
This commit is contained in:
parent
312880f102
commit
5181970807
@ -1322,52 +1322,65 @@ pub const statx_timestamp = extern struct {
|
|||||||
__pad1: u32,
|
__pad1: u32,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Renamed to `Statx` to not conflict with the `statx` function.
|
||||||
pub const Statx = extern struct {
|
pub const Statx = extern struct {
|
||||||
// Mask of bits indicating filled fields
|
/// Mask of bits indicating filled fields
|
||||||
stx_mask: u32,
|
mask: u32,
|
||||||
// Block size for filesystem I/O
|
|
||||||
stx_blksize: u32,
|
/// Block size for filesystem I/O
|
||||||
// Extra file attribute indicators
|
blksize: u32,
|
||||||
stx_attributes: u64,
|
|
||||||
// Number of hard links
|
/// Extra file attribute indicators
|
||||||
stx_nlink: u32,
|
attributes: u64,
|
||||||
// User ID of owner
|
|
||||||
stx_uid: u32,
|
/// Number of hard links
|
||||||
// Group ID of owner
|
nlink: u32,
|
||||||
stx_gid: u32,
|
|
||||||
// File type and mode
|
/// User ID of owner
|
||||||
stx_mode: u16,
|
uid: u32,
|
||||||
|
|
||||||
|
/// Group ID of owner
|
||||||
|
gid: u32,
|
||||||
|
|
||||||
|
/// File type and mode
|
||||||
|
mode: u16,
|
||||||
__pad1: u16,
|
__pad1: u16,
|
||||||
// Inode number
|
|
||||||
stx_ino: u64,
|
|
||||||
// Total size in bytes
|
|
||||||
stx_size: u64,
|
|
||||||
// Number of 512B blocks allocated
|
|
||||||
stx_blocks: u64,
|
|
||||||
// Mask to show what's supported in stx_attributes
|
|
||||||
stx_attributes_mask: u64,
|
|
||||||
|
|
||||||
// The following fields are file timestamps
|
/// Inode number
|
||||||
// Last access
|
ino: u64,
|
||||||
stx_atime: statx_timestamp,
|
|
||||||
// Creation
|
|
||||||
stx_btime: statx_timestamp,
|
|
||||||
// Last status change
|
|
||||||
stx_ctime: statx_timestamp,
|
|
||||||
// Last modification
|
|
||||||
stx_mtime: statx_timestamp,
|
|
||||||
|
|
||||||
// If this file represents a device, then the next two fields contain the ID of the device
|
/// Total size in bytes
|
||||||
// Major ID
|
size: u64,
|
||||||
stx_rdev_major: u32,
|
|
||||||
// Minor ID
|
|
||||||
stx_rdev_minor: u32,
|
|
||||||
|
|
||||||
// The next two fields contain the ID of the device containing the filesystem where the file resides
|
/// Number of 512B blocks allocated
|
||||||
// Major ID
|
blocks: u64,
|
||||||
stx_dev_major: u32,
|
|
||||||
// Minor ID
|
/// Mask to show what's supported in `attributes`.
|
||||||
stx_dev_minor: u32,
|
attributes_mask: u64,
|
||||||
|
|
||||||
|
/// Last access file timestamp
|
||||||
|
atime: statx_timestamp,
|
||||||
|
|
||||||
|
/// Creation file timestamp
|
||||||
|
btime: statx_timestamp,
|
||||||
|
|
||||||
|
/// Last status change file timestamp
|
||||||
|
ctime: statx_timestamp,
|
||||||
|
|
||||||
|
/// Last modification file timestamp
|
||||||
|
mtime: statx_timestamp,
|
||||||
|
|
||||||
|
/// Major ID, if this file represents a device.
|
||||||
|
rdev_major: u32,
|
||||||
|
|
||||||
|
/// Minor ID, if this file represents a device.
|
||||||
|
rdev_minor: u32,
|
||||||
|
|
||||||
|
/// Major ID of the device containing the filesystem where this file resides.
|
||||||
|
dev_major: u32,
|
||||||
|
|
||||||
|
/// Minor ID of the device containing the filesystem where this file resides.
|
||||||
|
dev_minor: u32,
|
||||||
|
|
||||||
__pad2: [14]u64,
|
__pad2: [14]u64,
|
||||||
};
|
};
|
||||||
|
@ -69,10 +69,10 @@ test "statx" {
|
|||||||
else => unreachable,
|
else => unreachable,
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(stat_buf.mode == statx_buf.stx_mode);
|
expect(stat_buf.mode == statx_buf.mode);
|
||||||
expect(@bitCast(u32, stat_buf.uid) == statx_buf.stx_uid);
|
expect(@bitCast(u32, stat_buf.uid) == statx_buf.uid);
|
||||||
expect(@bitCast(u32, stat_buf.gid) == statx_buf.stx_gid);
|
expect(@bitCast(u32, stat_buf.gid) == statx_buf.gid);
|
||||||
expect(@bitCast(u64, i64(stat_buf.size)) == statx_buf.stx_size);
|
expect(@bitCast(u64, i64(stat_buf.size)) == statx_buf.size);
|
||||||
expect(@bitCast(u64, i64(stat_buf.blksize)) == statx_buf.stx_blksize);
|
expect(@bitCast(u64, i64(stat_buf.blksize)) == statx_buf.blksize);
|
||||||
expect(@bitCast(u64, i64(stat_buf.blocks)) == statx_buf.stx_blocks);
|
expect(@bitCast(u64, i64(stat_buf.blocks)) == statx_buf.blocks);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user