diff options
Diffstat (limited to '')
| -rw-r--r-- | rsnix/src/fat.rs | 12 |
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. | ||
| 170 | fn v() -> &'static mut Volume { | 173 | fn 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 | ||
| 174 | fn spc() -> usize { | 184 | fn spc() -> usize { |
