pub struct Virtqueue<'a, R: Copy> { /* private fields */ }
Expand description

A virtqueue of a virtio device.

R is used to store device-specific per-request data (like the request header or status byte) in memory shared with the device and is copied on completion. Don’t put things there that the device doesn’t have to access, in the interest of both security and performance.

Implementations

Creates a new virtqueue in the passed memory buffer.

buf has to be memory that is visible for the device. It is used to store all descriptors, rings and device-specific per-request data for the queue.

Returns the number of entries in each of the descriptor table and rings.

Returns a raw pointer to the start of the descriptor table.

Returns a raw pointer to the start of the available ring.

Returns a raw pointer to the start of the used ring.

Enqueues a new request.

prepare is a function or closure that gets a reference to the device-specific per-request data in its final location in the virtqueue memory and a FnMut to add virtio descriptors to the request. It can set up the per-request data as necessary and must add all descriptors needed for the request.

The parameters of the FnMut it received are the iovec describing the buffer to be added and a boolean from_dev that is true if this buffer is written by the device and false if it is read by the device.

Returns an iterator that returns all completed requests.

Trait Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.