Converting scheme ids into a new type SchemeId
Keeping scheme ids (and pids, and file handles, ...) as usize is a footgun. Let's remove it.
This commit is contained in:
parent
9f7c20bacf
commit
d16515ea12
1 changed files with 40 additions and 28 deletions
|
|
@ -2,6 +2,7 @@ use alloc::arc::{Arc, Weak};
|
|||
use collections::{BTreeMap, VecDeque};
|
||||
use core::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
|
||||
use spin::{Mutex, Once, RwLock, RwLockReadGuard, RwLockWriteGuard};
|
||||
use scheme::{AtomicSchemeId, ATOMIC_SCHEMEID_INIT};
|
||||
|
||||
use sync::WaitCondition;
|
||||
use syscall::error::{Error, Result, EBADF, EPIPE};
|
||||
|
|
@ -9,7 +10,7 @@ use syscall::flag::O_NONBLOCK;
|
|||
use syscall::scheme::Scheme;
|
||||
|
||||
/// Pipes list
|
||||
pub static PIPE_SCHEME_ID: AtomicUsize = ATOMIC_USIZE_INIT;
|
||||
pub static PIPE_SCHEME_ID: AtomicSchemeId = ATOMIC_SCHEMEID_INIT;
|
||||
static PIPE_NEXT_ID: AtomicUsize = ATOMIC_USIZE_INIT;
|
||||
static PIPES: Once<RwLock<(BTreeMap<usize, PipeRead>, BTreeMap<usize, PipeWrite>)>> = Once::new();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue