docs: documented USTAR implementation

This commit is contained in:
antifallobst 2023-02-28 00:35:44 +01:00
parent 0de9f843ba
commit fe9a425ca1
1 changed files with 48 additions and 2 deletions

View File

@ -304,6 +304,45 @@ This use of the vfs cache isn't a great solution and should be reworked.
Copies **_size_** bytes from the files' cache to **_buffer_out_**. Copies **_size_** bytes from the files' cache to **_buffer_out_**.
This won't copy more bytes than the allocated cache space is big. This won't copy more bytes than the allocated cache space is big.
### fs/ustar.h
The USTAR '_filesystem_' is probably more common known as **tar**-archive.
It is a really simple concept, where a file consists of a header block followed by data blocks.
These blocks are aligned at 512 bytes.
OSDev Wiki: [USTAR](https://wiki.osdev.org/USTAR)
#### `ustar_type_E` - enum
The types an entry can have:
- **File**
- **Hardlink**
- **Symlink**
- **Char Device**
- **Block Device**
- **Directory**
- **Pipe**
#### `ustar_header_T` - struct [packed / 512B aligned]
| Name | Type | Description |
|-------------------|-----------|------------------------------------------------------------------------------|
| name | char[100] | The name of the entry |
| mode | uint64_t | file mode (permissions, etc) |
| owner_id | uint64_t | The owners ID |
| group_id | uint64_t | The groups ID |
| size | char[12] | The size of the entry, represented as a string of an octal number (dafuq) |
| last_modification | char[12] | The unix-timestamp, when the entry was modified the last time |
| checksum | uint64_t | I think this is a weird checksum of the header |
| type | uint8_t | The type (`ustar_type_E`) of the entry, represented as ascii numbers (dafuq) |
| name_linked | char[100] | The path to the linked entry, if this is a link-entry |
| indicator | char[6] | This needs to be `ustar` |
| version | uint16_t | The version of the **tar** command, that created the archive |
| owner_user_name | char[32] | The name of the file owner |
| owner_group_name | char[32] | The name of the file group |
| device_major | uint64_t | The devices major number |
| device_minor | uint64_t | The devices minor number |
| name_prefix | char[155] | If this is not null, this acts as a prefix for _name_ |
### fs/vfs.h ### fs/vfs.h
**VFS** stands for _Virtual File System_ and is an abstraction, **VFS** stands for _Virtual File System_ and is an abstraction,
@ -434,6 +473,13 @@ Reads **_size_** bytes from **_file_** at **_position_** into **_buffer_out_**.
**Warning:** the current ramfs implementation will ignore **_position_**! **Warning:** the current ramfs implementation will ignore **_position_**!
#### `vfs_directory_create(filesystem, path)` - function (vfs_node_T*)
Creates a directory at **_path_** in **_filesystem_** and returns a pointer to it.
The directory in **_path_** needs to exist and the name of the new directory (after the last `/`) needs to not exist.
#### `vfs_directory_delete(directory)` - function (void) [not implemented yet]
Deletes a directory.
#### `vfs_init(boot_info)` - function (void) #### `vfs_init(boot_info)` - function (void)
Initializes the VFS. Initializes the VFS.
In future this will also unpack the initial ramdisk into the _temp_ directory. In future this will also unpack the initial ramdisk into the _temp_ directory.
@ -441,8 +487,8 @@ In future this will also unpack the initial ramdisk into the _temp_ directory.
#### `vfs_resolve_path(filesystem, path)` - function (vfs_node_T*) #### `vfs_resolve_path(filesystem, path)` - function (vfs_node_T*)
Returns the node at **_path_** or NULL if **_path_** is invalid. Returns the node at **_path_** or NULL if **_path_** is invalid.
#### `vfs_unpack_archive_ustar(node, archive)` - function (void) [Not Implemented yet] #### `vfs_unpack_archive_ustar(filesystem, archive)` - function (void)
This will unpack a USTAR-archive (**_archive_**) at **_node_**. This will unpack a USTAR-archive (**_archive_**) at **_filesystem_**'s root.
### graphics/color.h ### graphics/color.h