machina_virtio_device

Function config_builder_from_stream

Source
pub async fn config_builder_from_stream<'a, N: Clone, M: DriverMem, Q: QueueCheck + ?Sized>(
    builder: DeviceBuilder<N>,
    stream: &mut VirtioDeviceRequestStream,
    queues: &Q,
    mem: &'a M,
) -> Result<(Device<'a, N>, VirtioDeviceReadyResponder), DeviceError>
Expand description

Process a VirtioDeviceRequestStream to configure all the queues.

Runs a simple message loop to process all VirtioDeviceRequest::ConfigureQueue until a VirtioDeviceRequest::Ready is received. If a device expects no other messages during this configuration then this automates the building. Otherwise if other messages are expected clients will need to run their own message loop and use [add_queue].

On success a Device and a VirtioDeviceReadyResponder will be returned. The negotiated features can be queried and then the [responder] (VirtioDeviceReadyResponder) can be signaled once the device is satisfied and able to start.

A reference to a QueueCheck must be provided for the builder to know whether to accept or reject any particular queue configuration request.