Support mknod for /dev/full and /dev/tty0

This commit is contained in:
jiangjianfeng 2025-11-18 09:04:21 +00:00 committed by Tate, Hongliang Tian
parent 10b719b962
commit 63354d670e
1 changed files with 8 additions and 1 deletions

View File

@ -88,9 +88,16 @@ pub fn get_device(devid: DeviceId) -> Result<Arc<dyn Device>> {
match (major, minor) {
(1, 3) => Ok(Arc::new(null::Null)),
(1, 5) => Ok(Arc::new(zero::Zero)),
(5, 0) => Ok(Arc::new(tty::TtyDevice)),
(1, 7) => Ok(Arc::new(full::Full)),
(1, 8) => Ok(Arc::new(random::Random)),
(1, 9) => Ok(Arc::new(urandom::Urandom)),
(4, minor) => {
let Some(tty) = tty::iter_n_tty().nth(minor as usize) else {
return_errno_with_message!(Errno::EINVAL, "the TTY minor ID is invalid");
};
Ok(tty.clone())
}
(5, 0) => Ok(Arc::new(tty::TtyDevice)),
_ => return_errno_with_message!(Errno::EINVAL, "the device ID is invalid or unsupported"),
}
}