diff options
| author | salmonik <salmonik@tuta.io> | 2026-08-01 03:44:57 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-08-01 03:44:57 +0200 |
| commit | 63d01e9d8eb6f3ccb6a96b7c577834276cf51add (patch) | |
| tree | f490b9969a8f781f48c2f168dc3e6c71c41339a9 /rsnix/src/ps2.rs | |
| parent | rustfmt: reflow fat.rs/fs.rs formatting (diff) | |
| download | rs-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-- | rsnix/src/ps2.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/rsnix/src/ps2.rs b/rsnix/src/ps2.rs index 4747813..35848b6 100644 --- a/rsnix/src/ps2.rs +++ b/rsnix/src/ps2.rs | |||
| @@ -263,8 +263,12 @@ pub fn try_poll_key() -> Option<KeyEvent> { | |||
| 263 | 263 | ||
| 264 | /// Process a single scancode byte. Returns Some(KeyEvent) when a visible | 264 | /// Process a single scancode byte. Returns Some(KeyEvent) when a visible |
| 265 | /// event happens; returns None for modifier changes, releases, and prefixes. | 265 | /// event happens; returns None for modifier changes, releases, and prefixes. |
| 266 | fn kbd() -> &'static mut KbdState { | ||
| 267 | unsafe { &mut *core::ptr::addr_of_mut!(KBD) } | ||
| 268 | } | ||
| 269 | |||
| 266 | fn process_byte(byte: u8) -> Option<KeyEvent> { | 270 | fn process_byte(byte: u8) -> Option<KeyEvent> { |
| 267 | let state = unsafe { &mut KBD }; | 271 | let state = kbd(); |
| 268 | 272 | ||
| 269 | if byte == 0xE0 { | 273 | if byte == 0xE0 { |
| 270 | state.got_e0 = true; | 274 | state.got_e0 = true; |
| @@ -368,7 +372,7 @@ fn process_e0(byte: u8) -> Option<KeyEvent> { | |||
| 368 | } | 372 | } |
| 369 | 373 | ||
| 370 | fn update_modifiers(scancode: u8, pressed: bool, e0: bool) { | 374 | fn update_modifiers(scancode: u8, pressed: bool, e0: bool) { |
| 371 | let state = unsafe { &mut KBD }; | 375 | let state = kbd(); |
| 372 | match (scancode, e0) { | 376 | match (scancode, e0) { |
| 373 | (0x2A, false) => set_mod(state, MOD_LSHIFT, pressed), | 377 | (0x2A, false) => set_mod(state, MOD_LSHIFT, pressed), |
| 374 | (0x36, false) => set_mod(state, MOD_RSHIFT, pressed), | 378 | (0x36, false) => set_mod(state, MOD_RSHIFT, pressed), |
| @@ -393,6 +397,6 @@ fn set_mod(state: &mut KbdState, bit: u8, pressed: bool) { | |||
| 393 | 397 | ||
| 394 | /// Is either Ctrl key held? | 398 | /// Is either Ctrl key held? |
| 395 | fn ctrl_held() -> bool { | 399 | fn ctrl_held() -> bool { |
| 396 | let state = unsafe { &mut KBD }; | 400 | let state = kbd(); |
| 397 | state.modifiers & (MOD_LCTRL | MOD_RCTRL) != 0 | 401 | state.modifiers & (MOD_LCTRL | MOD_RCTRL) != 0 |
| 398 | } | 402 | } |
