use alloc::{ boxed::Box, string::{String, ToString}, }; use hashbrown::HashMap; use crate::character_device::CharacterDevice; pub mod dev_null; pub mod dev_unicode; pub mod dev_zero; // FIXME: This is a hack to hold a device. pub enum Device { CharacterDevice(Box), // BlockDevice, } unsafe impl Sync for Device {} unsafe impl Send for Device {} pub struct DeviceTable { pub devices: HashMap, } use self::dev_null::DevNull; pub use self::Device::*; impl DeviceTable { pub fn new() -> Self { let mut table: HashMap = HashMap::new(); table.insert("null".to_string(), CharacterDevice(Box::new(DevNull))); DeviceTable { devices: table } } } lazy_static::lazy_static!( static ref DEVICE_TABLE: DeviceTable = DeviceTable::new(); );