pub struct VirtioBufferRef<'a> { /* private fields */ }Expand description
Describes a buffer that can be submitted to a virtio queue.
A buffer describes the memory used by a virtio device to read the input and
write the output for a task. The description is a list of
VirtioMemoryRange. Each memory range must be contiguous in the PCI
device’s addressable space.
The driver submits a buffer to ask the virtio device to perform a task. Submitting a buffer transfers the driver’s ownership of the buffer to the device. The device returns the buffer when it completes the task. Returning the buffer transfers ownership back to the driver.
For convenience, we say that a buffer is submitted when it is owned by the device. We also say that a memory range is submitted when the buffer that it belongs to is submitted. The device may only access the memory submitted buffers, which are the buffers that it owns.
The list of memory regions must first contain the regions storing the task’s
input (using VirtioMemoryRangeAccess::Input), followed by the regions
storing the task’s output (using VirtioMemoryRangeAccess::Output).
Implementations§
Source§impl<'a> VirtioBufferRef<'a>
impl<'a> VirtioBufferRef<'a>
Sourcepub const MAX_LENGTH: usize = 32768
pub const MAX_LENGTH: usize = 32768
The maximum number of contiguous memory regions in a buffer.
The upper bound is based on the fact that a buffer’s memory regions must fit in a virtqueue’s descriptor table, so the number of memory regions is capped by the virtqueue descriptor table size.
Sourcepub fn new(range_list: &'a [VirtioMemoryRange]) -> VirtioBufferRef<'a>
pub fn new(range_list: &'a [VirtioMemoryRange]) -> VirtioBufferRef<'a>
Panics if the list of ranges is empty, or if a range with
VirtioMemoryRangeAccess::Input access follows a range with
VirtioMemoryRangeAccess::Output access.
Trait Implementations§
Source§impl<'a> AsRef<[VirtioMemoryRange]> for VirtioBufferRef<'a>
impl<'a> AsRef<[VirtioMemoryRange]> for VirtioBufferRef<'a>
Source§fn as_ref(&self) -> &[VirtioMemoryRange]
fn as_ref(&self) -> &[VirtioMemoryRange]
Auto Trait Implementations§
impl<'a> Freeze for VirtioBufferRef<'a>
impl<'a> RefUnwindSafe for VirtioBufferRef<'a>
impl<'a> Send for VirtioBufferRef<'a>
impl<'a> Sync for VirtioBufferRef<'a>
impl<'a> Unpin for VirtioBufferRef<'a>
impl<'a> UnsafeUnpin for VirtioBufferRef<'a>
impl<'a> UnwindSafe for VirtioBufferRef<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to [Self]