pub struct VirtioQueueConfig<Q: QueueT = QueueSync> {
    pub queue: Q,
    pub eventfd: Arc<EventFd>,
    /* private fields */
}
Expand description

Virtio queue configuration information.

The VirtioQueueConfig maintains configuration information for a Virtio queue. It also provides methods to access the queue and associated interrupt/event notifiers.

Fields§

§queue: Q

Virtio queue object to access the associated queue.

§eventfd: Arc<EventFd>

EventFd to receive queue notification from guest.

Implementations§

source§

impl<Q: QueueT> VirtioQueueConfig<Q>

source

pub fn new( queue: Q, eventfd: Arc<EventFd>, notifier: Arc<dyn InterruptNotifier>, index: u16 ) -> Self

Create a VirtioQueueConfig object.

source

pub fn create(queue_size: u16, index: u16) -> Result<Self>

Create a VirtioQueueConfig object with the specified queue size and index.

source

pub fn index(&self) -> u16

Get queue index.

source

pub fn queue(&self) -> &Q

Get immutable reference to the associated Virtio queue.

source

pub fn queue_mut(&mut self) -> &mut Q

Get mutable reference to the associated Virtio queue.

source

pub fn max_size(&self) -> u16

Get the maximum queue size.

source

pub fn get_next_descriptor<M>( &mut self, mem: M ) -> Result<Option<DescriptorChain<M>>>where M: Deref + Clone, M::Target: GuestMemory + Sized,

Get the next available descriptor.

source

pub fn add_used<M: GuestMemory>(&mut self, mem: &M, desc_index: u16, len: u32)

Put a used descriptor into the used ring.

source

pub fn consume_event(&self) -> Result<u64>

Consume a queue notification event.

source

pub fn generate_event(&self) -> Result<()>

Produce a queue notification event.

source

pub fn notify(&self) -> Result<()>

Inject an interrupt to the guest for queue change events.

source

pub fn set_interrupt_notifier(&mut self, notifier: Arc<dyn InterruptNotifier>)

Set interrupt notifier to inject interrupts to the guest.

source

pub fn actual_size(&self) -> u16

Return the actual size of the queue, as the driver may not set up a queue as big as the device allows.

Trait Implementations§

source§

impl<Q: QueueT + Clone> Clone for VirtioQueueConfig<Q>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<Q = QueueSync> !RefUnwindSafe for VirtioQueueConfig<Q>

§

impl<Q> Send for VirtioQueueConfig<Q>where Q: Send,

§

impl<Q> Sync for VirtioQueueConfig<Q>where Q: Sync,

§

impl<Q> Unpin for VirtioQueueConfig<Q>where Q: Unpin,

§

impl<Q = QueueSync> !UnwindSafe for VirtioQueueConfig<Q>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.