***: fix warnings in check/clippy

This commit is contained in:
Mark Poliakov 2023-07-22 00:45:14 +03:00
parent 867edf7748
commit 8642556b33
5 changed files with 17 additions and 4 deletions

View File

@ -22,11 +22,13 @@ bitflags! {
pub type FileRef = Rc<RefCell<File>>;
enum DirectoryPosition {
DiskPosition(u64),
// TODO not the best implementation, but at least somewhat safe?
CachePosition(usize),
Dot,
DotDot,
#[allow(dead_code)]
DiskPosition(u64),
#[allow(dead_code)]
End,
}

View File

@ -80,6 +80,8 @@ bitflags! {
/// For page/block mappings, only allows read access for EL0/EL1
const AP_BOTH_READONLY = 3 << 6;
/// Indicates the mapping is unique to a specific ASID (important for proper TLB
/// maintenance)
const NON_GLOBAL = 1 << 11;
}
}

View File

@ -78,6 +78,11 @@ impl PhysicalMemoryManager {
Err(Error::OutOfMemory)
}
/// Deallocates a physical memory page.
///
/// # Safety
///
/// `addr` must be a page-aligned physical address previously allocated by this implementation.
pub unsafe fn free_page(&mut self, addr: usize) {
assert!(addr > self.offset);
let index = (addr - self.offset) / 0x1000;

View File

@ -2,7 +2,6 @@
use core::{iter::StepBy, mem::size_of, ops::Range};
use abi::error::Error;
use spinning_top::Spinlock;
use crate::{
absolute_address,
@ -81,6 +80,11 @@ pub fn alloc_pages_contiguous(count: usize, usage: PageUsage) -> Result<usize, E
.alloc_contiguous_pages(count, usage)
}
/// Deallocates a physical memory page.
///
/// # Safety
///
/// `addr` must be a page-aligned physical address previously allocated by this implementation.
pub unsafe fn free_page(addr: usize) {
PHYSICAL_MEMORY.get().lock().free_page(addr)
}

View File

@ -1,5 +1,5 @@
//! System function call handlers
use core::{mem::MaybeUninit, sync::atomic::AtomicUsize, time::Duration};
use core::{mem::MaybeUninit, time::Duration};
use abi::{
error::Error,
@ -178,7 +178,7 @@ fn syscall_handler(func: SyscallFunction, args: &[u64]) -> Result<usize, Error>
)?;
let proc = Process::current();
let mut io = proc.io.lock();
let io = proc.io.lock();
let file = io.file(fd)?;
let mut file_borrow = file.borrow_mut();