pub struct DeviceRequestHandler<T: VhostUserDevice> {
vrings: Vec<Vring>,
owned: bool,
vmm_maps: Option<Vec<MappingInfo>>,
mem: Option<GuestMemory>,
backend: T,
backend_req_connection: Arc<Mutex<VhostBackendReqConnectionState>>,
}
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>
§backend: T
§backend_req_connection: Arc<Mutex<VhostBackendReqConnectionState>>
Implementations§
source§impl<T: VhostUserDevice> DeviceRequestHandler<T>
impl<T: VhostUserDevice> DeviceRequestHandler<T>
Trait Implementations§
source§impl<T: VhostUserDevice> AsMut<T> for DeviceRequestHandler<T>
impl<T: VhostUserDevice> AsMut<T> for DeviceRequestHandler<T>
source§impl<T: VhostUserDevice> AsRef<T> for DeviceRequestHandler<T>
impl<T: VhostUserDevice> AsRef<T> for DeviceRequestHandler<T>
source§impl<T: VhostUserDevice> Backend for DeviceRequestHandler<T>
impl<T: VhostUserDevice> Backend for DeviceRequestHandler<T>
fn set_owner(&mut self) -> VhostResult<()>
fn reset_owner(&mut self) -> VhostResult<()>
fn get_features(&mut self) -> VhostResult<u64>
fn set_features(&mut self, features: u64) -> VhostResult<()>
fn get_protocol_features(&mut self) -> VhostResult<VhostUserProtocolFeatures>
fn set_protocol_features(&mut self, features: u64) -> VhostResult<()>
fn set_mem_table( &mut self, contexts: &[VhostUserMemoryRegion], files: Vec<File> ) -> VhostResult<()>
fn get_queue_num(&mut self) -> VhostResult<u64>
fn set_vring_num(&mut self, index: u32, num: u32) -> VhostResult<()>
fn set_vring_addr( &mut self, index: u32, _flags: VhostUserVringAddrFlags, descriptor: u64, used: u64, available: u64, _log: u64 ) -> VhostResult<()>
fn set_vring_base(&mut self, index: u32, base: u32) -> VhostResult<()>
fn get_vring_base(&mut self, index: u32) -> VhostResult<VhostUserVringState>
fn set_vring_kick(&mut self, index: u8, file: Option<File>) -> VhostResult<()>
fn set_vring_call(&mut self, index: u8, file: Option<File>) -> VhostResult<()>
fn set_vring_err(&mut self, _index: u8, _fd: Option<File>) -> VhostResult<()>
fn set_vring_enable(&mut self, index: u32, enable: bool) -> VhostResult<()>
fn get_config( &mut self, offset: u32, size: u32, _flags: VhostUserConfigFlags ) -> VhostResult<Vec<u8>>
fn set_config( &mut self, offset: u32, buf: &[u8], _flags: VhostUserConfigFlags ) -> VhostResult<()>
fn set_backend_req_fd(&mut self, ep: Connection<BackendReq>)
fn get_inflight_fd( &mut self, _inflight: &VhostUserInflight ) -> VhostResult<(VhostUserInflight, File)>
fn set_inflight_fd( &mut self, _inflight: &VhostUserInflight, _file: File ) -> VhostResult<()>
fn get_max_mem_slots(&mut self) -> VhostResult<u64>
fn add_mem_region( &mut self, _region: &VhostUserSingleMemoryRegion, _fd: File ) -> VhostResult<()>
fn remove_mem_region( &mut self, _region: &VhostUserSingleMemoryRegion ) -> VhostResult<()>
source§fn sleep(&mut self) -> VhostResult<()>
fn sleep(&mut self) -> VhostResult<()>
Request the device to sleep by stopping their workers. This should NOT be called if the
device is already asleep.
source§fn wake(&mut self) -> VhostResult<()>
fn wake(&mut self) -> VhostResult<()>
Request the device to wake up by starting up their workers. This should NOT be called if the
device is already awake.
fn snapshot(&mut self) -> VhostResult<Vec<u8>>
fn restore( &mut self, data_bytes: &[u8], queue_evts: Vec<File> ) -> VhostResult<()>
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> Backend for Twhere
T: AsMut<dyn Backend>,
impl<T> Backend for Twhere T: AsMut<dyn Backend>,
fn set_owner(&mut self) -> Result<(), Error>
fn reset_owner(&mut self) -> Result<(), Error>
fn get_features(&mut self) -> Result<u64, Error>
fn set_features(&mut self, features: u64) -> Result<(), Error>
fn set_mem_table( &mut self, ctx: &[VhostUserMemoryRegion], files: Vec<File, Global> ) -> Result<(), Error>
fn set_vring_num(&mut self, index: u32, num: u32) -> Result<(), Error>
fn set_vring_addr( &mut self, index: u32, flags: VhostUserVringAddrFlags, descriptor: u64, used: u64, available: u64, log: u64 ) -> Result<(), Error>
fn set_vring_base(&mut self, index: u32, base: u32) -> Result<(), Error>
fn get_vring_base(&mut self, index: u32) -> Result<VhostUserVringState, Error>
fn set_vring_kick(&mut self, index: u8, fd: Option<File>) -> Result<(), Error>
fn set_vring_call(&mut self, index: u8, fd: Option<File>) -> Result<(), Error>
fn set_vring_err(&mut self, index: u8, fd: Option<File>) -> Result<(), Error>
fn get_protocol_features(&mut self) -> Result<VhostUserProtocolFeatures, Error>
fn set_protocol_features(&mut self, features: u64) -> Result<(), Error>
fn get_queue_num(&mut self) -> Result<u64, Error>
fn set_vring_enable(&mut self, index: u32, enable: bool) -> Result<(), Error>
fn get_config( &mut self, offset: u32, size: u32, flags: VhostUserConfigFlags ) -> Result<Vec<u8, Global>, Error>
fn set_config( &mut self, offset: u32, buf: &[u8], flags: VhostUserConfigFlags ) -> Result<(), Error>
fn set_backend_req_fd(&mut self, vu_req: Connection<BackendReq>)
fn get_inflight_fd( &mut self, inflight: &VhostUserInflight ) -> Result<(VhostUserInflight, File), Error>
fn set_inflight_fd( &mut self, inflight: &VhostUserInflight, file: File ) -> Result<(), Error>
fn get_max_mem_slots(&mut self) -> Result<u64, Error>
fn add_mem_region( &mut self, region: &VhostUserSingleMemoryRegion, fd: File ) -> Result<(), Error>
fn remove_mem_region( &mut self, region: &VhostUserSingleMemoryRegion ) -> Result<(), Error>
source§fn sleep(&mut self) -> Result<(), Error>
fn sleep(&mut self) -> Result<(), Error>
Request the device to sleep by stopping their workers. This should NOT be called if the
device is already asleep.
source§fn wake(&mut self) -> Result<(), Error>
fn wake(&mut self) -> Result<(), Error>
Request the device to wake up by starting up their workers. This should NOT be called if the
device is already awake.
fn snapshot(&mut self) -> Result<Vec<u8, Global>, Error>
fn restore( &mut self, data_bytes: &[u8], queue_evts: Vec<File, Global> ) -> Result<(), Error>
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
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, Global>) -> Rc<dyn Any, Global>
fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
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)
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)
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.