offsets are u64

This commit is contained in:
2022-03-08 20:44:32 +02:00
committed by Motiejus Jakštys
parent d2ace3e125
commit fc469acbf9
3 changed files with 66 additions and 71 deletions

View File

@@ -197,13 +197,13 @@ const PackedGroup = packed struct {
pub const PackedUser = packed struct {
uid: u32,
gid: u32,
additional_gids_offset: u29,
shell_here: bool,
padding: u2 = 0,
shell_len_or_idx: u6,
home_len: u6,
shell_here: bool,
name_is_a_suffix: bool,
home_len: u6,
name_len: u5,
gecos_len: u8,
gecos_len: u11,
// pseudocode: variable-sized array that will be stored immediately after
// this struct.
stringdata []u8;
@@ -215,6 +215,7 @@ pub const PackedUser = packed struct {
- name (optional).
- gecos.
- shell (optional).
- `additional_gids_offset`: varint.
First byte of home is stored right after the `gecos_len` field, and it's
length is `home_len`. The same logic applies to all the `stringdata` fields:
@@ -232,6 +233,9 @@ Additionally, there are two "easy" optimizations:
2. `name_is_a_suffix=false`: name begins one byte after home, and it's length
is `name_len`.
The last field, `additional_gids_offset`, which is needed least frequently,
is stored at the end.
Shells
------