From 715e76bee0aad3434d9fb9110c768364f16d2bea Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Thu, 4 Feb 2021 10:29:12 +0800 Subject: [PATCH] kernel: allow connection IDs to be `u32` In an effort to homogonize platforms, we are moving away from `usize` in favour of `u32`. Allow the `CID` type to be a `u32` in the kernel by casting it to a `usize` as necessary. Signed-off-by: Sean Cross --- kernel/src/services.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/src/services.rs b/kernel/src/services.rs index 39c097767..0f27cf136 100644 --- a/kernel/src/services.rs +++ b/kernel/src/services.rs @@ -1497,7 +1497,7 @@ impl SystemServices { ArchProcess::with_inner(|process_inner| { assert_eq!(crate::arch::process::current_pid(), process_inner.pid); - if cid >= process_inner.connection_map.len() { + if (cid as usize) >= process_inner.connection_map.len() { // println!("KERNEL({}): CID {} > connection map len", crate::arch::process::current_pid(), cid); return None; } @@ -1505,7 +1505,7 @@ impl SystemServices { // println!("KERNEL({}): CID {} doesn't exist in the connection map", crate::arch::process::current_pid(), cid + 2); // println!("KERNEL({}): Process inner is: {:?}", crate::arch::process::current_pid(), process_inner); // } - let mut server_idx = process_inner.connection_map[cid]?.get() as usize; + let mut server_idx = process_inner.connection_map[cid as usize]?.get() as usize; if server_idx == 1 { // println!("KERNEL({}): CID {} is no longer valid", crate::arch::process::current_pid(), cid + 2); return None;