User:Superleaf1995/lowFS: Difference between revisions

m
Bot: Replace deprecated source tag with syntaxhighlight
m (Bot: Replace deprecated source tag with syntaxhighlight)
 
Line 11:
== 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 characters 'LFFL' (ASCII). Followed by a table:
<sourcesyntaxhighlight lang="c">
struct lowFS_megatable {
uint8_t attribute; // Attribute byte
Line 27:
uint16_t reserved;
}__attribute__((packed));
</syntaxhighlight>
</source>
 
Attribute:
Line 49:
== 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 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 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 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 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 95:
uint8_t perm; // use for unix permissions
};
</syntaxhighlight>
</source>
 
== Checksum ==
Line 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 114:
uint32_t fp; // FILEPART size high bytes
};
</syntaxhighlight>
</source>