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>
master
David Oberhollenzer 3 years ago
parent f95f02f6be
commit ab753a402f
  1. 10
      doc/fileformat.md
  2. 7
      include/pkg/pkgformat.h

@ -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.

@ -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;

Loading…
Cancel
Save