moonshot

technical

jakel

jakel is the filesystem. files and directories are stored in the same parallel-array table the rest of the kernel uses for tasks and windows. an ata pio driver underneath persists the entire filesystem to a raw disk image, so files survive reboots.

nodes

every file and directory is a node in a fixed-size table. each node has a type (file or directory), a name, a parent id, a size, and a pointer to a heap buffer. for files the buffer holds raw bytes. for directories it holds an array of child node ids. the root directory is node zero, and it is its own parent.

directory children are stored as a contiguous array of 8-byte ids that grows on each add. a new buffer is allocated, the old children copied in, the new one appended, and the old buffer freed. the same allocate-copy-free pattern handles extending files on write.

paths

paths are slash-separated. an absolute path starts with / and resolves from the root. anything else resolves from the current working directory, which starts at the root and stays there until change moves it. .. goes up one level and there is no . yet. path resolution walks one component at a time, looking each up in the current directory's child table. if a non-directory appears before the last component the path is rejected.

api

the low-level interface is available to any kernel code, not just the shell.

shell

skalman gained four builtins that drive jakel.

disk persistence

the filesystem can be written to and loaded from an ata disk. jakel_sync serialises the entire state (a superblock, a node table with inline names, and raw file data) into 512-byte sectors on the disk. jakel_load reads it back at boot and reconstructs the in-memory tree. directory children are not serialised, they are rebuilt from parent pointers on load, which is simpler and harder to get wrong. the sync shell command triggers a manual flush, and the initial fresh filesystem is auto-synced so the second boot always loads from disk.