refactor: fix non-doc warnings
This commit is contained in:
parent
7e04b11da8
commit
0a10b3c0b3
@ -10,14 +10,12 @@ use crate::dev::{
|
||||
use crate::mem::virt::DeviceMemoryIo;
|
||||
use crate::sync::IrqSafeSpinLock;
|
||||
use crate::util::InitOnce;
|
||||
use core::fmt;
|
||||
use libsys::error::Errno;
|
||||
use tock_registers::{
|
||||
interfaces::{ReadWriteable, Readable, Writeable},
|
||||
register_bitfields, register_structs,
|
||||
registers::{ReadOnly, ReadWrite, WriteOnly},
|
||||
};
|
||||
use vfs::CharDevice;
|
||||
|
||||
register_bitfields! {
|
||||
u32,
|
||||
|
@ -9,7 +9,6 @@ use libsys::{
|
||||
};
|
||||
use core::mem::size_of;
|
||||
use crate::syscall::arg::validate_user_ptr_struct;
|
||||
use vfs::CharDevice;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct CharRingInner<const N: usize> {
|
||||
@ -30,7 +29,7 @@ pub struct CharRing<const N: usize> {
|
||||
pub trait TtyDevice<const N: usize>: SerialDevice {
|
||||
fn ring(&self) -> &CharRing<N>;
|
||||
|
||||
fn tty_ioctl(&self, cmd: IoctlCmd, ptr: usize, len: usize) -> Result<usize, Errno> {
|
||||
fn tty_ioctl(&self, cmd: IoctlCmd, ptr: usize, _len: usize) -> Result<usize, Errno> {
|
||||
match cmd {
|
||||
IoctlCmd::TtyGetAttributes => {
|
||||
// TODO validate size
|
||||
@ -132,7 +131,7 @@ pub trait TtyDevice<const N: usize>: SerialDevice {
|
||||
let idx = data[..off].iter().rposition(|&ch| ch == b' ').unwrap_or(0);
|
||||
let len = off;
|
||||
|
||||
for i in idx..len {
|
||||
for _ in idx..len {
|
||||
self.raw_write(b"\x1B[D \x1B[D").ok();
|
||||
off -= 1;
|
||||
rem += 1;
|
||||
|
@ -2,9 +2,7 @@ use super::{PageInfo, PageUsage};
|
||||
use crate::mem::{virtualize, PAGE_SIZE};
|
||||
use crate::sync::IrqSafeSpinLock;
|
||||
use core::mem;
|
||||
use libsys::{
|
||||
error::Errno, mem::{memset, memcpy}
|
||||
};
|
||||
use libsys::{error::Errno, mem::memcpy};
|
||||
|
||||
pub unsafe trait Manager {
|
||||
fn alloc_page(&mut self, pu: PageUsage) -> Result<usize, Errno>;
|
||||
|
@ -227,7 +227,11 @@ impl Space {
|
||||
|
||||
let src_phys = unsafe { entry.address_unchecked() };
|
||||
if !entry.is_cow() {
|
||||
warnln!("Entry is not marked as CoW: {:#x}, points to {:#x}", virt, src_phys);
|
||||
warnln!(
|
||||
"Entry is not marked as CoW: {:#x}, points to {:#x}",
|
||||
virt,
|
||||
src_phys
|
||||
);
|
||||
return Err(Errno::DoesNotExist);
|
||||
}
|
||||
|
||||
@ -270,7 +274,7 @@ impl Space {
|
||||
unsafe {
|
||||
asm!("tlbi vaae1, {}", in(reg) virt_addr);
|
||||
}
|
||||
res.map(virt_addr, dst_phys, flags);
|
||||
res.map(virt_addr, dst_phys, flags)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -288,8 +292,7 @@ impl Space {
|
||||
}
|
||||
|
||||
assert!(l0_entry.is_table());
|
||||
let l1_table =
|
||||
unsafe { &mut *(mem::virtualize(l0_entry.address_unchecked()) as *mut Table) };
|
||||
let l1_table = &mut *(mem::virtualize(l0_entry.address_unchecked()) as *mut Table);
|
||||
|
||||
for l1i in 0..512 {
|
||||
let l1_entry = l1_table[l1i];
|
||||
@ -297,8 +300,7 @@ impl Space {
|
||||
continue;
|
||||
}
|
||||
assert!(l1_entry.is_table());
|
||||
let l2_table =
|
||||
unsafe { &mut *(mem::virtualize(l1_entry.address_unchecked()) as *mut Table) };
|
||||
let l2_table = &mut *(mem::virtualize(l1_entry.address_unchecked()) as *mut Table);
|
||||
|
||||
for l2i in 0..512 {
|
||||
let entry = l2_table[l2i];
|
||||
@ -307,20 +309,12 @@ impl Space {
|
||||
}
|
||||
|
||||
assert!(entry.is_table());
|
||||
unsafe {
|
||||
phys::free_page(unsafe { entry.address_unchecked() });
|
||||
phys::free_page(entry.address_unchecked()).unwrap();
|
||||
}
|
||||
phys::free_page(l1_entry.address_unchecked()).unwrap();
|
||||
}
|
||||
unsafe {
|
||||
phys::free_page(unsafe { l1_entry.address_unchecked() });
|
||||
phys::free_page(l0_entry.address_unchecked()).unwrap();
|
||||
}
|
||||
}
|
||||
unsafe {
|
||||
phys::free_page(unsafe { l0_entry.address_unchecked() });
|
||||
}
|
||||
}
|
||||
unsafe {
|
||||
memset(space as *mut Space as *mut u8, 0, 4096);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ use crate::error::Errno;
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[repr(u32)]
|
||||
#[non_exhaustive]
|
||||
pub enum IoctlCmd {
|
||||
TtySetAttributes = 1,
|
||||
TtyGetAttributes = 2,
|
||||
|
Loading…
x
Reference in New Issue
Block a user