pub struct ConsoleDevice { /* private fields */ }Expand description
virtio-console device.
Implementations§
Source§impl ConsoleDevice
impl ConsoleDevice
Sourcepub fn new(sink: ConsoleSink) -> Self
pub fn new(sink: ConsoleSink) -> Self
Build a console with a custom sink.
Trait Implementations§
Source§impl Debug for ConsoleDevice
impl Debug for ConsoleDevice
Source§impl VirtioDevice for ConsoleDevice
impl VirtioDevice for ConsoleDevice
Source§fn device_type(&self) -> VirtioDeviceType
fn device_type(&self) -> VirtioDeviceType
Device-type discriminant for the MMIO
DeviceID register.Source§fn avail_features(&self) -> u64
fn avail_features(&self) -> u64
Bitmap of features the device offers. The transport ANDs this with
the driver’s
acked_features and surfaces the negotiated set.Source§fn acked_features(&self) -> u64
fn acked_features(&self) -> u64
Bitmap of features the driver has acknowledged.
Source§fn set_acked_features(&mut self, value: u64)
fn set_acked_features(&mut self, value: u64)
Set the driver-acked feature set. The transport calls this once per
MMIO
DriverFeatures write; implementors typically just store the
value.Source§fn queue_max_sizes(&self) -> &[u16]
fn queue_max_sizes(&self) -> &[u16]
Per-queue maximum descriptor counts. The vector length determines how
many vrings the device exposes; the value at each index becomes
QueueNumMax for that queue.Source§fn queues_mut(&mut self) -> &mut [Queue]
fn queues_mut(&mut self) -> &mut [Queue]
Borrow the device’s queue state mutably (transport uses this when the
driver writes queue-config registers).
Source§fn read_config(&self, _offset: u64, data: &mut [u8])
fn read_config(&self, _offset: u64, data: &mut [u8])
Read a slice of the device’s config space at
offset.Source§fn write_config(&mut self, _offset: u64, _data: &[u8])
fn write_config(&mut self, _offset: u64, _data: &[u8])
Write a slice into the device’s config space at
offset. Per the
virtio spec § 2.4.2, drivers SHOULD not write config-space after
DRIVER_OK; the transport gates on this and silently drops post-OK
writes via crate::transport::VirtioMmioTransport::accept_config_write.Source§fn activate(
&mut self,
mem: Arc<dyn GuestMemory>,
irq: IrqLine,
) -> Result<(), ActivateError>
fn activate( &mut self, mem: Arc<dyn GuestMemory>, irq: IrqLine, ) -> Result<(), ActivateError>
Take ownership of the resources needed to drive the device live.
Called exactly once on the driver’s
DRIVER_OK transition. Read moreSource§fn is_activated(&self) -> bool
fn is_activated(&self) -> bool
true once activate has succeeded.Source§fn process_queue(&mut self, queue_index: u16)
fn process_queue(&mut self, queue_index: u16)
Handler invoked on a guest write to the MMIO
QueueNotify register. Read moreAuto Trait Implementations§
impl Freeze for ConsoleDevice
impl !RefUnwindSafe for ConsoleDevice
impl Send for ConsoleDevice
impl Sync for ConsoleDevice
impl Unpin for ConsoleDevice
impl UnsafeUnpin for ConsoleDevice
impl !UnwindSafe for ConsoleDevice
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