Expand description
This module implements the virtio wayland used by the guest to access the host’s wayland server.
The virtio wayland protocol is done over two queues: in
and out
. The in
queue is used for
sending commands to the guest that are generated by the host, usually messages from the wayland
server. The out
queue is for commands from the guest, usually requests to allocate shared
memory, open a wayland server connection, or send data over an existing connection.
Each WlVfd
represents one virtual file descriptor created by either the guest or the host.
Virtual file descriptors contain actual file descriptors, either a shared memory file descriptor
or a unix domain socket to the wayland server. In the shared memory case, there is also an
associated slot that indicates which hypervisor memory slot the memory is installed into, as
well as a page frame number that the guest can access the memory from.
The types starting with Ctrl
are structures representing the virtio wayland protocol “on the
wire.” They are decoded and executed in the execute
function and encoded as some variant of
WlResp
for responses.
There is one WlState
instance that contains every known vfd and the current state of in
queue. The in
queue requires extra state to buffer messages to the guest in case the in
queue is already full. The WlState
also has a control socket necessary to fulfill certain
requests, such as those registering guest memory.
The Worker
is responsible for the poll loop over all possible events, encoding/decoding from
the virtio queue, and routing messages in and out of WlState
. Possible events include the kill
event, available descriptors on the in
or out
queue, and incoming data on any vfd’s socket.
Structs§
Enums§
Constants§
- Constant ioctl request number.
- Constant ioctl request number.
Functions§
- is_fence 🔒
- Handle incoming events and forward them to the VM over the input queue.
- Handle messages from the output queue and forward them to the display sever, if necessary.
Type Aliases§
- WlResult 🔒