start with Header

This commit is contained in:
2022-02-17 11:16:30 +02:00
committed by Motiejus Jakštys
parent 00cf0e4a66
commit 8c8570e6d1
4 changed files with 72 additions and 2 deletions

View File

@@ -156,7 +156,7 @@ OFFSET TYPE NAME DESCRIPTION
0 [4]u8 magic always 0xf09fa4b7
4 u8 version now `0`
5 u16 bom 0x1234
7 u6 num_shells max value: 63
u8 num_shells max value: 63. Padding is strange on little endian.
8 u32 num_users number of passwd entries
12 u32 num_groups number of group entries
16 u32 offset_cmph_uid2user
@@ -186,6 +186,11 @@ header field. For example, `cmph_gid2group` comes immediately after the header,
and `idx_groupname2group` comes after `idx_gid2group`, whose offset is
`offset_idx`, and size can be calculated.
`num_shells` would fit to u6; however, we would need 2 bits of padding (all
other fields are byte-aligned). If we instead do `u2` followed by `u6`, the
byte would look very unusual on a little-endian architecture. Therefore we will
just refuse loading the file if the number of shells exceeds 63.
Primitive types
---------------