summaryrefslogtreecommitdiffstats
path: root/rsdos/src/main.rs
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 /rsdos/src/main.rs
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 '')
-rw-r--r--rsdos/src/main.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/rsdos/src/main.rs b/rsdos/src/main.rs
index 181d3e2..e6b7d2a 100644
--- a/rsdos/src/main.rs
+++ b/rsdos/src/main.rs
@@ -166,15 +166,11 @@ pub extern "efiapi" fn efi_main(image_handle: Handle, system_table: *mut SystemT
166 let devices = rsnix::pci::probe(); 166 let devices = rsnix::pci::probe();
167 rsnix::serial_println!("pci: {} device(s) on all buses", devices.len()); 167 rsnix::serial_println!("pci: {} device(s) on all buses", devices.len());
168 168
169 // Disk: AHCI SATA driver, then mount a FAT32 volume if one is attached. 169 // Disk: AHCI SATA driver, then mount every FAT32 volume under /disk/<UID>/.
170 if !rsnix::ahci::init() { 170 if !rsnix::ahci::init() {
171 rsnix::serial_println!("ahci: no disk attached"); 171 rsnix::serial_println!("ahci: no disk attached");
172 } 172 }
173 if rsnix::fat::init() { 173 rsnix::fat::init(); // prints one line per mounted volume
174 rsnix::serial_println!("fat: volume mounted at /disk");
175 } else {
176 rsnix::serial_println!("fat: no FAT32 volume");
177 }
178 174
179 let (dirs, files) = rsnix::fs::init(); 175 let (dirs, files) = rsnix::fs::init();
180 rsnix::serial_println!("fs: vfs ready — {} dirs, {} files", dirs, files); 176 rsnix::serial_println!("fs: vfs ready — {} dirs, {} files", dirs, files);