pub struct DeviceRequestHandler<T: VhostUserDevice> {
    vrings: Vec<Vring>,
    owned: bool,
    vmm_maps: Option<Vec<MappingInfo>>,
    mem: Option<GuestMemory>,
    acked_features: u64,
    acked_protocol_features: VhostUserProtocolFeatures,
    backend: T,
    backend_req_connection: Arc<Mutex<VhostBackendReqConnectionState>>,
    device_state_thread: Option<DeviceStateThread>,
}
Expand description

An adapter that implements vmm_vhost::Backend for any type implementing VhostUserDevice.

Fields§

§vrings: Vec<Vring>§owned: bool§vmm_maps: Option<Vec<MappingInfo>>§mem: Option<GuestMemory>§acked_features: u64§acked_protocol_features: VhostUserProtocolFeatures§backend: T§backend_req_connection: Arc<Mutex<VhostBackendReqConnectionState>>§device_state_thread: Option<DeviceStateThread>

Implementations§

source§

impl<T: VhostUserDevice> DeviceRequestHandler<T>

source

pub(crate) fn new(backend: T) -> Self

Creates a vhost-user handler instance for backend.

source

fn all_queues_stopped(&self) -> bool

Check if all queues are stopped.

The device can be suspended with enter_suspended_state() only when all queues are stopped.

Trait Implementations§

source§

impl<T: VhostUserDevice> AsMut<T> for DeviceRequestHandler<T>

source§

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

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<T: VhostUserDevice> AsRef<T> for DeviceRequestHandler<T>

source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<T: VhostUserDevice> Backend for DeviceRequestHandler<T>

source§

fn set_owner(&mut self) -> VhostResult<()>

source§

fn reset_owner(&mut self) -> VhostResult<()>

source§

fn get_features(&mut self) -> VhostResult<u64>

source§

fn set_features(&mut self, features: u64) -> VhostResult<()>

source§

fn get_protocol_features(&mut self) -> VhostResult<VhostUserProtocolFeatures>

source§

fn set_protocol_features(&mut self, features: u64) -> VhostResult<()>

source§

fn set_mem_table( &mut self, contexts: &[VhostUserMemoryRegion], files: Vec<File> ) -> VhostResult<()>

source§

fn get_queue_num(&mut self) -> VhostResult<u64>

source§

fn set_vring_num(&mut self, index: u32, num: u32) -> VhostResult<()>

source§

fn set_vring_addr( &mut self, index: u32, _flags: VhostUserVringAddrFlags, descriptor: u64, used: u64, available: u64, _log: u64 ) -> VhostResult<()>

source§

fn set_vring_base(&mut self, index: u32, base: u32) -> VhostResult<()>

source§

fn get_vring_base(&mut self, index: u32) -> VhostResult<VhostUserVringState>

source§

fn set_vring_kick(&mut self, index: u8, file: Option<File>) -> VhostResult<()>

source§

fn set_vring_call(&mut self, index: u8, file: Option<File>) -> VhostResult<()>

source§

fn set_vring_err(&mut self, _index: u8, _fd: Option<File>) -> VhostResult<()>

source§

fn set_vring_enable(&mut self, index: u32, enable: bool) -> VhostResult<()>

source§

fn get_config( &mut self, offset: u32, size: u32, _flags: VhostUserConfigFlags ) -> VhostResult<Vec<u8>>

source§

fn set_config( &mut self, offset: u32, buf: &[u8], _flags: VhostUserConfigFlags ) -> VhostResult<()>

source§

fn set_backend_req_fd(&mut self, ep: Connection<BackendReq>)

source§

fn get_inflight_fd( &mut self, _inflight: &VhostUserInflight ) -> VhostResult<(VhostUserInflight, File)>

source§

fn set_inflight_fd( &mut self, _inflight: &VhostUserInflight, _file: File ) -> VhostResult<()>

source§

fn get_max_mem_slots(&mut self) -> VhostResult<u64>

source§

fn add_mem_region( &mut self, _region: &VhostUserSingleMemoryRegion, _fd: File ) -> VhostResult<()>

source§

fn remove_mem_region( &mut self, _region: &VhostUserSingleMemoryRegion ) -> VhostResult<()>

source§

fn set_device_state_fd( &mut self, transfer_direction: VhostUserTransferDirection, migration_phase: VhostUserMigrationPhase, fd: File ) -> VhostResult<Option<File>>

source§

fn check_device_state(&mut self) -> VhostResult<()>

source§

fn get_shared_memory_regions( &mut self ) -> VhostResult<Vec<VhostSharedMemoryRegion>>

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for DeviceRequestHandler<T>

§

impl<T> Send for DeviceRequestHandler<T>
where T: Send,

§

impl<T> Sync for DeviceRequestHandler<T>
where T: Sync,

§

impl<T> Unpin for DeviceRequestHandler<T>
where T: Unpin,

§

impl<T> !UnwindSafe for DeviceRequestHandler<T>

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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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>,

§

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

§

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

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

§

fn vzip(self) -> V