pub struct QueueState {
pub num: u16,
pub desc: u64,
pub avail: u64,
pub used: u64,
pub ready: bool,
}Expand description
Queue-programming state as written by the driver through the transport.
This mirrors the four queue registers (QUEUE_NUM, descriptor/available/
used addresses and QUEUE_READY) and validates them before a
SplitQueue view is built. It is shared by every virtio model so that
size, power-of-two and alignment rules are enforced at one place.
Fields§
§num: u16Number of descriptors written to QUEUE_NUM.
desc: u64Descriptor-table base (guest-physical).
avail: u64Available-ring base (guest-physical).
used: u64Used-ring base (guest-physical).
ready: boolQUEUE_READY was set by the driver.
Implementations§
Source§impl QueueState
impl QueueState
Sourcepub fn set_num(&mut self, num: u16) -> Result<(), QueueError>
pub fn set_num(&mut self, num: u16) -> Result<(), QueueError>
Records a new queue size.
Rejects zero, non-power-of-two and sizes above MAX_QUEUE_SIZE, and
clears ready because the queue must be re-programmed.
Sourcepub fn validate(&self) -> Result<(), QueueError>
pub fn validate(&self) -> Result<(), QueueError>
Validates size and table alignments without requiring ready.
Sourcepub fn split(&self) -> Result<SplitQueue, QueueError>
pub fn split(&self) -> Result<SplitQueue, QueueError>
Builds the SplitQueue view once the driver marked the queue ready.
Trait Implementations§
Source§impl Clone for QueueState
impl Clone for QueueState
impl Copy for QueueState
Source§impl Debug for QueueState
impl Debug for QueueState
Source§impl Default for QueueState
impl Default for QueueState
impl Eq for QueueState
Source§impl PartialEq for QueueState
impl PartialEq for QueueState
impl StructuralPartialEq for QueueState
Auto Trait Implementations§
impl Forget for QueueState
impl Freeze for QueueState
impl Move for QueueState
impl RefUnwindSafe for QueueState
impl Send for QueueState
impl Sync for QueueState
impl Unpin for QueueState
impl UnsafeUnpin for QueueState
impl UnwindSafe for QueueState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more