Fix dead code lints

This commit is contained in:
Ruihan Li 2025-03-21 15:32:05 +08:00 committed by Ruihan Li
parent ee9b63684b
commit bb1b41b413
3 changed files with 6 additions and 9 deletions

View File

@ -83,11 +83,6 @@ impl ProcessVmarGuard<'_> {
self.inner.as_ref().unwrap() self.inner.as_ref().unwrap()
} }
/// Sets a new VMAR for the binding process.
pub(super) fn set_new_vmar(&mut self, new_vmar: Vmar<Full>) {
*self.inner = Some(new_vmar);
}
/// Clears the VMAR of the binding process. /// Clears the VMAR of the binding process.
pub(super) fn clear(&mut self) { pub(super) fn clear(&mut self) {
*self.inner = None; *self.inner = None;

View File

@ -5,8 +5,6 @@
use alloc::collections::BTreeMap; use alloc::collections::BTreeMap;
use core::{any::TypeId, marker::PhantomData, ops::Range}; use core::{any::TypeId, marker::PhantomData, ops::Range};
use align_ext::AlignExt;
use super::{KERNEL_PAGE_TABLE, TRACKED_MAPPED_PAGES_RANGE, VMALLOC_VADDR_RANGE}; use super::{KERNEL_PAGE_TABLE, TRACKED_MAPPED_PAGES_RANGE, VMALLOC_VADDR_RANGE};
use crate::{ use crate::{
cpu::CpuSet, cpu::CpuSet,
@ -188,11 +186,15 @@ impl<M: AllocatorSelector + 'static> KVirtArea<M> {
self.range.start..self.range.end self.range.start..self.range.end
} }
#[cfg(ktest)]
pub fn len(&self) -> usize { pub fn len(&self) -> usize {
self.range.len() self.range.len()
} }
#[cfg(ktest)]
fn query_page(&self, addr: Vaddr) -> PageTableItem { fn query_page(&self, addr: Vaddr) -> PageTableItem {
use align_ext::AlignExt;
assert!(self.start() <= addr && self.end() >= addr); assert!(self.start() <= addr && self.end() >= addr);
let start = addr.align_down(PAGE_SIZE); let start = addr.align_down(PAGE_SIZE);
let vaddr = start..start + PAGE_SIZE; let vaddr = start..start + PAGE_SIZE;
@ -232,6 +234,7 @@ impl KVirtArea<Tracked> {
/// ///
/// This function returns None if the address is not mapped (`NotMapped`), /// This function returns None if the address is not mapped (`NotMapped`),
/// while panics if the address is mapped to a `MappedUntracked` or `PageTableNode` page. /// while panics if the address is mapped to a `MappedUntracked` or `PageTableNode` page.
#[cfg(ktest)]
pub fn get_page(&self, addr: Vaddr) -> Option<Frame<dyn AnyFrameMeta>> { pub fn get_page(&self, addr: Vaddr) -> Option<Frame<dyn AnyFrameMeta>> {
let query_result = self.query_page(addr); let query_result = self.query_page(addr);
match query_result { match query_result {
@ -288,6 +291,7 @@ impl KVirtArea<Untracked> {
/// ///
/// This function returns None if the address is not mapped (`NotMapped`), /// This function returns None if the address is not mapped (`NotMapped`),
/// while panics if the address is mapped to a `Mapped` or `PageTableNode` page. /// while panics if the address is mapped to a `Mapped` or `PageTableNode` page.
#[cfg(ktest)]
pub fn get_untracked_page(&self, addr: Vaddr) -> Option<(Paddr, usize)> { pub fn get_untracked_page(&self, addr: Vaddr) -> Option<(Paddr, usize)> {
let query_result = self.query_page(addr); let query_result = self.query_page(addr);
match query_result { match query_result {

View File

@ -1,7 +1,5 @@
// SPDX-License-Identifier: MPL-2.0 // SPDX-License-Identifier: MPL-2.0
#![expect(dead_code)]
//! Kernel memory space management. //! Kernel memory space management.
//! //!
//! The kernel memory space is currently managed as follows, if the //! The kernel memory space is currently managed as follows, if the