User:Superleaf1995/lowFS: Difference between revisions

m
Bot: Replace deprecated source tag with syntaxhighlight
(just realized there is already a fs with that name :/)
m (Bot: Replace deprecated source tag with syntaxhighlight)
 
(4 intermediate revisions by one other user not shown)
Line 1:
{{stub}}
 
lowFS stands for '''UniversalLow FileSystemFilesystem''', simple huh?.
 
Is a table-filesystem designed by me (Superleaf1995) because why not?
Line 10:
 
== Bootsector ==
There are three ways to identify a lowFS disk: checking byte 0x02, checking the last 4 bytes of sector 4 or checking the last 4 bytes of the disk. It should contain the labelcharacters '_LF_LFFL' (ASCII). It should always be in big endian. Followed by a table:
<sourcesyntaxhighlight lang="c">
struct lowFS_megatable {
uint8_t attribute; // Attribute byte
uint64_t nlb; // Number of LBAs
uint8_t version; // lowFS version
union {
};
struct lowFS_floppy {
</source>
uint8_t heads;
uint8_t bytes_per_sector;
uint16_t sectors_per_track;
};
struct lowFS_non_floppy {
uint32_t n_lba;
};
}table;
uint16_t reserved;
}__attribute__((packed));
</syntaxhighlight>
 
Attribute:
Line 34 ⟶ 44:
| TBD
|}
 
* If all bits are set, the endianess is little, the disk has no bad sectors (assumed) and there are no checksums
 
== Entry ==
The entry header is basically like a FAT entry, however, this is a header ''for entries'' not for files.
<sourcesyntaxhighlight lang="c">
struct lowFS_entry_header {
uint8_t reserved; // Should always be 0xCC
Line 47 ⟶ 59:
uint64_t size; // Size of entry (lowFS_entry struct not included). If set to 0, the host must know the size parsing entry type
};
</syntaxhighlight>
</source>
 
* nn_entry should be set to 0 if this is the final part of the entry.
Line 56 ⟶ 68:
 
If entry_type is set to '''ENTRY_TYPE_FILEMETADATA''' (0xF0):
<sourcesyntaxhighlight lang="c">
struct lowFS_entry_filemetadata {
uint64_t filename_len; // length of filename
Line 64 ⟶ 76:
uint8_t perm; // use for unix permissions
};
</syntaxhighlight>
</source>
* Filename should be ended with a NULL character
 
If entry_type is set to '''ENTRY_TYPE_FILEPART''' (0xF2):
<sourcesyntaxhighlight lang="c">
struct lowFS_entry_filepart {
uint64_t clen; // Length of the bytes of the file
Line 74 ⟶ 86:
uint16_t checksum; // verifies that the data in the file is correct (First byte of content ANDed by the last one)
};
</syntaxhighlight>
</source>
 
If entry type is set to '''ENTRY_TYPE_DIRECTORYMETADATA''' (0xF4):
<sourcesyntaxhighlight lang="c">
struct lowFS_entry_directorymetadata {
uint64_t dirname_len; // length of dirname
Line 83 ⟶ 95:
uint8_t perm; // use for unix permissions
};
</syntaxhighlight>
</source>
 
== Checksum ==
Line 96 ⟶ 108:
A checksum cannot be after the last entry or entry header in a chain.
 
<sourcesyntaxhighlight lang="c">
struct lowFS_checksum {
uint16_t val; // 0x53BC
Line 102 ⟶ 114:
uint32_t fp; // FILEPART size high bytes
};
</syntaxhighlight>
</source>