Skip to main content

Transport

Trait Transport 

pub trait Transport {
Show 16 methods // Required methods fn device_type(&self) -> DeviceType; fn read_device_features(&mut self) -> u64; fn write_driver_features(&mut self, driver_features: u64); fn max_queue_size(&mut self, queue: u16) -> u32; fn notify(&mut self, queue: u16); fn get_status(&self) -> DeviceStatus; fn set_status(&mut self, status: DeviceStatus); fn set_guest_page_size(&mut self, guest_page_size: u32); fn requires_legacy_layout(&self) -> bool; fn queue_set( &mut self, queue: u16, size: u32, descriptors: usize, driver_area: usize, device_area: usize, ); fn queue_unset(&mut self, queue: u16); fn queue_used(&mut self, queue: u16) -> bool; fn ack_interrupt(&mut self) -> bool; fn config_space<T>(&self) -> Result<NonNull<T>, Error> where T: 'static; // Provided methods fn begin_init<F>(&mut self, supported_features: F) -> F where F: Flags<Bits = u64> + BitAnd<Output = F> + Debug { ... } fn finish_init(&mut self) { ... }
}
Expand description

A VirtIO transport layer.

Required Methods§

fn device_type(&self) -> DeviceType

Gets the device type.

fn read_device_features(&mut self) -> u64

Reads device features.

fn write_driver_features(&mut self, driver_features: u64)

Writes device features.

fn max_queue_size(&mut self, queue: u16) -> u32

Gets the max size of the given queue.

fn notify(&mut self, queue: u16)

Notifies the given queue on the device.

fn get_status(&self) -> DeviceStatus

Gets the device status.

fn set_status(&mut self, status: DeviceStatus)

Sets the device status.

fn set_guest_page_size(&mut self, guest_page_size: u32)

Sets the guest page size.

fn requires_legacy_layout(&self) -> bool

Returns whether the transport requires queues to use the legacy layout.

Ref: 2.6.2 Legacy Interfaces: A Note on Virtqueue Layout

fn queue_set( &mut self, queue: u16, size: u32, descriptors: usize, driver_area: usize, device_area: usize, )

Sets up the given queue.

fn queue_unset(&mut self, queue: u16)

Disables and resets the given queue.

fn queue_used(&mut self, queue: u16) -> bool

Returns whether the queue is in use, i.e. has a nonzero PFN or is marked as ready.

fn ack_interrupt(&mut self) -> bool

Acknowledges an interrupt.

Returns true on success.

fn config_space<T>(&self) -> Result<NonNull<T>, Error>
where T: 'static,

Gets the pointer to the config space.

Provided Methods§

fn begin_init<F>(&mut self, supported_features: F) -> F
where F: Flags<Bits = u64> + BitAnd<Output = F> + Debug,

Begins initializing the device.

Ref: virtio 3.1.1 Device Initialization

Returns the negotiated set of features.

fn finish_init(&mut self)

Finishes initializing the device.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§