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
10 changed files with 40 additions and 28 deletions
|
@ -1,6 +1,6 @@
|
|||
use alloc::arc::{Arc, Weak};
|
||||
use collections::BTreeMap;
|
||||
use core::sync::atomic::{AtomicUsize, AtomicU64, Ordering};
|
||||
use core::sync::atomic::{AtomicU64, Ordering};
|
||||
use core::{mem, slice, usize};
|
||||
use spin::{Mutex, RwLock};
|
||||
|
||||
|
@ -10,6 +10,7 @@ use arch::paging::temporary_page::TemporaryPage;
|
|||
use context::{self, Context};
|
||||
use context::memory::Grant;
|
||||
use scheme::root::ROOT_SCHEME_ID;
|
||||
use scheme::{AtomicSchemeId, ATOMIC_SCHEMEID_INIT};
|
||||
use sync::{WaitQueue, WaitMap};
|
||||
use syscall::data::{Packet, Stat};
|
||||
use syscall::error::*;
|
||||
|
@ -20,7 +21,7 @@ use syscall::scheme::Scheme;
|
|||
pub struct UserInner {
|
||||
handle_id: usize,
|
||||
flags: usize,
|
||||
pub scheme_id: AtomicUsize,
|
||||
pub scheme_id: AtomicSchemeId,
|
||||
next_id: AtomicU64,
|
||||
context: Weak<RwLock<Context>>,
|
||||
todo: WaitQueue<Packet>,
|
||||
|
@ -33,7 +34,7 @@ impl UserInner {
|
|||
UserInner {
|
||||
handle_id: handle_id,
|
||||
flags: flags,
|
||||
scheme_id: AtomicUsize::new(0),
|
||||
scheme_id: ATOMIC_SCHEMEID_INIT,
|
||||
next_id: AtomicU64::new(1),
|
||||
context: context,
|
||||
todo: WaitQueue::new(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue