1
Fork 0

add missing headers

This commit is contained in:
Motiejus Jakštys 2022-02-14 13:55:54 +02:00 committed by Motiejus Jakštys
parent d422cdf61b
commit 4a9c910ff7
1 changed files with 35 additions and 21 deletions

View File

@ -6,6 +6,12 @@ Library (glibc). Turbonss implements lookup for `user` and `passwd` database
entries (i.e. system users, groups, and group memberships). It's main goal is entries (i.e. system users, groups, and group memberships). It's main goal is
performance, with focus on making [`id(1)`][id] run as fast as possible. performance, with focus on making [`id(1)`][id] run as fast as possible.
Turbonss is optimized for reading. If the data changes in any way, the whole
file will need to be regenerated (and tooling only supports only full
generation). It was created, and best suited, for environments that have a
central user & group database which then needs to be distributed to many
servers/services.
To understand more about name service switch, start with To understand more about name service switch, start with
[`nsswitch.conf(5)`][nsswitch]. [`nsswitch.conf(5)`][nsswitch].
@ -153,12 +159,15 @@ OFFSET TYPE NAME DESCRIPTION
7 u8 padding 7 u8 padding
8 u32 num_users number of passwd entries 8 u32 num_users number of passwd entries
12 u32 num_groups number of group entries 12 u32 num_groups number of group entries
16 u32 offset_cmph_gid2group 16 u32 offset_cmph_uid2user
20 u32 offset_cmph_uid2user 20 u32 offset_cmph_groupname2group
24 u32 offset_cmph_groupname2group 24 u32 offset_cmph_username2user
28 u32 offset_cmph_username2user 28 u32 offset_idx offset to the first idx_ section
32 u32 offset_groupmembers 32 u32 offset_groups
36 u32 offset_additional_gids 36 u32 offset_users
40 u32 offset_shells
44 u32 offset_groupmembers
48 u32 offset_additional_gids
``` ```
`magic` is 0xf09fa4b7, and `version` must be `0`. All integers are `magic` is 0xf09fa4b7, and `version` must be `0`. All integers are
@ -173,6 +182,11 @@ offsets are always pointing to the beginning of an 64-byte "block". Therefore,
all `offset_*` values could be `u26`. As `u32` is easier to visualize with xxd, all `offset_*` values could be `u26`. As `u32` is easier to visualize with xxd,
and the header block fits to 64 bytes anyway, we are keeping them as u32 now. and the header block fits to 64 bytes anyway, we are keeping them as u32 now.
Sections whose lengths can be calculated do not have a corresponding `offset_*`
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.
Primitive types Primitive types
--------------- ---------------
@ -299,21 +313,21 @@ entries are 8-byte aligned, 3 bits are saved from every element.
Each section is padded to 64 bytes. Each section is padded to 64 bytes.
``` ```
SECTION SIZE DESCRIPTION SECTION SIZE DESCRIPTION
Header 40 see "Turbonss header" section Header 40 see "Turbonss header" section
idx_gid2group len(group)*4*29/32 list of gid2group indices cmph_gid2group ? gid->group cmph
idx_groupname2group len(group)*4*29/32 list of groupname2group indices cmph_uid2user ? uid->user cmph
idx_uid2user len(user)*4*29/32 list of uid2user indices cmph_groupname2group ? groupname->group cmph
idx_username2user len(user)*4*29/32 list of username2user indices cmph_username2user ? username->user cmph
Groups ? list of Group entries idx_gid2group len(group)*4*29/32 cmph->offset gid2group
Users ? list of User entries idx_groupname2group len(group)*4*29/32 cmph->offset groupname2group
Shells ? See "Shells" section idx_uid2user len(user)*4*29/32 cmph->offset uid2user
cmph_gid2group ? offset by offset_cmph_gid2group idx_username2user len(user)*4*29/32 cmph->offset username2user
cmph_uid2user ? offset by offset_cmph_uid2user Groups ? packed Group entries (8b padding)
cmph_groupname2group ? offset by offset_cmph_groupname2group Users ? packed User entries (8b padding)
cmph_username2user ? offset by offset_cmph_username2user Shells ? See "Shells" section
groupmembers ? offset by offset_groupmembers groupmembers ? per-group memberlist (32b padding)
additional_gids ? offset by offset_additional_gids additional_gids ? per-user grouplist (8b padding)
``` ```
[git-subtrac]: https://github.com/apenwarr/git-subtrac/ [git-subtrac]: https://github.com/apenwarr/git-subtrac/