This repository has been archived on 2023-09-28. You can view files and clone it, but cannot push or open issues or pull requests.
homepage/content/projects/noxos/docs/codebase/drivers/fs/ustar.h.md

43 lines
4.2 KiB
Markdown
Raw Normal View History

---
title: "ustar.h"
summary: "specific driver for USTAR"
---
**Warning:** This is a filesystem specific driver, by this it should only be accessed by the [vfs](https://nerdcult.net/projects/noxos/docs/codebase/drivers/fs/vfs.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 [ustar_type_E](https://nerdcult.net/projects/noxos/docs/codebase/drivers/fs/ustar.h/#ustar_type_e---enum) 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_ |