summaryrefslogtreecommitdiffstats
path: root/rsnix/src/fat.rs
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-08-01 18:25:55 +0200
committersalmonik <salmonik@tuta.io>2026-08-01 18:25:55 +0200
commit1ea2f68e6a9af135e6cb3274fdf28d4ddc5812d5 (patch)
treef28246586e387293d0c8beaf6b445210aaab8c48 /rsnix/src/fat.rs
parentklog/tty/pager: no more truncated lines — full lines flow, terminal wraps (diff)
downloadrs-dos-1ea2f68e6a9af135e6cb3274fdf28d4ddc5812d5.tar.gz
rs-dos-1ea2f68e6a9af135e6cb3274fdf28d4ddc5812d5.zip
fix pi-lens warnings: unwraps, shell SC2046, dup code (fmtbuf/scripts/hexdump/cat/ahci/pci)
- memory.rs: self-test Layout::from_size_align no longer panics — the test fails cleanly on an invalid layout - fat.rs: v() no longer unwraps the active-volume slot — invariant violation logs + halts instead of panicking mid-disk-io - strbuf: shared FmtBuf replaces the duplicated PanicBuf/FmtBuf (main.rs + sched.rs) - test-disk.sh: SC2046 — conditional --fresh arg no longer relies on word splitting - scripts: boot.sh/boot-image.sh share lib-boot-args.sh (dup args loop) - shell: cat/hexdump stdin pairs unified with Option<&str> marker; hexdump format_row folded into format_partial - ahci: read/write_sectors unified behind dma_sectors - pci: config_read/write share config_addr
Diffstat (limited to '')
-rw-r--r--rsnix/src/fat.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/rsnix/src/fat.rs b/rsnix/src/fat.rs
index bad01cd..eda81ed 100644
--- a/rsnix/src/fat.rs
+++ b/rsnix/src/fat.rs
@@ -167,8 +167,18 @@ fn write_sector(lba: u64, data: &[u8; SECTOR]) -> Result<(), ()> {
167 167
168// --- cluster math ---------------------------------------------------------- 168// --- cluster math ----------------------------------------------------------
169 169
170/// Current volume's metadata — only ever reached with a selected volume
171/// (the fs layer calls `select_vol` first), so a missing slot is a kernel
172/// invariant violation, not a recoverable error.
170fn v() -> &'static mut Volume { 173fn v() -> &'static mut Volume {
171 vols().get_mut(*active_vol()).unwrap() 174 let i = *active_vol();
175 match vols().get_mut(i) {
176 Some(v) => v,
177 None => {
178 crate::serial_println!("fat: internal error — no volume at slot {}", i);
179 crate::interrupts::halt();
180 }
181 }
172} 182}
173 183
174fn spc() -> usize { 184fn spc() -> usize {