Struct dbs_virtio_devices::VirtioQueueConfig
source · 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>
impl<Q: QueueT> VirtioQueueConfig<Q>
sourcepub fn new(
queue: Q,
eventfd: Arc<EventFd>,
notifier: Arc<dyn InterruptNotifier>,
index: u16
) -> Self
pub fn new( queue: Q, eventfd: Arc<EventFd>, notifier: Arc<dyn InterruptNotifier>, index: u16 ) -> Self
Create a VirtioQueueConfig
object.
sourcepub fn create(queue_size: u16, index: u16) -> Result<Self>
pub fn create(queue_size: u16, index: u16) -> Result<Self>
Create a VirtioQueueConfig
object with the specified queue size and index.
sourcepub fn get_next_descriptor<M>(
&mut self,
mem: M
) -> Result<Option<DescriptorChain<M>>>where
M: Deref + Clone,
M::Target: GuestMemory + Sized,
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.
sourcepub fn add_used<M: GuestMemory>(&mut self, mem: &M, desc_index: u16, len: u32)
pub fn add_used<M: GuestMemory>(&mut self, mem: &M, desc_index: u16, len: u32)
Put a used descriptor into the used ring.
sourcepub fn consume_event(&self) -> Result<u64>
pub fn consume_event(&self) -> Result<u64>
Consume a queue notification event.
sourcepub fn generate_event(&self) -> Result<()>
pub fn generate_event(&self) -> Result<()>
Produce a queue notification event.
sourcepub fn set_interrupt_notifier(&mut self, notifier: Arc<dyn InterruptNotifier>)
pub fn set_interrupt_notifier(&mut self, notifier: Arc<dyn InterruptNotifier>)
Set interrupt notifier to inject interrupts to the guest.
sourcepub fn actual_size(&self) -> u16
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§
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> 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
Mutably borrows from an owned value. Read more