1
Fork 0

rename username2user

This commit is contained in:
Motiejus Jakštys 2022-02-19 16:09:46 +02:00 committed by Motiejus Jakštys
parent ca28332126
commit 5f0d9bb176
1 changed files with 5 additions and 5 deletions

View File

@ -47,7 +47,7 @@ resolve a username to a `struct passwd*`:
be done once, when the NSS library is loaded (or on the first call).
- Hash the username using a perfect hash function. Perfect hash function
returns a number `n ∈ [0,N-1]`, where N is the total number of users.
- Jump to the `n`'th location in the `idx_username2user` section (by pointer
- Jump to the `n`'th location in the `idx_name2user` section (by pointer
arithmetic), which contains the index `i` to the user's information.
- Jump to the location `i` of section `Users` (again, using pointer arithmetic)
which stores the full user information.
@ -55,7 +55,7 @@ resolve a username to a `struct passwd*`:
return it to the caller.
In total, that's one hash for the username (~150ns), two pointer jumps within
the group file (to sections `idx_username2user` and `Users`), and, now that the
the group file (to sections `idx_name2user` and `Users`), and, now that the
user record is found, `memcpy` for each field.
The turbonss DB file is be `mmap`-ed, making it simple to implement pointer
@ -164,7 +164,7 @@ OFFSET TYPE NAME DESCRIPTION
12 u32 num_groups number of group entries
16 u32 offset_bdz_uid2user
20 u32 offset_bdz_groupname2group
24 u32 offset_bdz_username2user
24 u32 offset_bdz_name2user
28 u32 offset_idx offset to the first idx_ section
32 u32 offset_groups
36 u32 offset_users
@ -335,11 +335,11 @@ Header 48 see "Turbonss header" section
bdz_gid2group ? gid->group bdz
bdz_uid2user ? uid->user bdz
bdz_groupname2group ? groupname->group bdz
bdz_username2user ? username->user bdz
bdz_name2user ? username->user bdz
idx_gid2group len(group)*4*29/32 bdz->offset gid2group
idx_groupname2group len(group)*4*29/32 bdz->offset groupname2group
idx_uid2user len(user)*4*29/32 bdz->offset uid2user
idx_username2user len(user)*4*29/32 bdz->offset username2user
idx_name2user len(user)*4*29/32 bdz->offset name2user
ShellIndex len(shells)*2 Shell index array
ShellBlob <= 4032 Shell data blob (max 63*64 bytes)
Groups ? packed Group entries (8b padding)