Resolve lints in the TTY module

This commit is contained in:
Ruihan Li 2025-04-19 22:05:53 +08:00 committed by Jianfeng Jiang
parent 7de9666e65
commit 5e13e0c325
4 changed files with 5 additions and 24 deletions

View File

@ -1,7 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
#![expect(unused_variables)]
use crate::{
events::IoEvents,
fs::{
@ -41,17 +39,17 @@ impl Device for TtyDevice {
}
impl Pollable for TtyDevice {
fn poll(&self, mask: IoEvents, poller: Option<&mut PollHandle>) -> IoEvents {
fn poll(&self, _mask: IoEvents, _poller: Option<&mut PollHandle>) -> IoEvents {
IoEvents::empty()
}
}
impl FileIo for TtyDevice {
fn read(&self, writer: &mut VmWriter) -> Result<usize> {
fn read(&self, _writer: &mut VmWriter) -> Result<usize> {
return_errno_with_message!(Errno::EINVAL, "cannot read tty device");
}
fn write(&self, reader: &mut VmReader) -> Result<usize> {
fn write(&self, _reader: &mut VmReader) -> Result<usize> {
return_errno_with_message!(Errno::EINVAL, "cannot write tty device");
}
}

View File

@ -1,7 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
#![expect(dead_code)]
use ostd::mm::{Infallible, VmReader};
use spin::Once;
@ -86,11 +84,6 @@ fn console_input_callback(mut reader: VmReader<Infallible>) {
}
}
fn serial_input_callback(item: u8) {
let tty_driver = get_tty_driver();
tty_driver.push_char(item);
}
fn get_tty_driver() -> &'static TtyDriver {
TTY_DRIVER.get().unwrap()
}

View File

@ -1,7 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
#![expect(unused_variables)]
use alloc::format;
use ostd::{
@ -235,7 +233,7 @@ impl LineDiscipline {
let ctrl_char = format!("^{}", get_printable_char(ch));
echo_callback(&ctrl_char);
}
item => {}
_ => {}
}
}
@ -254,8 +252,6 @@ impl LineDiscipline {
(vmin, vtime)
};
let read_len = {
let len = self.read_buffer.lock().len();
let max_read_len = len.min(dst.len());
if vmin == 0 && vtime == 0 {
// poll read
self.poll_read(dst)
@ -402,11 +398,6 @@ fn get_printable_char(ctrl_char: u8) -> char {
char::from_u32((ctrl_char + b'A' - 1) as u32).unwrap()
}
enum PolleeType {
Add,
Del,
}
struct LineDisciplineWorkPara {
kernel_signal: Option<KernelSignal>,
}

View File

@ -1,7 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
#![expect(dead_code)]
use ostd::early_print;
use spin::Once;
@ -39,6 +37,7 @@ pub(super) fn init() {
pub struct Tty {
/// tty_name
#[expect(unused)]
name: CString,
/// line discipline
ldisc: Arc<LineDiscipline>,