summaryrefslogtreecommitdiffstats
path: root/rsnix/src/fs.rs
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-07-31 16:43:04 +0200
committersalmonik <salmonik@tuta.io>2026-07-31 16:43:04 +0200
commit43c44ae6fe7dbfcf6af3e5e53c29f65bbf94c9c2 (patch)
tree3fe86cc049f154dc33202b6573e091d6cace7305 /rsnix/src/fs.rs
parentvfs: everything is a file — dirs, ramfs, character devices (diff)
downloadrs-dos-43c44ae6fe7dbfcf6af3e5e53c29f65bbf94c9c2.tar.gz
rs-dos-43c44ae6fe7dbfcf6af3e5e53c29f65bbf94c9c2.zip
shell: ^C cancels the line / aborts streams, ^D = EOF → poweroff
- ps2: Ctrl+C and Ctrl+D are now KeyEvents (ctrl modifier + c/d map); other Ctrl+key combos are swallowed - shell read_line: ^C clears the line and echoes '^C' (bash-style), ^D on an empty line echoes '^D' and shuts down (EOF), ^D with text on the line is ignored - cat/hexdump stream incrementally (was: build whole string then print) and check for ^C between chunks, so a running dump can be aborted - verified in QEMU: line cancel, standalone interrupt, ^C aborts an infinite 'cat /dev/zero' stream, ^D powers off
Diffstat (limited to '')
-rw-r--r--rsnix/src/fs.rs32
1 files changed, 22 insertions, 10 deletions
diff --git a/rsnix/src/fs.rs b/rsnix/src/fs.rs
index 56820bb..95a84bf 100644
--- a/rsnix/src/fs.rs
+++ b/rsnix/src/fs.rs
@@ -15,14 +15,14 @@
15 15
16extern crate alloc; 16extern crate alloc;
17 17
18use alloc::boxed::Box;
19use alloc::string::String;
20use alloc::vec::Vec;
21use crate::gop; 18use crate::gop;
22use crate::memory; 19use crate::memory;
23use crate::pci; 20use crate::pci;
24use crate::rtc; 21use crate::rtc;
25use crate::serial; 22use crate::serial;
23use alloc::boxed::Box;
24use alloc::string::String;
25use alloc::vec::Vec;
26 26
27/// /dev/mem covers the low physical-memory window (identity-mapped RAM). 27/// /dev/mem covers the low physical-memory window (identity-mapped RAM).
28pub const MEM_WINDOW: u64 = 64 * 1024; 28pub const MEM_WINDOW: u64 = 64 * 1024;
@@ -96,9 +96,24 @@ pub fn init() -> (usize, usize) {
96 let _tmp = add("tmp", Some(root), FileType::Dir, NodeData::Dir(Vec::new())); 96 let _tmp = add("tmp", Some(root), FileType::Dir, NodeData::Dir(Vec::new()));
97 let etc = add("etc", Some(root), FileType::Dir, NodeData::Dir(Vec::new())); 97 let etc = add("etc", Some(root), FileType::Dir, NodeData::Dir(Vec::new()));
98 98
99 add("mem", Some(dev), FileType::Char, NodeData::Char(CharDevice::Mem)); 99 add(
100 add("rtc", Some(dev), FileType::Char, NodeData::Char(CharDevice::Rtc)); 100 "mem",
101 add("pci", Some(dev), FileType::Char, NodeData::Char(CharDevice::Pci)); 101 Some(dev),
102 FileType::Char,
103 NodeData::Char(CharDevice::Mem),
104 );
105 add(
106 "rtc",
107 Some(dev),
108 FileType::Char,
109 NodeData::Char(CharDevice::Rtc),
110 );
111 add(
112 "pci",
113 Some(dev),
114 FileType::Char,
115 NodeData::Char(CharDevice::Pci),
116 );
102 add( 117 add(
103 "version", 118 "version",
104 Some(dev), 119 Some(dev),
@@ -146,10 +161,7 @@ pub fn init() -> (usize, usize) {
146 ), 161 ),
147 ); 162 );
148 163
149 let dirs = nodes() 164 let dirs = nodes().iter().filter(|n| n.kind == FileType::Dir).count();
150 .iter()
151 .filter(|n| n.kind == FileType::Dir)
152 .count();
153 let files = nodes().len() - dirs; 165 let files = nodes().len() - dirs;
154 (dirs, files) 166 (dirs, files)
155} 167}