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:
David Teller 2016-11-04 13:49:44 +01:00
commit d16515ea12

View file

@ -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();