virtio_device

Module ring

Source
Expand description

Minimal type-safe definitions of the virtio data structures.

Contains definitions and type-safe accessors and manipulators of the virtio data structures. For the leaf data structures like descriptors these definitions are simply the in memory layout as a Rust struct.

Unfortunately the virtqueues are a variable sized data structure, whose length is not known till run time as the size is determined by the driver. Representing the virtqueue as ‘just’ a Rust struct is therefore not possible.

Two structs are used as for the representation as it allows for separating the Device owned and Driver owned portions of the virtqueue into separate portions with their correct mutability.

Due to the split into the Driver and Device structs there is no specifically named virtqueue in this module. The Queue builds on the Driver and Device to build useful virtqueue functionality.

These abstractions are intended to be type-safe, but not enforce correct implementation of the virtio protocols. As such reading the [virtio specification] (https://docs.oasis-open.org/virtio/virtio/v1.1/csprd01/virtio-v1.1-csprd01.html) is required to correctly use this module. Most likely you do not want to use these directly and want to use the higher level queue, and chain modules that provide easier to use wrappers.

Structs§

  • Virtio descriptor data structure
  • Represents the device owned data.
  • Representation of driver owned data.
  • Representation of an entry in the used ring.

Enums§

Constants§