1
0
Fork 0
mirror of https://github.com/pygos/pkg-utils.git synced 2024-06-22 03:40:13 +02:00

Shrink table of contents header

We aren't gonna need 2^32 uids/gids, this is a package manager, not a
file system. Also, mode only uses 16 of 32 bits. We can shrink the
entire header to 8 bytes.

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
David Oberhollenzer 2019-04-28 21:16:47 +02:00
parent f95f02f6be
commit ab753a402f
2 changed files with 5 additions and 12 deletions

View file

@ -105,14 +105,10 @@ table of contents contains an entry with the following common structure:
0 1 2 3
+-------+-------+-------+-------+
0 | mode |
0 | mode | user id |
+-------+-------+-------+-------+
1 | user id |
1 | group id | path length |
+-------+-------+-------+-------+
2 | group id |
+-------+-------+-------+-------+
3 | path length |
+---------------+
The mode field contains standard UNIX permissions. The user ID and group ID
fields contain the numeric IDs of the user and group respectively that own
@ -142,8 +138,6 @@ On the bit level, the mode field is structured as follows:
| +------------------------- set UID bit
+----------------------------- file type
The upper 16 bit of the mode filed must be set to zero.
Currently, the following file types are supported:
* `S_IFCHR` with a value of 2. The entry defines a character device.

View file

@ -36,10 +36,9 @@ typedef struct {
} record_t;
typedef struct {
uint32_t mode;
uint32_t uid;
uint32_t gid;
uint16_t mode;
uint16_t uid;
uint16_t gid;
uint16_t path_length;
/* uint8_t path[]; */
} toc_entry_t;