pub struct VirtioVsockDevice { /* private fields */ }Expand description
Virtio vsock device.
Implementations§
Source§impl VirtioVsockDevice
impl VirtioVsockDevice
Sourcepub fn new(
driver_source: &VmTaskDriverSource,
guest_cid: u64,
base_path: PathBuf,
listener: UnixListener,
) -> Result<Self>
pub fn new( driver_source: &VmTaskDriverSource, guest_cid: u64, base_path: PathBuf, listener: UnixListener, ) -> Result<Self>
Create a new virtio-vsock device.
guest_cid is the context ID assigned to the guest.
base_path is the path prefix for Unix socket relay. For a vsock port P, the relay will
attempt to connect to <base_path>_P.
listener is an pre-bound Unix listener for accepting host-initiated connections using the
hybrid vsock connect protocol.
Trait Implementations§
Source§impl InspectMut for VirtioVsockDevice
impl InspectMut for VirtioVsockDevice
Source§fn inspect_mut(&mut self, req: Request<'_>)
fn inspect_mut(&mut self, req: Request<'_>)
Inspects the object.
Source§impl VirtioDevice for VirtioVsockDevice
impl VirtioDevice for VirtioVsockDevice
Source§async fn read_registers_u32(&mut self, offset: u16) -> u32
async fn read_registers_u32(&mut self, offset: u16) -> u32
Read device-specific config registers.
Source§async fn write_registers_u32(&mut self, offset: u16, val: u32)
async fn write_registers_u32(&mut self, offset: u16, val: u32)
Write device-specific config registers.
Source§async fn start_queue(
&mut self,
idx: u16,
resources: QueueResources,
features: &VirtioDeviceFeatures,
initial_state: Option<QueueState>,
) -> Result<()>
async fn start_queue( &mut self, idx: u16, resources: QueueResources, features: &VirtioDeviceFeatures, initial_state: Option<QueueState>, ) -> Result<()>
Start a single queue. Read more
Source§async fn stop_queue(&mut self, idx: u16) -> Option<QueueState>
async fn stop_queue(&mut self, idx: u16) -> Option<QueueState>
Stop a single queue and return its state. Read more
§fn queue_size(&self, _queue_index: u16) -> u16
fn queue_size(&self, _queue_index: u16) -> u16
The queue size for the given queue index. Read more
Provide the shared memory region to the device. Read more
§fn reset(&mut self) -> impl Future<Output = ()> + Send
fn reset(&mut self) -> impl Future<Output = ()> + Send
Reset device-internal state to initial values. Read more
§fn supports_save_restore(&self) -> bool
fn supports_save_restore(&self) -> bool
Whether the device supports save/restore. Read more
Auto Trait Implementations§
impl !Freeze for VirtioVsockDevice
impl !RefUnwindSafe for VirtioVsockDevice
impl Send for VirtioVsockDevice
impl !Sync for VirtioVsockDevice
impl Unpin for VirtioVsockDevice
impl UnsafeUnpin for VirtioVsockDevice
impl !UnwindSafe for VirtioVsockDevice
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
§impl<T> DynVirtioDevice for Twhere
T: VirtioDevice,
impl<T> DynVirtioDevice for Twhere
T: VirtioDevice,
§fn queue_size(&self, queue_index: u16) -> u16
fn queue_size(&self, queue_index: u16) -> u16
The queue size for the given queue index.
§fn read_registers_u32(
&mut self,
offset: u16,
) -> Pin<Box<dyn Future<Output = u32> + Send + '_>>
fn read_registers_u32( &mut self, offset: u16, ) -> Pin<Box<dyn Future<Output = u32> + Send + '_>>
Read device-specific config registers.
§fn write_registers_u32(
&mut self,
offset: u16,
val: u32,
) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>
fn write_registers_u32( &mut self, offset: u16, val: u32, ) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>
Write device-specific config registers.
Provide the shared memory region to the device.
§fn start_queue<'a>(
&'a mut self,
idx: u16,
resources: QueueResources,
features: &'a VirtioDeviceFeatures,
initial_state: Option<QueueState>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn start_queue<'a>( &'a mut self, idx: u16, resources: QueueResources, features: &'a VirtioDeviceFeatures, initial_state: Option<QueueState>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Start a single queue.
§fn stop_queue(
&mut self,
idx: u16,
) -> Pin<Box<dyn Future<Output = Option<QueueState>> + Send + '_>>
fn stop_queue( &mut self, idx: u16, ) -> Pin<Box<dyn Future<Output = Option<QueueState>> + Send + '_>>
Stop a single queue and return its state.
§fn supports_save_restore(&self) -> bool
fn supports_save_restore(&self) -> bool
Whether the device supports save/restore.