mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-22 08:53:29 +00:00
Rename inc_ref
to inc_ref_count
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
ef1fd645c2
commit
cc49384e96
@ -122,7 +122,7 @@ impl<M: PageMeta> Page<M> {
|
|||||||
///
|
///
|
||||||
/// The physical address must represent a valid page and the caller must already hold one
|
/// The physical address must represent a valid page and the caller must already hold one
|
||||||
/// reference count.
|
/// reference count.
|
||||||
pub(in crate::mm) unsafe fn inc_ref(paddr: Paddr) {
|
pub(in crate::mm) unsafe fn inc_ref_count(paddr: Paddr) {
|
||||||
let page = unsafe { ManuallyDrop::new(Self::from_raw(paddr)) };
|
let page = unsafe { ManuallyDrop::new(Self::from_raw(paddr)) };
|
||||||
let _page = page.clone();
|
let _page = page.clone();
|
||||||
}
|
}
|
||||||
@ -228,7 +228,7 @@ impl DynPage {
|
|||||||
///
|
///
|
||||||
/// The physical address must represent a valid page and the caller must already hold one
|
/// The physical address must represent a valid page and the caller must already hold one
|
||||||
/// reference count.
|
/// reference count.
|
||||||
pub(in crate::mm) unsafe fn inc_ref(paddr: Paddr) {
|
pub(in crate::mm) unsafe fn inc_ref_count(paddr: Paddr) {
|
||||||
let page = unsafe { ManuallyDrop::new(Self::from_raw(paddr)) };
|
let page = unsafe { ManuallyDrop::new(Self::from_raw(paddr)) };
|
||||||
let _page = page.clone();
|
let _page = page.clone();
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ where
|
|||||||
|
|
||||||
/// Creates a copy of the handle.
|
/// Creates a copy of the handle.
|
||||||
pub(super) fn clone_shallow(&self) -> Self {
|
pub(super) fn clone_shallow(&self) -> Self {
|
||||||
self.inc_ref();
|
self.inc_ref_count();
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
raw: self.raw,
|
raw: self.raw,
|
||||||
@ -127,7 +127,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Increment the reference count of the current page table.
|
// Increment the reference count of the current page table.
|
||||||
self.inc_ref();
|
self.inc_ref_count();
|
||||||
|
|
||||||
// Restore and drop the last activated page table.
|
// Restore and drop the last activated page table.
|
||||||
drop(Self {
|
drop(Self {
|
||||||
@ -143,16 +143,16 @@ where
|
|||||||
pub(super) unsafe fn first_activate(&self) {
|
pub(super) unsafe fn first_activate(&self) {
|
||||||
use crate::{arch::mm::activate_page_table, mm::CachePolicy};
|
use crate::{arch::mm::activate_page_table, mm::CachePolicy};
|
||||||
|
|
||||||
self.inc_ref();
|
self.inc_ref_count();
|
||||||
|
|
||||||
activate_page_table(self.raw, CachePolicy::Writeback);
|
activate_page_table(self.raw, CachePolicy::Writeback);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn inc_ref(&self) {
|
fn inc_ref_count(&self) {
|
||||||
// SAFETY: We have a reference count to the page and can safely increase the reference
|
// SAFETY: We have a reference count to the page and can safely increase the reference
|
||||||
// count by one more.
|
// count by one more.
|
||||||
unsafe {
|
unsafe {
|
||||||
Page::<PageTablePageMeta<E, C>>::inc_ref(self.paddr());
|
Page::<PageTablePageMeta<E, C>>::inc_ref_count(self.paddr());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -267,7 +267,7 @@ where
|
|||||||
// SAFETY: We have a reference count to the page and can safely increase the reference
|
// SAFETY: We have a reference count to the page and can safely increase the reference
|
||||||
// count by one more.
|
// count by one more.
|
||||||
unsafe {
|
unsafe {
|
||||||
Page::<PageTablePageMeta<E, C>>::inc_ref(paddr);
|
Page::<PageTablePageMeta<E, C>>::inc_ref_count(paddr);
|
||||||
}
|
}
|
||||||
Child::PageTable(RawPageTableNode {
|
Child::PageTable(RawPageTableNode {
|
||||||
raw: paddr,
|
raw: paddr,
|
||||||
@ -277,7 +277,7 @@ where
|
|||||||
// SAFETY: We have a reference count to the page and can safely increase the reference
|
// SAFETY: We have a reference count to the page and can safely increase the reference
|
||||||
// count by one more.
|
// count by one more.
|
||||||
unsafe {
|
unsafe {
|
||||||
DynPage::inc_ref(paddr);
|
DynPage::inc_ref_count(paddr);
|
||||||
}
|
}
|
||||||
Child::Page(unsafe { DynPage::from_raw(paddr) })
|
Child::Page(unsafe { DynPage::from_raw(paddr) })
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user