Data structure used for creating new vdev instances
#include <qvm/vdev-core.h>
struct vdev_factory { struct vdev_factory* next; int (*control)(vdev_t *vdev, unsigned ctrl, const char *arg); enum vdev_ref_status (*vread)(vdev_t *vdev, unsigned cookie, const struct qvm_state_block *vopnd, const struct qvm_state_block *oopnd, struct guest_cpu *gcp); enum vdev_ref_status (*vwrite)(vdev_t *vdev, unsigned cookie, const struct qvm_state_block *vopnd, const struct qvm_state_block *oopnd, struct guest_cpu *gcp); int (*pulse)(vdev_t *vdev, int8_t code); void (*timer)(vdev_t *vdev, void *data, const struct guest_timer_data *tdp, struct guest_cpu *gcp); const struct vdev_pic_functions* pic; const char *const * option_list; const char* name; unsigned factory_flags; unsigned acc_sizes; unsigned extra_space; unsigned safety; } ;
A pointer to next entry in a linked list of structures Initialized by qvm.
Required function to perform various operations on the vdev (see VDEV_CTRL_* macros)
Optional function to handle a read from the vdev. If you don't handle this request, behavior is as specified by the unsupported option in the VM configuration (see the unsupported option in the QHS 2.0 User's Guide).
Optional function to handle a write to the vdev. If you don't handle this request, behavior is as specified by the unsupported option in the VM configuration (see the unsupported option in the QHS 2.0 User's Guide).
Optional function to handle a pulse delivery for the vdev. Optional: if you send pulse to yourself, you need this vdev, or you'll get a crash.
Optional function to handle a timer or trigger notification for the vdev. If you use guest_timer_notify(), you need this, or you'll get a crash.
PIC-specific operations. See vdev_pic_functions.
A pointer to an array of vdev-specific options (Optional: VDEV_CTRL_FIRST_OPTIDX).
The name of the vdev type. If NULL, the name is filled in with the name of the shared object the factory is in. This should typically be NULL. The qvm process adds the vdev- prefix and the .so suffix.
Bit set of vdev_factory_flags values to control parsing and creation of the device. See above.
Bit set of (1u << byte_size) values for a list of allowed access sizes.
The number of additional bytes to allocate in the vdev_s structure for the device-specific state. A pointer to that space is stored in the vdev_s structure's v_device member.
Specify if this is the safety version of the vdev; if this is the safety version, you should use VDEV_SAFETY_SELECTED.
You can provide NULL to optional functions.
The only time you manipulate the pointer to this function is when you pass it to vdev_register_factory.