shellpop skeleton
This commit is contained in:
44
README.md
44
README.md
@@ -66,10 +66,10 @@ consumed heap space for each separate turbonss instance will be minimal.
|
||||
Tight packing places some constraints on the underlying data:
|
||||
|
||||
- Maximum database size: 4GB.
|
||||
- Maximum length of username and groupname: 32 bytes.
|
||||
- Maximum length of shell and homedir: 64 bytes.
|
||||
- Maximum comment ("gecos") length: 256 bytes.
|
||||
- Username and groupname must be utf8-encoded.
|
||||
- Permitted length of username and groupname: 1-32 bytes.
|
||||
- Permitted length of shell and homedir: 1-64 bytes.
|
||||
- Permitted comment ("gecos") length: 0-255 bytes.
|
||||
- Username, groupname and gecos must be utf8-encoded.
|
||||
|
||||
Checking out and building
|
||||
-------------------------
|
||||
@@ -156,7 +156,7 @@ OFFSET TYPE NAME DESCRIPTION
|
||||
0 [4]u8 magic always 0xf09fa4b7
|
||||
4 u8 version now `0`
|
||||
5 u16 bom 0x1234
|
||||
7 u8 padding
|
||||
7 u6 num_shells max value: 63
|
||||
8 u32 num_users number of passwd entries
|
||||
12 u32 num_groups number of group entries
|
||||
16 u32 offset_cmph_uid2user
|
||||
@@ -165,9 +165,8 @@ OFFSET TYPE NAME DESCRIPTION
|
||||
28 u32 offset_idx offset to the first idx_ section
|
||||
32 u32 offset_groups
|
||||
36 u32 offset_users
|
||||
40 u32 offset_shells
|
||||
44 u32 offset_groupmembers
|
||||
48 u32 offset_additional_gids
|
||||
40 u32 offset_groupmembers
|
||||
44 u32 offset_additional_gids
|
||||
```
|
||||
|
||||
`magic` is 0xf09fa4b7, and `version` must be `0`. All integers are
|
||||
@@ -255,15 +254,25 @@ few examples: `/bin/bash`, `/usr/bin/nologin`, `/bin/zsh` among others.
|
||||
Therefore, "shells" have an optimization: they can be pointed by in the
|
||||
external list, or reside among the user's data.
|
||||
|
||||
64 (1>>6) most popular shells (i.e. referred to by at least two User entries)
|
||||
are stored externally in "Shells" area. The less popular ones are stored with
|
||||
63 most popular shells (i.e. referred to by at least two User entries) are
|
||||
stored externally in "Shells" area. The less popular ones are stored with
|
||||
userdata.
|
||||
|
||||
The `shell_here=true` bit signifies that the shell is stored with userdata.
|
||||
`false` means it is stored in the `Shells` section. If the shell is stored
|
||||
"here", it is the first element in `stringdata`, and it's length is
|
||||
`shell_len_or_place`. If it is stored externally, the latter variable points
|
||||
to it's index in the external storage.
|
||||
There are two "Shells" areas: the index and the blob. The index is a list of
|
||||
structs which point to a location in the "blob" area:
|
||||
|
||||
```
|
||||
const ShellIndex = struct {
|
||||
offset: u10,
|
||||
len: u6,
|
||||
};
|
||||
```
|
||||
|
||||
In the user's struct the `shell_here=true` bit signifies that the shell is
|
||||
stored with userdata. `false` means it is stored in the `Shells` section. If
|
||||
the shell is stored "here", it is the first element in `stringdata`, and it's
|
||||
length is `shell_len_or_place`. If it is stored externally, the latter variable
|
||||
points to it's index in the ShellIndex area.
|
||||
|
||||
Shells in the external storage are sorted by their weight, which is
|
||||
`length*frequency`.
|
||||
@@ -315,7 +324,7 @@ Each section is padded to 64 bytes.
|
||||
|
||||
```
|
||||
SECTION SIZE DESCRIPTION
|
||||
Header 52 see "Turbonss header" section
|
||||
Header 48 see "Turbonss header" section
|
||||
cmph_gid2group ? gid->group cmph
|
||||
cmph_uid2user ? uid->user cmph
|
||||
cmph_groupname2group ? groupname->group cmph
|
||||
@@ -324,9 +333,10 @@ idx_gid2group len(group)*4*29/32 cmph->offset gid2group
|
||||
idx_groupname2group len(group)*4*29/32 cmph->offset groupname2group
|
||||
idx_uid2user len(user)*4*29/32 cmph->offset uid2user
|
||||
idx_username2user len(user)*4*29/32 cmph->offset username2user
|
||||
ShellIndex len(shells)*2 Shell index array
|
||||
ShellBlob <= 4032 Shell data blob (max 63*64 bytes)
|
||||
Groups ? packed Group entries (8b padding)
|
||||
Users ? packed User entries (8b padding)
|
||||
Shells ? See "Shells" section
|
||||
groupmembers ? per-group memberlist (32b padding)
|
||||
additional_gids ? per-user grouplist (8b padding)
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user