Remove superfluous use of lazy_static (#364)

This commit is contained in:
Vincent Ollivier 2022-06-30 07:15:58 +02:00 committed by GitHub
parent e4ce2ab59c
commit b202192810
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 20 deletions

View File

@ -4,14 +4,10 @@ use alloc::string::String;
use alloc::string::ToString;
use core::fmt;
use core::sync::atomic::{AtomicBool, Ordering};
use lazy_static::lazy_static;
use spin::Mutex;
use x86_64::instructions::interrupts;
lazy_static! {
pub static ref STDIN: Mutex<String> = Mutex::new(String::new());
}
pub static STDIN: Mutex<String> = Mutex::new(String::new());
pub static ECHO: AtomicBool = AtomicBool::new(true);
pub static RAW: AtomicBool = AtomicBool::new(false);

View File

@ -6,12 +6,9 @@ use crate::sys;
use alloc::vec;
use alloc::vec::Vec;
use lazy_static::lazy_static;
use spin::Mutex;
lazy_static! {
pub static ref BLOCK_DEVICE: Mutex<Option<BlockDevice>> = Mutex::new(None);
}
pub static BLOCK_DEVICE: Mutex<Option<BlockDevice>> = Mutex::new(None);
pub enum BlockDevice {
Mem(MemBlockDevice),

View File

@ -5,7 +5,7 @@ use x86_64::instructions::tables::load_tss;
use x86_64::structures::gdt::{Descriptor, GlobalDescriptorTable, SegmentSelector};
use x86_64::structures::tss::TaskStateSegment;
const STACK_SIZE: usize = 8192;
const STACK_SIZE: usize = 1024 * 8;
pub const DOUBLE_FAULT_IST_INDEX: u16 = 0;
pub const PAGE_FAULT_IST_INDEX: u16 = 1;
pub const GENERAL_PROTECTION_FAULT_IST_INDEX: u16 = 2;

View File

@ -2,14 +2,12 @@ use crate::sys;
use crate::api::syscall;
use core::sync::atomic::{AtomicBool, Ordering};
use lazy_static::lazy_static;
use pc_keyboard::{layouts, DecodedKey, Error, HandleControl, KeyState, KeyCode, KeyEvent, Keyboard, ScancodeSet1};
use spin::Mutex;
use x86_64::instructions::port::Port;
lazy_static! {
pub static ref KEYBOARD: Mutex<Option<KeyboardLayout>> = Mutex::new(None);
}
pub static KEYBOARD: Mutex<Option<KeyboardLayout>> = Mutex::new(None);
pub static ALT: AtomicBool = AtomicBool::new(false);
pub static CTRL: AtomicBool = AtomicBool::new(false);
pub static SHIFT: AtomicBool = AtomicBool::new(false);

View File

@ -5,7 +5,6 @@ use alloc::sync::Arc;
use alloc::vec::Vec;
use alloc::vec;
use core::sync::atomic::{AtomicBool, AtomicU64, Ordering};
use lazy_static::lazy_static;
use smoltcp::iface::{InterfaceBuilder, NeighborCache, Routes};
use smoltcp::phy::DeviceCapabilities;
use smoltcp::phy::{Device, Medium};
@ -18,9 +17,7 @@ mod pcnet;
pub type Interface = smoltcp::iface::Interface<'static, EthernetDevice>;
lazy_static! {
pub static ref IFACE: Mutex<Option<Interface>> = Mutex::new(None);
}
pub static IFACE: Mutex<Option<Interface>> = Mutex::new(None);
#[derive(Clone)]
pub enum EthernetDevice {

View File

@ -17,9 +17,10 @@ const MAX_FILE_HANDLES: usize = 64;
const MAX_PROCS: usize = 2; // TODO: Update this when more than one process can run at once
const MAX_PROC_SIZE: usize = 1 << 20; // 1 MB
pub static PID: AtomicUsize = AtomicUsize::new(0);
pub static MAX_PID: AtomicUsize = AtomicUsize::new(1);
lazy_static! {
pub static ref PID: AtomicUsize = AtomicUsize::new(0);
pub static ref MAX_PID: AtomicUsize = AtomicUsize::new(1);
pub static ref PROCESS_TABLE: RwLock<[Box<Process>; MAX_PROCS]> = RwLock::new([(); MAX_PROCS].map(|_| Box::new(Process::new(0))));
}