Contents

VZVirtioQueueElement

A unit of work on a Virtio queue, also known as a descriptor chain.

Declaration

class VZVirtioQueueElement

Overview

A VZVirtioQueueElement represents a unit of work from a VZVirtioQueue with which it’s associated, facilitating device operations specified by the VZCustomVirtioDevice that the VZVirtioQueue belongs to. It exposes the scatter-gather memory to the guest’s dynamic random access memory (DRAM) that the Virtio queue references as read buffers and write buffers; this allows for read-only and write-only access, respectively, to this memory on the host. It’s strongly recommended to access the read buffers and write buffers only once using the readBytes(withExactLength:), readBytes(intoBuffer:exactLength:), write(_:), and writeBuffer(_:exactLength:) methods. Those methods enforce that you only access the memory once and changes the value of readBuffersAvailableByteCount and writeBuffersAvailableByteCount accordingly. The peekIntoReadBuffers(withExactLength:) method allows for multiple read accesses if absolutely necessary and doesn’t change the value of readBuffersAvailableByteCount.

Don’t instantiate VZVirtioQueueElement objects directly, the framework provides them through the nextElement() method when you handle any elements in the Virtio queue. When you are done with processing the element, you need to call returnToQueue() to return the element back to the guest.

Topics

Instance Properties

Instance Methods

See Also

Related Documentation

Working with VirtQueues