Crate vmbus_user_channel

Source
Expand description

Support for a vmbus channel client via the /dev/uioX devices.

This mechanism works as follows. The uio_vmbus_client kernel driver can be configured to bind to devices of a given vmbus device ID by writing the device ID to to /sys/bus/vmbus/uio_vmbus_client/new_id. Then, for each vmbus channel with that device ID, the driver will create a device named /dev/uioX.

When this device is opened, the driver will allocate a ring buffer and open the corresponding vmbus channel. The channel can then be controlled in the following ways:

  • Ring buffer memory can be accessed by using mmap to map the memory into user mode.

  • The host can be signaled by using write to write an 4-byte non-zero value. This is the same mechanism as eventfd.

  • The guest can wait for a signal by using read to read an 4-byte value. The file can be marked non-blocking, in which case the read will fail with EAGAIN if there is no signal. The guest can additionally use the kernel’s poll infrastructure to wait for a signal to be available by waiting for POLLIN readiness.

Currently there is no mechanism to discover that the channel has been revoked.

Structs§

Error
An error connecting to the vmbus channel.
MappedRingMem
Ring buffer memory backed by a memory mapped channel.

Functions§

byte_pipe
Opens a byte pipe for the channel with a file from open_uio_device.
channel
Opens a channel with a file from open_uio_device.
message_pipe
Opens a message pipe for the channel with a file from open_uio_device.
open_uio_device
Opens the UIO device for passing to channel.