pub struct Vsock<B> {
pub rx_packet: VsockPacketRx,
pub tx_packet: VsockPacketTx,
/* private fields */
}Expand description
Structure representing the vsock device.
Fields§
§rx_packet: VsockPacketRx§tx_packet: VsockPacketTxImplementations§
Source§impl<B> Vsock<B>where
B: VsockBackend + Debug,
impl<B> Vsock<B>where
B: VsockBackend + Debug,
Sourcepub fn with_queues(
cid: u64,
backend: B,
queues: Vec<VirtQueue>,
) -> Result<Vsock<B>, VsockError>
pub fn with_queues( cid: u64, backend: B, queues: Vec<VirtQueue>, ) -> Result<Vsock<B>, VsockError>
Auxiliary function for creating a new virtio-vsock device with the given VM CID, vsock backend and empty virtio queues.
Sourcepub fn new(cid: u64, backend: B) -> Result<Vsock<B>, VsockError>
pub fn new(cid: u64, backend: B) -> Result<Vsock<B>, VsockError>
Create a new virtio-vsock device with the given VM CID and vsock backend.
Sourcepub fn id(&self) -> &str
pub fn id(&self) -> &str
Provides the ID of this vsock device as used in MMIO device identification.
Sourcepub fn signal_used_queue(&self, qidx: usize) -> Result<(), DeviceError>
pub fn signal_used_queue(&self, qidx: usize) -> Result<(), DeviceError>
Signal the guest driver that we’ve used some virtio buffers that it had previously made available.
Sourcepub fn signal_used_queues(&self, used_queues: &[u16]) -> Result<(), DeviceError>
pub fn signal_used_queues(&self, used_queues: &[u16]) -> Result<(), DeviceError>
Signal the guest which queues are ready to be consumed
Sourcepub fn process_rx(&mut self) -> Result<bool, InvalidAvailIdx>
pub fn process_rx(&mut self) -> Result<bool, InvalidAvailIdx>
Walk the driver-provided RX queue buffers and attempt to fill them up with any data that we
have pending. Return true if descriptors have been added to the used ring, and false
otherwise.
Sourcepub fn process_tx(&mut self) -> Result<bool, InvalidAvailIdx>
pub fn process_tx(&mut self) -> Result<bool, InvalidAvailIdx>
Walk the driver-provided TX queue buffers, package them up as vsock packets, and send them
to the backend for processing. Return true if descriptors have been added to the used
ring, and false otherwise.
pub fn send_transport_reset_event(&mut self) -> Result<(), DeviceError>
Source§impl<B> Vsock<B>where
B: Debug + VsockBackend + 'static,
impl<B> Vsock<B>where
B: Debug + VsockBackend + 'static,
pub fn handle_rxq_event(&mut self, evset: EventSet) -> Vec<u16>
pub fn handle_txq_event(&mut self, evset: EventSet) -> Vec<u16>
pub fn handle_evq_event(&mut self, evset: EventSet)
Sourcepub fn notify_backend(
&mut self,
evset: EventSet,
) -> Result<Vec<u16>, InvalidAvailIdx>
pub fn notify_backend( &mut self, evset: EventSet, ) -> Result<Vec<u16>, InvalidAvailIdx>
Notify backend of new events.
Trait Implementations§
Source§impl<B> MutEventSubscriber for Vsock<B>where
B: Debug + VsockBackend + 'static,
impl<B> MutEventSubscriber for Vsock<B>where
B: Debug + VsockBackend + 'static,
Source§impl<B> Persist<'_> for Vsock<B>where
B: VsockBackend + 'static + Debug,
impl<B> Persist<'_> for Vsock<B>where
B: VsockBackend + 'static + Debug,
Source§type State = VsockFrontendState
type State = VsockFrontendState
Source§type ConstructorArgs = VsockConstructorArgs<B>
type ConstructorArgs = VsockConstructorArgs<B>
Source§type Error = VsockError
type Error = VsockError
Source§impl<B> VirtioDevice for Vsock<B>where
B: VsockBackend + Debug + 'static,
impl<B> VirtioDevice for Vsock<B>where
B: VsockBackend + Debug + 'static,
Source§fn const_device_type() -> u32
fn const_device_type() -> u32
Source§fn device_type(&self) -> u32
fn device_type(&self) -> u32
Source§fn avail_features(&self) -> u64
fn avail_features(&self) -> u64
Source§fn acked_features(&self) -> u64
fn acked_features(&self) -> u64
Source§fn set_acked_features(&mut self, acked_features: u64)
fn set_acked_features(&mut self, acked_features: u64)
Source§fn queues_mut(&mut self) -> &mut [VirtQueue]
fn queues_mut(&mut self) -> &mut [VirtQueue]
Source§fn queue_events(&self) -> &[EventFd]
fn queue_events(&self) -> &[EventFd]
fn interrupt_trigger(&self) -> &dyn VirtioInterrupt
Source§fn read_config(&self, offset: u64, data: &mut [u8])
fn read_config(&self, offset: u64, data: &mut [u8])
offset.Source§fn write_config(&mut self, offset: u64, data: &[u8])
fn write_config(&mut self, offset: u64, data: &[u8])
offset.Source§fn activate(
&mut self,
mem: GuestMemoryMmap,
interrupt: Arc<dyn VirtioInterrupt>,
) -> Result<(), ActivateError>
fn activate( &mut self, mem: GuestMemoryMmap, interrupt: Arc<dyn VirtioInterrupt>, ) -> Result<(), ActivateError>
is_activated.Source§fn is_activated(&self) -> bool
fn is_activated(&self) -> bool
Source§fn has_feature(&self, feature: u64) -> bool
fn has_feature(&self, feature: u64) -> bool
Source§fn interrupt_status(&self) -> Arc<AtomicU32>
fn interrupt_status(&self) -> Arc<AtomicU32>
Source§fn avail_features_by_page(&self, page: u32) -> u32
fn avail_features_by_page(&self, page: u32) -> u32
page * 32.Source§fn ack_features_by_page(&mut self, page: u32, value: u32)
fn ack_features_by_page(&mut self, page: u32, value: u32)
Source§fn reset(&mut self) -> Option<(Arc<dyn VirtioInterrupt>, Vec<EventFd>)>
fn reset(&mut self) -> Option<(Arc<dyn VirtioInterrupt>, Vec<EventFd>)>
Source§fn mark_queue_memory_dirty(
&mut self,
mem: &GuestMemoryMmap,
) -> Result<(), QueueError>
fn mark_queue_memory_dirty( &mut self, mem: &GuestMemoryMmap, ) -> Result<(), QueueError>
Source§fn as_cow_file_engine(&self) -> Option<&CowFileEngine>
fn as_cow_file_engine(&self) -> Option<&CowFileEngine>
Source§fn nyx_handle_queue_event(&mut self, _queue_index: u16)
fn nyx_handle_queue_event(&mut self, _queue_index: u16)
Auto Trait Implementations§
impl<B> Freeze for Vsock<B>where
B: Freeze,
impl<B> !RefUnwindSafe for Vsock<B>
impl<B> Send for Vsock<B>where
B: Send,
impl<B> !Sync for Vsock<B>
impl<B> Unpin for Vsock<B>where
B: Unpin,
impl<B> !UnwindSafe for Vsock<B>
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
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.