Struct VringMutex

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

A VringState object protected by Mutex for multi-threading context.

Trait Implementations§

Source§

impl<M: Clone + GuestAddressSpace> Clone for VringMutex<M>

Source§

fn clone(&self) -> VringMutex<M>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a, M: 'a + GuestAddressSpace> VringStateGuard<'a, M> for VringMutex<M>

Source§

type G = MutexGuard<'a, VringState<M>>

Type for guard returned by VringT::get_ref().
Source§

impl<'a, M: 'a + GuestAddressSpace> VringStateMutGuard<'a, M> for VringMutex<M>

Source§

type G = MutexGuard<'a, VringState<M>>

Type for guard returned by VringT::get_mut().
Source§

impl<M: 'static + GuestAddressSpace> VringT<M> for VringMutex<M>

Source§

fn new(mem: M, max_queue_size: u16) -> Result<Self, VirtQueError>

Create a new instance of Vring.
Source§

fn get_ref(&self) -> <Self as VringStateGuard<'_, M>>::G

Get an immutable reference to the kick event fd.
Source§

fn get_mut(&self) -> <Self as VringStateMutGuard<'_, M>>::G

Get a mutable reference to the kick event fd.
Source§

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

Add an used descriptor into the used queue.
Source§

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

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

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

Enable event notification for queue.
Source§

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

Disable event notification for queue.
Source§

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

Check whether a notification to the guest is needed.
Source§

fn set_enabled(&self, enabled: bool)

Set vring enabled state.
Source§

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

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

fn queue_next_avail(&self) -> u16

Get queue next avail head.
Source§

fn set_queue_next_avail(&self, base: u16)

Set queue next avail head.
Source§

fn set_queue_next_used(&self, idx: u16)

Set queue next used head.
Source§

fn queue_used_idx(&self) -> Result<u16, VirtQueError>

Get queue next used head index from the guest memory.
Source§

fn set_queue_size(&self, num: u16)

Set configured queue size.
Source§

fn set_queue_event_idx(&self, enabled: bool)

Enable/disable queue event index feature.
Source§

fn set_queue_ready(&self, ready: bool)

Set queue enabled state.
Source§

fn set_kick(&self, file: Option<File>)

Set EventFd for kick.
Source§

fn read_kick(&self) -> Result<bool>

Read event from the kick EventFd.
Source§

fn set_call(&self, file: Option<File>)

Set EventFd for call.
Source§

fn set_err(&self, file: Option<File>)

Set EventFd for err.

Auto Trait Implementations§

§

impl<M> Freeze for VringMutex<M>

§

impl<M> RefUnwindSafe for VringMutex<M>

§

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

§

impl<M> Sync for VringMutex<M>
where M: Send,

§

impl<M> Unpin for VringMutex<M>

§

impl<M> UnwindSafe for VringMutex<M>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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 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