Struct VringState

Source
pub struct VringState<M: GuestAddressSpace = GuestMemoryAtomic<GuestMemoryMmap>> { /* private fields */ }
Expand description

Struct to maintain raw state information for a vhost-user queue.

This struct maintains all information of a virito queue, and could be used as an VringT object for single-threaded context.

Implementations§

Source§

impl<M: GuestAddressSpace> VringState<M>

Source

pub fn get_queue(&self) -> &Queue

Get an immutable reference to the underlying raw Queue object.

Source

pub fn get_queue_mut(&mut self) -> &mut Queue

Get a mutable reference to the underlying raw Queue object.

Source

pub fn add_used( &mut self, desc_index: u16, len: u32, ) -> Result<(), VirtQueError>

Add an used descriptor into the used queue.

Source

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

Notify the vhost-user frontend that used descriptors have been put into the used queue.

Source

pub fn enable_notification(&mut self) -> Result<bool, VirtQueError>

Enable event notification for queue.

Source

pub fn disable_notification(&mut self) -> Result<(), VirtQueError>

Disable event notification for queue.

Source

pub fn needs_notification(&mut self) -> Result<bool, VirtQueError>

Check whether a notification to the guest is needed.

Source

pub fn set_enabled(&mut self, enabled: bool)

Set vring enabled state.

Source

pub fn set_queue_info( &mut self, desc_table: u64, avail_ring: u64, used_ring: u64, ) -> Result<(), VirtQueError>

Set queue addresses for descriptor table, available ring and used ring.

Source

pub fn get_kick(&self) -> &Option<EventFd>

Get the EventFd for kick.

Source

pub fn get_call(&self) -> &Option<EventFd>

Get the EventFd for call.

Auto Trait Implementations§

§

impl<M> Freeze for VringState<M>
where M: Freeze,

§

impl<M> RefUnwindSafe for VringState<M>
where M: RefUnwindSafe,

§

impl<M> Send for VringState<M>
where M: Send,

§

impl<M> Sync for VringState<M>
where M: Sync,

§

impl<M> Unpin for VringState<M>
where M: Unpin,

§

impl<M> UnwindSafe for VringState<M>
where M: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V