Make VirtioConsolesPrinter heapless

This commit is contained in:
Yuke Peng
2025-02-18 15:16:06 +08:00
committed by Tate, Hongliang Tian
parent d37e60d082
commit 96d83e43b4
2 changed files with 16 additions and 2 deletions

View File

@ -13,7 +13,7 @@ use core::any::Any;
use component::{init_component, ComponentInitError};
use ostd::{
mm::{Infallible, VmReader},
sync::SpinLock,
sync::{LocalIrqDisabled, SpinLock, SpinLockGuard},
};
use spin::Once;
@ -52,6 +52,16 @@ pub fn all_devices() -> Vec<(String, Arc<dyn AnyConsoleDevice>)> {
.collect()
}
pub fn all_devices_lock<'a>(
) -> SpinLockGuard<'a, BTreeMap<String, Arc<dyn AnyConsoleDevice>>, LocalIrqDisabled> {
COMPONENT
.get()
.unwrap()
.console_device_table
.disable_irq()
.lock()
}
static COMPONENT: Once<Component> = Once::new();
#[init_component]