summaryrefslogtreecommitdiffstats
path: root/rsdos
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-08-01 03:44:57 +0200
committersalmonik <salmonik@tuta.io>2026-08-01 03:44:57 +0200
commit63d01e9d8eb6f3ccb6a96b7c577834276cf51add (patch)
treef490b9969a8f781f48c2f168dc3e6c71c41339a9 /rsdos
parentrustfmt: reflow fat.rs/fs.rs formatting (diff)
downloadrs-dos-63d01e9d8eb6f3ccb6a96b7c577834276cf51add.tar.gz
rs-dos-63d01e9d8eb6f3ccb6a96b7c577834276cf51add.zip
Clean up warnings, fix FAT32 multi-cluster dirs, prep for edition 2024
Warning cleanup (cargo check + clippy now 0 across the workspace): - Migrate all 21 static_mut_refs sites to &raw mut accessors (fat, gop, ps2, vt, ahci, interrupts, memory) so edition 2024 won't deny them - panic = "abort" profiles: bare cargo check/build now works without nightly/-Zbuild-std - Wire TICKS in the timer ISR (it was never incremented, so the vt scroll batching trigger was dead code) - Clippy: efi_main becomes unsafe extern "efiapi" with a # Safety doc, KeyBuf::new uses inline-const array repeat (no interior-mutable const), editor main loop is a while-let, PIT control byte regrouped - [workspace.lints.clippy] allows result_unit_err + needless_range_loop (deliberate kernel style); large_enum_variant allowed on LineInput - Drop now-stale static_mut_refs allow from the rsdos bin FAT32 correctness fixes (both pre-existing, exposed by the SFN fix): - Unique 8.3 short names: to_8_3() never disambiguated collisions, so files sharing a long-name prefix got identical SFNs and fsck reported duplicate directory entries. Add dir_short_names() + unique_short_name() (~N tails, Windows-style) and force LFN when the SFN changes. - Multi-cluster directories: scan_dir/dir_short_names stopped at the first 0x00 slot, hiding every entry written into a chained cluster (writes failed with 'cannot write', duplicate SFNs accumulated); add_dir_entry now packs the cluster (0xE5 deleted-markers) before extending so other FAT readers (mtools, Windows) see the continuation too. Other: delete dead fields (Disk.fis, Volume.fat_count), drop timer_irq/ keyboard_irq/rendered, refresh_and_exit is a documented unsafe fn, CONTEXT .md corrected (stable toolchain, IRQ input, 4-crate layout), .gitignore excludes .pi-subagents artifacts. Validated: cargo check/clippy/fmt clean, make test-disk PASS on fresh and reused images (incl. two directory-chain extensions and ~10 SFN tails), editor round-trip smoke test PASS.
Diffstat (limited to '')
-rw-r--r--rsdos/Cargo.toml3
-rw-r--r--rsdos/src/main.rs26
-rw-r--r--rsdosedit/Cargo.toml3
-rw-r--r--rsdosedit/src/lib.rs7
4 files changed, 19 insertions, 20 deletions
diff --git a/rsdos/Cargo.toml b/rsdos/Cargo.toml
index 5bf83fe..d09bd70 100644
--- a/rsdos/Cargo.toml
+++ b/rsdos/Cargo.toml
@@ -3,6 +3,9 @@ name = "rsdos"
3version.workspace = true 3version.workspace = true
4edition.workspace = true 4edition.workspace = true
5 5
6[lints]
7workspace = true
8
6[dependencies] 9[dependencies]
7rsnix = { path = "../rsnix" } 10rsnix = { path = "../rsnix" }
8shell = { path = "../shell" } 11shell = { path = "../shell" }
diff --git a/rsdos/src/main.rs b/rsdos/src/main.rs
index e6b7d2a..2ba5d32 100644
--- a/rsdos/src/main.rs
+++ b/rsdos/src/main.rs
@@ -1,6 +1,6 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3#![allow(static_mut_refs, unsafe_code)] 3#![allow(unsafe_code)]
4 4
5use core::panic::PanicInfo; 5use core::panic::PanicInfo;
6use rsnix::uefi::*; 6use rsnix::uefi::*;
@@ -31,8 +31,15 @@ fn panic(info: &PanicInfo) -> ! {
31// --------------------------------------------------------------------------- 31// ---------------------------------------------------------------------------
32// EFI entry point 32// EFI entry point
33// --------------------------------------------------------------------------- 33// ---------------------------------------------------------------------------
34/// EFI entry point.
35///
36/// # Safety
37///
38/// The firmware hands us raw pointers (image handle, system table) that
39/// must remain valid for the lifetime of the call — a contract guaranteed
40/// by the UEFI loader.
34#[no_mangle] 41#[no_mangle]
35pub extern "efiapi" fn efi_main(image_handle: Handle, system_table: *mut SystemTable) -> ! { 42pub unsafe extern "efiapi" fn efi_main(image_handle: Handle, system_table: *mut SystemTable) -> ! {
36 let st = unsafe { &mut *system_table }; 43 let st = unsafe { &mut *system_table };
37 let bs = unsafe { &mut *st.boot_services }; 44 let bs = unsafe { &mut *st.boot_services };
38 let con_out = unsafe { &mut *st.con_out }; 45 let con_out = unsafe { &mut *st.con_out };
@@ -83,22 +90,13 @@ pub extern "efiapi" fn efi_main(image_handle: Handle, system_table: *mut SystemT
83 rsnix::serial_println!("gop: not found (0x{:x})", gop_result); 90 rsnix::serial_println!("gop: not found (0x{:x})", gop_result);
84 } 91 }
85 rsnix::vt::init(); 92 rsnix::vt::init();
86 rsnix::serial_println!( 93 let (rows, cols) = rsnix::vt::size();
87 "vt: terminal ready ({}x{})", 94 rsnix::serial_println!("vt: terminal ready ({}x{})", rows, cols);
88 {
89 let (rows, cols) = rsnix::vt::size();
90 rows
91 },
92 {
93 let (rows, cols) = rsnix::vt::size();
94 cols
95 }
96 );
97 95
98 // ExitBootServices — we now own the machine 96 // ExitBootServices — we now own the machine
99 if unsafe { (bs.exit_boot_services)(image_handle, map_key) } != EFI_SUCCESS { 97 if unsafe { (bs.exit_boot_services)(image_handle, map_key) } != EFI_SUCCESS {
100 rsnix::serial_println!("WARN: ExitBootServices failed, retrying..."); 98 rsnix::serial_println!("WARN: ExitBootServices failed, retrying...");
101 match rsnix::memory::refresh_and_exit(bs, image_handle) { 99 match unsafe { rsnix::memory::refresh_and_exit(bs, image_handle) } {
102 Ok(_) => {} 100 Ok(_) => {}
103 Err(e) => { 101 Err(e) => {
104 rsnix::serial_println!("FATAL: cannot ExitBootServices (0x{:x})", e); 102 rsnix::serial_println!("FATAL: cannot ExitBootServices (0x{:x})", e);
diff --git a/rsdosedit/Cargo.toml b/rsdosedit/Cargo.toml
index a15375c..b271eef 100644
--- a/rsdosedit/Cargo.toml
+++ b/rsdosedit/Cargo.toml
@@ -3,5 +3,8 @@ name = "rsdosedit"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5 5
6[lints]
7workspace = true
8
6[dependencies] 9[dependencies]
7rsnix = { path = "../rsnix" } 10rsnix = { path = "../rsnix" }
diff --git a/rsdosedit/src/lib.rs b/rsdosedit/src/lib.rs
index 2d04da2..cfb3b0e 100644
--- a/rsdosedit/src/lib.rs
+++ b/rsdosedit/src/lib.rs
@@ -321,12 +321,7 @@ impl Editor {
321 fn run(&mut self) { 321 fn run(&mut self) {
322 self.draw_full(); 322 self.draw_full();
323 323
324 loop { 324 while let Some(b) = self.read_byte() {
325 let b = match self.read_byte() {
326 Some(b) => b,
327 None => break,
328 };
329
330 self.key_count += 1; 325 self.key_count += 1;
331 self.status_msg.clear(); 326 self.status_msg.clear();
332 327