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

@ -5,7 +5,7 @@ use bitvec::array::BitArray;
use int_to_c_enum::TryFromInt;
use ostd::{
mm::{
DmaDirection, DmaStream, DmaStreamSlice, DynUSegment, FrameAllocOptions, Infallible, VmIo,
DmaDirection, DmaStream, DmaStreamSlice, FrameAllocOptions, Infallible, USegment, VmIo,
VmReader, VmWriter,
},
sync::{SpinLock, WaitQueue},
@ -442,8 +442,8 @@ impl<'a> BioSegment {
}
}
/// Constructs a new `BioSegment` with a given `DynUSegment` and the bio direction.
pub fn new_from_segment(segment: DynUSegment, direction: BioDirection) -> Self {
/// Constructs a new `BioSegment` with a given `USegment` and the bio direction.
pub fn new_from_segment(segment: USegment, direction: BioDirection) -> Self {
let len = segment.size();
let dma_stream = DmaStream::map(segment, direction.into(), false).unwrap();
Self {
@ -481,7 +481,7 @@ impl<'a> BioSegment {
/// Returns the inner VM segment.
#[cfg(ktest)]
pub fn inner_segment(&self) -> &DynUSegment {
pub fn inner_segment(&self) -> &USegment {
self.inner.dma_slice.stream().segment()
}

View File

@ -76,7 +76,7 @@ impl VirtQueue {
}
let (descriptor_ptr, avail_ring_ptr, used_ring_ptr) = if transport.is_legacy_version() {
// Currently, we use one DynUFrame to place the descriptors and available rings, one DynUFrame to place used rings
// Currently, we use one UFrame to place the descriptors and available rings, one UFrame to place used rings
// because the virtio-mmio legacy required the address to be continuous. The max queue size is 128.
if size > 128 {
return Err(QueueError::InvalidArgs);