summaryrefslogtreecommitdiffstats
path: root/CONTEXT.md
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-08-01 02:19:07 +0200
committersalmonik <salmonik@tuta.io>2026-08-01 02:19:07 +0200
commit92ed4f6668efccf6af73f45654405d333e6a318c (patch)
treebb9b651dc36edcc90ae0289d7c4223d983454440 /CONTEXT.md
parentscripts: automate the data-disk workflow (mkdisk / sendkeys / test-disk) (diff)
downloadrs-dos-92ed4f6668efccf6af73f45654405d333e6a318c.tar.gz
rs-dos-92ed4f6668efccf6af73f45654405d333e6a318c.zip
fat: mount every FAT32 volume under /disk/<UID>/, fix multi-entry LFN
- fat.rs: VOL: Option<Volume> → VOLS: Vec<Volume>; try_mount() returns a Volume per disk and init() mounts every valid FAT32 volume found. Volume UID = sanitized uppercase label + 8-hex volume serial (e.g. RSDOS-5BD1E55F): unique per format, stable across reboots, human-recognizable, machine-parseable (^[A-Z0-9_]+-[0-9A-F]{8}$); cloned volumes get a -N suffix. Public ops take a vol index and select it (select_vol also picks the backing AHCI disk), matching the ahci::select pattern - fs.rs: /disk is now a plain directory whose children are one Disk node per mounted volume, named by UID; DiskInfo carries vol - LFN fix: entries are stored last-first on disk — both the writer (head-entry first) and reader (append in disk order) were reversed and cancelled out for ≤13-char names; multi-entry names (>13 chars) read back mangled (e.g. 'from-kernel.txt' as 'xt'). Writer now places seq=1 closest to the SFN and seq=N|0x40 first; reader places chunks by sequence number and trims at the first NUL. Verified with a 25-char filename round trip: kernel ls/cat correct, mtools shows the full LFN, fsck clean on both volumes - test-disk.sh: test file renamed to disk-test-.txt (>13 chars, exercises multi-entry LFN); UID discovered from the boot log; QEMU stdio redirected to a log file + EXIT trap so an orphaned QEMU can never hang a piped caller (it previously did, 400s)
Diffstat (limited to 'CONTEXT.md')
-rw-r--r--CONTEXT.md34
1 files changed, 21 insertions, 13 deletions
diff --git a/CONTEXT.md b/CONTEXT.md
index 39ce0bd..0d43b9f 100644
--- a/CONTEXT.md
+++ b/CONTEXT.md
@@ -168,19 +168,27 @@ Single Rust crate (`x86_64-unknown-uefi` target). Module breakdown:
168 geometry. Verified in QEMU: edit/type/navigate/insert/save/exit, exact 168 geometry. Verified in QEMU: edit/type/navigate/insert/save/exit, exact
169 bytes via `cat`/`hexdump`, syntax colours via framebuffer dump. 169 bytes via `cat`/`hexdump`, syntax colours via framebuffer dump.
170✅ **AHCI + FAT32 (persistent disk)** — a SATA AHCI driver (polling DMA, 170✅ **AHCI + FAT32 (persistent disk)** — a SATA AHCI driver (polling DMA,
171 no interrupts) plus a FAT32 filesystem, mounted as `/disk`; every shell 171 no interrupts) plus a FAT32 filesystem, mounted under `/disk/<UID>/`;
172 command works on disk paths: `ls`/`cat`/`hexdump`/`echo >`/`>>`/ 172 every shell command works on disk paths: `ls`/`cat`/`hexdump`/
173 `mkdir`/`touch`/`rm`/`edit`. The driver scans **all** implemented 173 `echo >`/`>>`/`mkdir`/`touch`/`rm`/`edit`. The driver scans **all**
174 ports (CAP.NP/PI) and starts every port with a device; `fat::init` 174 implemented ports (CAP.NP/PI) and starts every port with a device;
175 tries each disk in port order and mounts the first valid FAT32 175 `fat::init` mounts **every** valid FAT32 volume it finds, each under
176 volume — so the kernel finds the disk no matter which AHCI port the 176 `/disk/<UID>/` where UID = `<LABEL>-<8-hex-serial>` (e.g.
177 firmware/QEMU put it on (real hardware included). Whole-FAT cache with write-back to both 177 `RSDOS-5BD1E55F`) — sanitized uppercase label + volume serial, unique
178 FAT copies, checksum-validated LFN read/write, multi-cluster files, 178 per format, stable across reboots, human-recognizable and
179 space-padded `.`/`..` dot entries (`..` → cluster 0 under the root), 179 machine-parseable (`^[A-Z0-9_]+-[0-9A-F]{8}$`); cloned volumes get a
180 FSInfo free-count maintenance (fsck-clean after a session, verified 180 `-N` suffix. So the kernel finds the disks no matter which AHCI port
181 with `fsck.fat -n`). **Files survive reboot** — verified by 181 the firmware/QEMU put them on (real hardware included), and every
182 poweroff → `mdir`/`mtype` on the image and by a fresh boot seeing the 182 disk is visible at once (verified: `RSDOS-…` + `DATA2-…` mounted
183 prior session's files. 183 side by side, writes to both, fsck-clean). Whole-FAT cache per
184 volume with write-back to both FAT copies, checksum-validated LFN
185 read/write (multi-entry names >13 chars stored last-first on disk —
186 both the writer and reader were reversed and cancelled out; fixed),
187 multi-cluster files, space-padded `.`/`..` dot entries (`..` →
188 cluster 0 under the root), FSInfo free-count maintenance
189 (fsck-clean after a session, verified with `fsck.fat -n`).
190 **Files survive reboot** — verified by poweroff → `mdir`/`mtype` on
191 the image and by a fresh boot seeing the prior session's files.
184 192
185 QEMU setup: `-drive id=disk,if=none,format=raw,file=disk.img` + 193 QEMU setup: `-drive id=disk,if=none,format=raw,file=disk.img` +
186 `-device ide-hd,drive=disk,bus=ide.0` puts the data disk on AHCI port 194 `-device ide-hd,drive=disk,bus=ide.0` puts the data disk on AHCI port