From 3e9c4a8d45fe93edc454e9b72635d2289785589e Mon Sep 17 00:00:00 2001 From: Yuke Peng Date: Wed, 8 Mar 2023 22:08:10 -0800 Subject: [PATCH] Remove Cell --- src/framework/jinux-frame/src/cell.rs | 39 --------------------------- src/framework/jinux-frame/src/lib.rs | 1 - 2 files changed, 40 deletions(-) delete mode 100644 src/framework/jinux-frame/src/cell.rs diff --git a/src/framework/jinux-frame/src/cell.rs b/src/framework/jinux-frame/src/cell.rs deleted file mode 100644 index e6e0895dd..000000000 --- a/src/framework/jinux-frame/src/cell.rs +++ /dev/null @@ -1,39 +0,0 @@ -use core::{ - cell::UnsafeCell, - ops::{Deref, DerefMut}, -}; - -#[derive(Debug, Default)] -#[repr(transparent)] -pub struct Cell(UnsafeCell); - -unsafe impl Sync for Cell {} - -impl Cell { - /// User is responsible to guarantee that inner struct is only used in - /// uniprocessor. - #[inline(always)] - pub const fn new(val: T) -> Self { - Self(UnsafeCell::new(val)) - } - - #[inline(always)] - pub fn get(&self) -> &mut T { - unsafe { &mut *self.0.get() } - } -} - -impl Deref for Cell { - type Target = T; - #[inline(always)] - fn deref(&self) -> &Self::Target { - self.get() - } -} - -impl DerefMut for Cell { - #[inline(always)] - fn deref_mut(&mut self) -> &mut Self::Target { - self.get() - } -} diff --git a/src/framework/jinux-frame/src/lib.rs b/src/framework/jinux-frame/src/lib.rs index 48d576cb4..f90417a77 100644 --- a/src/framework/jinux-frame/src/lib.rs +++ b/src/framework/jinux-frame/src/lib.rs @@ -16,7 +16,6 @@ extern crate alloc; mod boot; -pub(crate) mod cell; pub mod config; pub mod cpu; pub mod device;