User:Superleaf1995/lowFS: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
Content added Content deleted
(Created page with "uniFS stands for '''Universal FileSystem'''. == Spec == uniFS is a table-filesystem where each entry points to a portion of a file, this allows loading parts of the file prog...")
 
No edit summary
Line 17: Line 17:
</source>
</source>


nn_entry should be set to 0 if this is the final part of the entry.
* nn_entry should be set to 0 if this is the final part of the entry.
next_entry should be set to 0 if this is the final part of the chain of entries.
* next_entry should be set to 0 if this is the final part of the chain of entries.


== Entry types ==
== Entry types ==
Following the entry_t header, follows the contents of the entry. Notice that these varies in size, but always should align to 8-bytes.
Following the entry_t header, follows the contents of the entry. Notice that these varies in size, but always should align to 8-bytes.


If entry_type is set to ENTRY_TYPE_FILEMETADATA (0xF0):
If entry_type is set to '''ENTRY_TYPE_FILEMETADATA''' (0xF0):
<source lang="c">
<source lang="c">
struct unifs_entry_filemetadata {
struct unifs_entry_filemetadata {
Line 31: Line 31:
};
};
</source>
</source>
Filename should be ended with a NULL character as always.
* Filename should be ended with a NULL character


If entry_type is set to ENTRY_TYPE_FILEPART (0xF2):
If entry_type is set to '''ENTRY_TYPE_FILEPART''' (0xF2):
<source lang="c">
<source lang="c">
struct unifs_entry_filepart {
struct unifs_entry_filepart {
Line 43: Line 43:
</source>
</source>


If entry type is set to ENTRY_TYPE_DIRECTORYMETADATA (0xF4):
If entry type is set to '''ENTRY_TYPE_DIRECTORYMETADATA''' (0xF4):
<source lang="c">
<source lang="c">
struct unifs_entry_directorymetadata {
struct unifs_entry_directorymetadata {

Revision as of 11:47, 22 June 2020

uniFS stands for Universal FileSystem.

Spec

uniFS is a table-filesystem where each entry points to a portion of a file, this allows loading parts of the file progressively. If any of the tables is damaged, a checksum every 8 entries is made to ensure nothing is wrong. uniFS splits the entries into more entries (yeah). This solves the problem of "what happens if i have a 90-byte entry, but there is a small gap?". This ensures no gaps in the disk are left.

This filesystem also tries to be simple as possible, and be compatible with 16-bit hosts as well as 64-bit ones.

Entry

struct unifs_entry {
    uint8_t reserved;    // Should always be 0xCC
    uint8_t entry_type;  // Type of entry
    uint32_t name_len;   // Length of the name (variable, upon the OS how to handle)
    uint64_t nn_entry;     // Next part of this entry (pointer)
    uint64_t next_entry;   // Next entry in the table (pointer)
};
  • nn_entry should be set to 0 if this is the final part of the entry.
  • next_entry should be set to 0 if this is the final part of the chain of entries.

Entry types

Following the entry_t header, follows the contents of the entry. Notice that these varies in size, but always should align to 8-bytes.

If entry_type is set to ENTRY_TYPE_FILEMETADATA (0xF0):

struct unifs_entry_filemetadata {
    uint64_t filename_len; // length of filename
    uint64_t len; // length of file in bytes
    uint8_t filename[filename_len]; // variable size, kernel should alloc memory for incoming filename
};
  • Filename should be ended with a NULL character

If entry_type is set to ENTRY_TYPE_FILEPART (0xF2):

struct unifs_entry_filepart {
    uint64_t clen; // Length of the bytes of the file
    uint8_t content[clen]; // variable size, kernel should alloc memory for incoming file content
    uint16_t checksum; // verifies that the data in the file is correct (First byte of content ANDed by the last one)
    uint8_t perm; // use for unix permissions
};

If entry type is set to ENTRY_TYPE_DIRECTORYMETADATA (0xF4):

struct unifs_entry_directorymetadata {
    uint64_t dirname_len; // length of dirname
    uint8_t dirname[dirname_len]; // variable size, kernel should alloc memory for incoming dirname
    uint8_t perm; // use for unix permissions
};