Expand description
TFS, the Ternaria filesystem.
§What this is for
A filesystem the guest can implement in assembly, so that a shell exists before a compiler does. Every structure is sized to a whole number of trytes, every field is a whole word, and nothing needs multiplication by a number that is not a power of three to reach.
It is deliberately plain: no journal, no extents, no indirection. Those are not the interesting part of a ternary machine, and a format that can be driven by a few hundred instructions is worth more right now than one that cannot be driven at all.
§Layout
The unit is the block, which is one device sector: 243 trytes.
block 0 superblock
block 1..4 allocation map, one tryte per block
block 4..13 inode table, 9 inodes per block
block 13.. dataEvery one of those boundaries is recorded in the superblock, so a driver reads them rather than assuming them.
§Sizes
An inode is 27 trytes, so nine fit a block with nothing left over. A directory entry is also 27 trytes, so a directory block holds nine entries. Both numbers are 3^2, and a block is 3^5 trytes, so dividing an offset by an entry size is a trit shift rather than a division.
Re-exports§
pub use image::Builder;
Modules§
- image
- Building a TFS image on the host.
- ino
- Word offsets within an inode.
- kind
- What an inode describes.
- sb
- Word offsets within the superblock, which is block 0.
Constants§
- BLOCK_
TRYTES - Trytes per block. One device sector.
- BLOCK_
WORDS - Words per block.
- DIRECT_
BLOCKS - Direct block pointers in an inode.
- DIRENTS_
PER_ BLOCK - Directory entries per block.
- DIRENT_
TRYTES - Trytes in one directory entry. The same as an inode, so a driver walking either steps by the same amount.
- INODES_
PER_ BLOCK - Inodes per block: 3^2.
- INODE_
TRYTES - Trytes in one inode: 3^3.
- MAGIC
- Value identifying a TFS image, in word 0 of the superblock.
- MAX_
FILE_ TRYTES - Largest file the format can express, in trytes.
- NAME_
TRYTES - Trytes of name in a directory entry.
- ROOT_
INODE - Inode number of the root directory. Inode 0 means “none”.
- WORD_
TRYTES - Trytes per word.
Functions§
- prelude
- Assembler
.equlines naming every constant a driver needs.