diff --git a/ostd/src/mm/page/mod.rs b/ostd/src/mm/page/mod.rs index 199659bc7..eec7ffb77 100644 --- a/ostd/src/mm/page/mod.rs +++ b/ostd/src/mm/page/mod.rs @@ -153,14 +153,14 @@ impl Page { unsafe { &*(self.ptr as *const M) } } - fn get_ref_count(&self) -> &AtomicU32 { + fn ref_count(&self) -> &AtomicU32 { unsafe { &(*self.ptr).ref_count } } } impl Clone for Page { fn clone(&self) -> Self { - self.get_ref_count().fetch_add(1, Ordering::Relaxed); + self.ref_count().fetch_add(1, Ordering::Relaxed); Self { ptr: self.ptr, _marker: PhantomData, @@ -170,7 +170,7 @@ impl Clone for Page { impl Drop for Page { fn drop(&mut self) { - let last_ref_cnt = self.get_ref_count().fetch_sub(1, Ordering::Release); + let last_ref_cnt = self.ref_count().fetch_sub(1, Ordering::Release); debug_assert!(last_ref_cnt > 0); if last_ref_cnt == 1 { // A fence is needed here with the same reasons stated in the implementation of @@ -256,7 +256,7 @@ impl DynPage { num::FromPrimitive::from_u8(usage_raw).unwrap() } - fn get_ref_count(&self) -> &AtomicU32 { + fn ref_count(&self) -> &AtomicU32 { unsafe { &(*self.ptr).ref_count } } } @@ -298,14 +298,14 @@ impl From for DynPage { impl Clone for DynPage { fn clone(&self) -> Self { - self.get_ref_count().fetch_add(1, Ordering::Relaxed); + self.ref_count().fetch_add(1, Ordering::Relaxed); Self { ptr: self.ptr } } } impl Drop for DynPage { fn drop(&mut self) { - let last_ref_cnt = self.get_ref_count().fetch_sub(1, Ordering::Release); + let last_ref_cnt = self.ref_count().fetch_sub(1, Ordering::Release); debug_assert!(last_ref_cnt > 0); if last_ref_cnt == 1 { // A fence is needed here with the same reasons stated in the implementation of