Polish the doc and rename variables in ostd::mm

This commit is contained in:
Zhang Junyang
2024-12-25 22:53:24 +08:00
committed by Tate, Hongliang Tian
parent f332797084
commit 983a6af3cc
41 changed files with 430 additions and 414 deletions

View File

@ -12,7 +12,7 @@ use aster_block::{
};
use hashbrown::HashMap;
use lru::LruCache;
use ostd::mm::DynUFrame;
use ostd::mm::UFrame;
pub(super) use ostd::mm::VmIo;
use super::{
@ -368,7 +368,7 @@ impl ExfatFS {
}
impl PageCacheBackend for ExfatFS {
fn read_page_async(&self, idx: usize, frame: &DynUFrame) -> Result<BioWaiter> {
fn read_page_async(&self, idx: usize, frame: &UFrame) -> Result<BioWaiter> {
if self.fs_size() < idx * PAGE_SIZE {
return_errno_with_message!(Errno::EINVAL, "invalid read size")
}
@ -380,7 +380,7 @@ impl PageCacheBackend for ExfatFS {
Ok(waiter)
}
fn write_page_async(&self, idx: usize, frame: &DynUFrame) -> Result<BioWaiter> {
fn write_page_async(&self, idx: usize, frame: &UFrame) -> Result<BioWaiter> {
if self.fs_size() < idx * PAGE_SIZE {
return_errno_with_message!(Errno::EINVAL, "invalid write size")
}

View File

@ -13,7 +13,7 @@ use aster_block::{
BLOCK_SIZE,
};
use aster_rights::Full;
use ostd::mm::{DynUFrame, VmIo};
use ostd::mm::{UFrame, VmIo};
use super::{
constants::*,
@ -135,7 +135,7 @@ struct ExfatInodeInner {
}
impl PageCacheBackend for ExfatInode {
fn read_page_async(&self, idx: usize, frame: &DynUFrame) -> Result<BioWaiter> {
fn read_page_async(&self, idx: usize, frame: &UFrame) -> Result<BioWaiter> {
let inner = self.inner.read();
if inner.size < idx * PAGE_SIZE {
return_errno_with_message!(Errno::EINVAL, "Invalid read size")
@ -150,7 +150,7 @@ impl PageCacheBackend for ExfatInode {
Ok(waiter)
}
fn write_page_async(&self, idx: usize, frame: &DynUFrame) -> Result<BioWaiter> {
fn write_page_async(&self, idx: usize, frame: &UFrame) -> Result<BioWaiter> {
let inner = self.inner.read();
let sector_size = inner.fs().sector_size();

View File

@ -28,7 +28,7 @@ struct BlockGroupImpl {
impl BlockGroup {
/// Loads and constructs a block group.
pub fn load(
group_descriptors_segment: &DynUSegment,
group_descriptors_segment: &USegment,
idx: usize,
block_device: &dyn BlockDevice,
super_block: &SuperBlock,
@ -318,7 +318,7 @@ impl Debug for BlockGroup {
}
impl PageCacheBackend for BlockGroupImpl {
fn read_page_async(&self, idx: usize, frame: &DynUFrame) -> Result<BioWaiter> {
fn read_page_async(&self, idx: usize, frame: &UFrame) -> Result<BioWaiter> {
let bid = self.inode_table_bid + idx as Ext2Bid;
let bio_segment =
BioSegment::new_from_segment(frame.clone().into(), BioDirection::FromDevice);
@ -328,7 +328,7 @@ impl PageCacheBackend for BlockGroupImpl {
.read_blocks_async(bid, bio_segment)
}
fn write_page_async(&self, idx: usize, frame: &DynUFrame) -> Result<BioWaiter> {
fn write_page_async(&self, idx: usize, frame: &UFrame) -> Result<BioWaiter> {
let bid = self.inode_table_bid + idx as Ext2Bid;
let bio_segment =
BioSegment::new_from_segment(frame.clone().into(), BioDirection::ToDevice);

View File

@ -23,7 +23,7 @@ pub struct Ext2 {
blocks_per_group: Ext2Bid,
inode_size: usize,
block_size: usize,
group_descriptors_segment: DynUSegment,
group_descriptors_segment: USegment,
self_ref: Weak<Self>,
}
@ -63,7 +63,7 @@ impl Ext2 {
// Load the block groups information
let load_block_groups = |fs: Weak<Ext2>,
block_device: &dyn BlockDevice,
group_descriptors_segment: &DynUSegment|
group_descriptors_segment: &USegment|
-> Result<Vec<BlockGroup>> {
let block_groups_count = super_block.block_groups_count() as usize;
let mut block_groups = Vec::with_capacity(block_groups_count);

View File

@ -1733,7 +1733,7 @@ impl InodeImpl {
writer: &mut VmWriter,
) -> Result<BioWaiter>;
pub fn read_blocks(&self, bid: Ext2Bid, nblocks: usize, writer: &mut VmWriter) -> Result<()>;
pub fn read_block_async(&self, bid: Ext2Bid, frame: &DynUFrame) -> Result<BioWaiter>;
pub fn read_block_async(&self, bid: Ext2Bid, frame: &UFrame) -> Result<BioWaiter>;
pub fn write_blocks_async(
&self,
bid: Ext2Bid,
@ -1741,7 +1741,7 @@ impl InodeImpl {
reader: &mut VmReader,
) -> Result<BioWaiter>;
pub fn write_blocks(&self, bid: Ext2Bid, nblocks: usize, reader: &mut VmReader) -> Result<()>;
pub fn write_block_async(&self, bid: Ext2Bid, frame: &DynUFrame) -> Result<BioWaiter>;
pub fn write_block_async(&self, bid: Ext2Bid, frame: &UFrame) -> Result<BioWaiter>;
}
/// Manages the inode blocks and block I/O operations.
@ -1789,7 +1789,7 @@ impl InodeBlockManager {
}
}
pub fn read_block_async(&self, bid: Ext2Bid, frame: &DynUFrame) -> Result<BioWaiter> {
pub fn read_block_async(&self, bid: Ext2Bid, frame: &UFrame) -> Result<BioWaiter> {
let mut bio_waiter = BioWaiter::new();
for dev_range in DeviceRangeReader::new(self, bid..bid + 1 as Ext2Bid)? {
@ -1834,7 +1834,7 @@ impl InodeBlockManager {
}
}
pub fn write_block_async(&self, bid: Ext2Bid, frame: &DynUFrame) -> Result<BioWaiter> {
pub fn write_block_async(&self, bid: Ext2Bid, frame: &UFrame) -> Result<BioWaiter> {
let mut bio_waiter = BioWaiter::new();
for dev_range in DeviceRangeReader::new(self, bid..bid + 1 as Ext2Bid)? {
@ -1858,12 +1858,12 @@ impl InodeBlockManager {
}
impl PageCacheBackend for InodeBlockManager {
fn read_page_async(&self, idx: usize, frame: &DynUFrame) -> Result<BioWaiter> {
fn read_page_async(&self, idx: usize, frame: &UFrame) -> Result<BioWaiter> {
let bid = idx as Ext2Bid;
self.read_block_async(bid, frame)
}
fn write_page_async(&self, idx: usize, frame: &DynUFrame) -> Result<BioWaiter> {
fn write_page_async(&self, idx: usize, frame: &UFrame) -> Result<BioWaiter> {
let bid = idx as Ext2Bid;
self.write_block_async(bid, frame)
}

View File

@ -13,7 +13,7 @@ pub(super) use aster_block::{
};
pub(super) use aster_rights::Full;
pub(super) use ostd::{
mm::{DynUFrame, DynUSegment, Frame, FrameAllocOptions, Segment, VmIo},
mm::{Frame, FrameAllocOptions, Segment, UFrame, USegment, VmIo},
sync::{RwMutex, RwMutexReadGuard, RwMutexWriteGuard},
};
pub(super) use static_assertions::const_assert;

View File

@ -11,7 +11,7 @@ use aster_rights::Full;
use aster_util::slot_vec::SlotVec;
use hashbrown::HashMap;
use ostd::{
mm::{DynUFrame, UntypedMem, VmIo},
mm::{UFrame, UntypedMem, VmIo},
sync::{PreemptDisabled, RwLockWriteGuard},
};
@ -484,7 +484,7 @@ impl RamInode {
}
impl PageCacheBackend for RamInode {
fn read_page_async(&self, _idx: usize, frame: &DynUFrame) -> Result<BioWaiter> {
fn read_page_async(&self, _idx: usize, frame: &UFrame) -> Result<BioWaiter> {
// Initially, any block/page in a RamFs inode contains all zeros
frame
.writer()
@ -494,7 +494,7 @@ impl PageCacheBackend for RamInode {
Ok(BioWaiter::new())
}
fn write_page_async(&self, _idx: usize, _frame: &DynUFrame) -> Result<BioWaiter> {
fn write_page_async(&self, _idx: usize, _frame: &UFrame) -> Result<BioWaiter> {
// do nothing
Ok(BioWaiter::new())
}

View File

@ -14,7 +14,7 @@ use aster_rights::Full;
use lru::LruCache;
use ostd::{
impl_untyped_frame_meta_for,
mm::{DynUFrame, Frame, FrameAllocOptions, UntypedMem, VmIo},
mm::{Frame, FrameAllocOptions, UFrame, UntypedMem, VmIo},
};
use crate::{
@ -388,7 +388,7 @@ impl PageCacheManager {
Ok(())
}
fn ondemand_readahead(&self, idx: usize) -> Result<DynUFrame> {
fn ondemand_readahead(&self, idx: usize) -> Result<UFrame> {
let mut pages = self.pages.lock();
let mut ra_state = self.ra_state.lock();
let backend = self.backend();
@ -445,7 +445,7 @@ impl Debug for PageCacheManager {
}
impl Pager for PageCacheManager {
fn commit_page(&self, idx: usize) -> Result<DynUFrame> {
fn commit_page(&self, idx: usize) -> Result<UFrame> {
self.ondemand_readahead(idx)
}
@ -476,7 +476,7 @@ impl Pager for PageCacheManager {
Ok(())
}
fn commit_overwrite(&self, idx: usize) -> Result<DynUFrame> {
fn commit_overwrite(&self, idx: usize) -> Result<UFrame> {
if let Some(page) = self.pages.lock().get(&idx) {
return Ok(page.clone().into());
}
@ -573,16 +573,16 @@ impl AtomicPageState {
/// This trait represents the backend for the page cache.
pub trait PageCacheBackend: Sync + Send {
/// Reads a page from the backend asynchronously.
fn read_page_async(&self, idx: usize, frame: &DynUFrame) -> Result<BioWaiter>;
fn read_page_async(&self, idx: usize, frame: &UFrame) -> Result<BioWaiter>;
/// Writes a page to the backend asynchronously.
fn write_page_async(&self, idx: usize, frame: &DynUFrame) -> Result<BioWaiter>;
fn write_page_async(&self, idx: usize, frame: &UFrame) -> Result<BioWaiter>;
/// Returns the number of pages in the backend.
fn npages(&self) -> usize;
}
impl dyn PageCacheBackend {
/// Reads a page from the backend synchronously.
fn read_page(&self, idx: usize, frame: &DynUFrame) -> Result<()> {
fn read_page(&self, idx: usize, frame: &UFrame) -> Result<()> {
let waiter = self.read_page_async(idx, frame)?;
match waiter.wait() {
Some(BioStatus::Complete) => Ok(()),
@ -590,7 +590,7 @@ impl dyn PageCacheBackend {
}
}
/// Writes a page to the backend synchronously.
fn write_page(&self, idx: usize, frame: &DynUFrame) -> Result<()> {
fn write_page(&self, idx: usize, frame: &UFrame) -> Result<()> {
let waiter = self.write_page_async(idx, frame)?;
match waiter.wait() {
Some(BioStatus::Complete) => Ok(()),

View File

@ -21,7 +21,7 @@ use aster_rights::Rights;
use aster_time::{read_monotonic_time, Instant};
use aster_util::coeff::Coeff;
use ostd::{
mm::{DynUFrame, VmIo, PAGE_SIZE},
mm::{UFrame, VmIo, PAGE_SIZE},
sync::SpinLock,
Pod,
};
@ -199,9 +199,9 @@ struct Vdso {
data: SpinLock<VdsoData>,
/// The VMO of the entire VDSO, including the library text and the VDSO data.
vmo: Arc<Vmo>,
/// The `DynUFrame` that contains the VDSO data. This frame is contained in and
/// The `UFrame` that contains the VDSO data. This frame is contained in and
/// will not be removed from the VDSO VMO.
data_frame: DynUFrame,
data_frame: UFrame,
}
/// A `SpinLock` for the `seq` field in `VdsoData`.

View File

@ -1,13 +1,13 @@
// SPDX-License-Identifier: MPL-2.0
use ostd::mm::{DynUFrame, Frame, FrameAllocOptions, UntypedMem};
use ostd::mm::{Frame, FrameAllocOptions, UFrame, UntypedMem};
use crate::prelude::*;
/// Creates a new `Frame<()>` and initializes it with the contents of the `src`.
///
/// Note that it only duplicates the contents not the metadata.
pub fn duplicate_frame(src: &DynUFrame) -> Result<Frame<()>> {
pub fn duplicate_frame(src: &UFrame) -> Result<Frame<()>> {
let new_frame = FrameAllocOptions::new().zeroed(false).alloc_frame()?;
new_frame.writer().write(&mut src.reader());
Ok(new_frame)

View File

@ -8,8 +8,8 @@ use core::{
use align_ext::AlignExt;
use ostd::mm::{
tlb::TlbFlushOp, vm_space::VmItem, CachePolicy, DynUFrame, FrameAllocOptions, PageFlags,
PageProperty, VmSpace,
tlb::TlbFlushOp, vm_space::VmItem, CachePolicy, FrameAllocOptions, PageFlags, PageProperty,
UFrame, VmSpace,
};
use super::interval_set::Interval;
@ -216,7 +216,7 @@ impl VmMapping {
Ok(())
}
fn prepare_page(&self, page_fault_addr: Vaddr, write: bool) -> Result<(DynUFrame, bool)> {
fn prepare_page(&self, page_fault_addr: Vaddr, write: bool) -> Result<(UFrame, bool)> {
let mut is_readonly = false;
let Some(vmo) = &self.vmo else {
return Ok((FrameAllocOptions::new().alloc_frame()?.into(), is_readonly));
@ -264,7 +264,7 @@ impl VmMapping {
let vm_perms = self.perms - VmPerms::WRITE;
let mut cursor = vm_space.cursor_mut(&(start_addr..end_addr))?;
let operate = move |commit_fn: &mut dyn FnMut() -> Result<DynUFrame>| {
let operate = move |commit_fn: &mut dyn FnMut() -> Result<UFrame>| {
if let VmItem::NotMapped { .. } = cursor.query().unwrap() {
// We regard all the surrounding pages as accessed, no matter
// if it is really so. Then the hardware won't bother to update
@ -432,7 +432,7 @@ impl MappedVmo {
///
/// If the VMO has not committed a frame at this index, it will commit
/// one first and return it.
fn get_committed_frame(&self, page_offset: usize) -> Result<DynUFrame> {
fn get_committed_frame(&self, page_offset: usize) -> Result<UFrame> {
debug_assert!(page_offset < self.range.len());
debug_assert!(page_offset % PAGE_SIZE == 0);
self.vmo.commit_page(self.range.start + page_offset)
@ -444,7 +444,7 @@ impl MappedVmo {
/// perform other operations.
fn operate_on_range<F>(&self, range: &Range<usize>, operate: F) -> Result<()>
where
F: FnMut(&mut dyn FnMut() -> Result<DynUFrame>) -> Result<()>,
F: FnMut(&mut dyn FnMut() -> Result<UFrame>) -> Result<()>,
{
debug_assert!(range.start < self.range.len());
debug_assert!(range.end <= self.range.len());

View File

@ -3,14 +3,14 @@
use core::ops::Range;
use aster_rights::{Rights, TRights};
use ostd::mm::{DynUFrame, VmIo};
use ostd::mm::{UFrame, VmIo};
use super::{CommitFlags, Vmo, VmoRightsOp};
use crate::prelude::*;
impl Vmo<Rights> {
/// Commits a page at specific offset
pub fn commit_page(&self, offset: usize) -> Result<DynUFrame> {
pub fn commit_page(&self, offset: usize) -> Result<UFrame> {
self.check_rights(Rights::WRITE)?;
self.0.commit_page(offset)
}
@ -39,7 +39,7 @@ impl Vmo<Rights> {
/// perform other operations.
pub(in crate::vm) fn operate_on_range<F>(&self, range: &Range<usize>, operate: F) -> Result<()>
where
F: FnMut(&mut dyn FnMut() -> Result<DynUFrame>) -> Result<()>,
F: FnMut(&mut dyn FnMut() -> Result<UFrame>) -> Result<()>,
{
self.check_rights(Rights::WRITE)?;
self.0
@ -112,7 +112,7 @@ impl Vmo<Rights> {
/// # Access rights
///
/// The method requires the Write right.
pub fn replace(&self, page: DynUFrame, page_idx: usize) -> Result<()> {
pub fn replace(&self, page: UFrame, page_idx: usize) -> Result<()> {
self.check_rights(Rights::WRITE)?;
self.0.replace(page, page_idx)
}

View File

@ -11,7 +11,7 @@ use align_ext::AlignExt;
use aster_rights::Rights;
use ostd::{
collections::xarray::{CursorMut, XArray},
mm::{DynUFrame, FrameAllocOptions, UntypedMem, VmReader, VmWriter},
mm::{FrameAllocOptions, UFrame, UntypedMem, VmReader, VmWriter},
};
use crate::prelude::*;
@ -66,8 +66,8 @@ pub use pager::Pager;
/// # Implementation
///
/// `Vmo` provides high-level APIs for address space management by wrapping
/// around its low-level counterpart [`ostd::mm::DynUFrame`].
/// Compared with `DynUFrame`,
/// around its low-level counterpart [`ostd::mm::UFrame`].
/// Compared with `UFrame`,
/// `Vmo` is easier to use (by offering more powerful APIs) and
/// harder to misuse (thanks to its nature of being capability).
#[derive(Debug)]
@ -125,12 +125,12 @@ bitflags! {
}
}
/// `Pages` is the struct that manages the `DynUFrame`s stored in `Vmo_`.
/// `Pages` is the struct that manages the `UFrame`s stored in `Vmo_`.
pub(super) enum Pages {
/// `Pages` that cannot be resized. This kind of `Pages` will have a constant size.
Nonresizable(Mutex<XArray<DynUFrame>>, usize),
Nonresizable(Mutex<XArray<UFrame>>, usize),
/// `Pages` that can be resized and have a variable size.
Resizable(Mutex<(XArray<DynUFrame>, usize)>),
Resizable(Mutex<(XArray<UFrame>, usize)>),
}
impl Clone for Pages {
@ -149,7 +149,7 @@ impl Clone for Pages {
impl Pages {
fn with<R, F>(&self, func: F) -> R
where
F: FnOnce(&mut XArray<DynUFrame>, usize) -> R,
F: FnOnce(&mut XArray<UFrame>, usize) -> R,
{
match self {
Self::Nonresizable(pages, size) => func(&mut pages.lock(), *size),
@ -201,16 +201,16 @@ impl CommitFlags {
}
impl Vmo_ {
/// Prepares a new `DynUFrame` for the target index in pages, returns this new frame.
fn prepare_page(&self, page_idx: usize) -> Result<DynUFrame> {
/// Prepares a new `UFrame` for the target index in pages, returns this new frame.
fn prepare_page(&self, page_idx: usize) -> Result<UFrame> {
match &self.pager {
None => Ok(FrameAllocOptions::new().alloc_frame()?.into()),
Some(pager) => pager.commit_page(page_idx),
}
}
/// Prepares a new `DynUFrame` for the target index in the VMO, returns this new frame.
fn prepare_overwrite(&self, page_idx: usize) -> Result<DynUFrame> {
/// Prepares a new `UFrame` for the target index in the VMO, returns this new frame.
fn prepare_overwrite(&self, page_idx: usize) -> Result<UFrame> {
if let Some(pager) = &self.pager {
pager.commit_overwrite(page_idx)
} else {
@ -220,9 +220,9 @@ impl Vmo_ {
fn commit_with_cursor(
&self,
cursor: &mut CursorMut<'_, DynUFrame>,
cursor: &mut CursorMut<'_, UFrame>,
commit_flags: CommitFlags,
) -> Result<DynUFrame> {
) -> Result<UFrame> {
let new_page = {
if let Some(committed_page) = cursor.load() {
// Fast path: return the page directly.
@ -241,7 +241,7 @@ impl Vmo_ {
/// Commits the page corresponding to the target offset in the VMO and return that page.
/// If the current offset has already been committed, the page will be returned directly.
pub fn commit_page(&self, offset: usize) -> Result<DynUFrame> {
pub fn commit_page(&self, offset: usize) -> Result<UFrame> {
let page_idx = offset / PAGE_SIZE;
self.pages.with(|pages, size| {
if offset >= size {
@ -279,7 +279,7 @@ impl Vmo_ {
commit_flags: CommitFlags,
) -> Result<()>
where
F: FnMut(&mut dyn FnMut() -> Result<DynUFrame>) -> Result<()>,
F: FnMut(&mut dyn FnMut() -> Result<UFrame>) -> Result<()>,
{
self.pages.with(|pages, size| {
if range.end > size {
@ -315,7 +315,7 @@ impl Vmo_ {
let read_range = offset..(offset + read_len);
let mut read_offset = offset % PAGE_SIZE;
let read = move |commit_fn: &mut dyn FnMut() -> Result<DynUFrame>| {
let read = move |commit_fn: &mut dyn FnMut() -> Result<UFrame>| {
let frame = commit_fn()?;
frame.reader().skip(read_offset).read_fallible(writer)?;
read_offset = 0;
@ -331,7 +331,7 @@ impl Vmo_ {
let write_range = offset..(offset + write_len);
let mut write_offset = offset % PAGE_SIZE;
let mut write = move |commit_fn: &mut dyn FnMut() -> Result<DynUFrame>| {
let mut write = move |commit_fn: &mut dyn FnMut() -> Result<UFrame>| {
let frame = commit_fn()?;
frame.writer().skip(write_offset).write_fallible(reader)?;
write_offset = 0;
@ -401,7 +401,7 @@ impl Vmo_ {
Ok(())
}
fn decommit_pages(&self, pages: &mut XArray<DynUFrame>, range: Range<usize>) -> Result<()> {
fn decommit_pages(&self, pages: &mut XArray<UFrame>, range: Range<usize>) -> Result<()> {
let page_idx_range = get_page_idx_range(&range);
let mut cursor = pages.cursor_mut(page_idx_range.start as u64);
for page_idx in page_idx_range {
@ -426,7 +426,7 @@ impl Vmo_ {
self.flags
}
fn replace(&self, page: DynUFrame, page_idx: usize) -> Result<()> {
fn replace(&self, page: UFrame, page_idx: usize) -> Result<()> {
self.pages.with(|pages, size| {
if page_idx >= size / PAGE_SIZE {
return_errno_with_message!(Errno::EINVAL, "the page index is outside of the vmo");

View File

@ -8,7 +8,7 @@ use align_ext::AlignExt;
use aster_rights::{Rights, TRightSet, TRights};
use ostd::{
collections::xarray::XArray,
mm::{DynUFrame, DynUSegment, FrameAllocOptions},
mm::{FrameAllocOptions, UFrame, USegment},
};
use super::{Pager, Pages, Vmo, VmoFlags};
@ -137,11 +137,11 @@ fn alloc_vmo_(size: usize, flags: VmoFlags, pager: Option<Arc<dyn Pager>>) -> Re
})
}
fn committed_pages_if_continuous(flags: VmoFlags, size: usize) -> Result<XArray<DynUFrame>> {
fn committed_pages_if_continuous(flags: VmoFlags, size: usize) -> Result<XArray<UFrame>> {
if flags.contains(VmoFlags::CONTIGUOUS) {
// if the vmo is continuous, we need to allocate frames for the vmo
let frames_num = size / PAGE_SIZE;
let segment: DynUSegment = FrameAllocOptions::new().alloc_segment(frames_num)?.into();
let segment: USegment = FrameAllocOptions::new().alloc_segment(frames_num)?.into();
let mut committed_pages = XArray::new();
let mut cursor = committed_pages.cursor_mut(0);
for frame in segment {

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MPL-2.0
use ostd::mm::DynUFrame;
use ostd::mm::UFrame;
use crate::prelude::*;
@ -26,7 +26,7 @@ pub trait Pager: Send + Sync {
/// whatever frame that may or may not be the same as the last time.
///
/// It is up to the pager to decide the range of valid indices.
fn commit_page(&self, idx: usize) -> Result<DynUFrame>;
fn commit_page(&self, idx: usize) -> Result<UFrame>;
/// Notify the pager that the frame at a specified index has been updated.
///
@ -54,5 +54,5 @@ pub trait Pager: Send + Sync {
/// Ask the pager to provide a frame at a specified index.
/// Notify the pager that the frame will be fully overwritten soon, so pager can
/// choose not to initialize it.
fn commit_overwrite(&self, idx: usize) -> Result<DynUFrame>;
fn commit_overwrite(&self, idx: usize) -> Result<UFrame>;
}

View File

@ -4,14 +4,14 @@ use core::ops::Range;
use aster_rights::{Dup, Rights, TRightSet, TRights, Write};
use aster_rights_proc::require;
use ostd::mm::{DynUFrame, VmIo};
use ostd::mm::{UFrame, VmIo};
use super::{CommitFlags, Vmo, VmoRightsOp};
use crate::prelude::*;
impl<R: TRights> Vmo<TRightSet<R>> {
/// Commits a page at specific offset.
pub fn commit_page(&self, offset: usize) -> Result<DynUFrame> {
pub fn commit_page(&self, offset: usize) -> Result<UFrame> {
self.check_rights(Rights::WRITE)?;
self.0.commit_page(offset)
}
@ -41,7 +41,7 @@ impl<R: TRights> Vmo<TRightSet<R>> {
#[require(R > Write)]
pub(in crate::vm) fn operate_on_range<F>(&self, range: &Range<usize>, operate: F) -> Result<()>
where
F: FnMut(&mut dyn FnMut() -> Result<DynUFrame>) -> Result<()>,
F: FnMut(&mut dyn FnMut() -> Result<UFrame>) -> Result<()>,
{
self.0
.operate_on_range(range, operate, CommitFlags::empty())
@ -114,7 +114,7 @@ impl<R: TRights> Vmo<TRightSet<R>> {
///
/// The method requires the Write right.
#[require(R > Write)]
pub fn replace(&self, page: DynUFrame, page_idx: usize) -> Result<()> {
pub fn replace(&self, page: UFrame, page_idx: usize) -> Result<()> {
self.0.replace(page, page_idx)
}