vdev_factory
Data structure used for creating new vdev instances
Synopsis:
#include <qvm/vdev-core.h>
struct vdev_factory {
struct vdev_factory* next;
int (*control)(vdev_t *vdev, vdev_ctrl_options_t ctrl, const char *arg);
vdev_ref_status_t (*vread)(vdev_t *vdev,
unsigned cookie,
const struct qvm_state_block *vopnd,
const struct qvm_state_block *oopnd,
struct guest_cpu *gcp);
vdev_ref_status_t (*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, const struct _pulse *pulse);
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;
vdev_factory_flags_t factory_flags;
unsigned acc_sizes;
unsigned extra_space;
};Data:
- struct vdev_factory* next
- A pointer to the next entry in a linked list of structures. Initialized by qvm.
- int (*control)(vdev_t *vdev, vdev_ctrl_options_t ctrl, const char *arg)
- A required function to perform various operations on the vdev (see the VDEV_CTRL_* macros).
- vdev_ref_status_t (*vread)(vdev_t *vdev, unsigned cookie, const struct qvm_state_block *vopnd, const struct qvm_state_block *oopnd, struct guest_cpu *gcp)
- An optional function to handle a read from the vdev,
which occurs when the guest writes data. If you don't handle this request,
behavior is as specified by the unsupported option
in the VM configuration (see unsupported in the User's Guide
VM Configuration Reference
chapter). - vdev_ref_status_t (*vwrite)(vdev_t *vdev, unsigned cookie, const struct qvm_state_block *vopnd, const struct qvm_state_block *oopnd, struct guest_cpu *gcp)
- An optional function to handle a write to the vdev,
which occurs when the guest reads data. If you don't handle this request,
behavior is as specified by the unsupported option
in the VM configuration (see unsupported in the
User's Guide
VM Configuration Reference
chapter). - int (*pulse)(vdev_t *vdev, const struct _pulse *pulse)
- An optional function to handle a pulse delivery for the vdev. If you send a pulse to yourself, you need this callback, otherwise you'll get a crash.
- void (*timer)(vdev_t *vdev, void *data, const struct guest_timer_data *tdp, struct guest_cpu *gcp)
- An optional function to handle a timer or trigger notification for the vdev. If you use guest_timer_notify(), you need this callback, otherwise you'll get a crash.
- const struct vdev_pic_functions* pic
- A pointer to a structure with PIC-specific operations (see vdev_pic_functions).
- const char* const* option_list
- A pointer to an array of vdev-specific options; this may include VDEV_CTRL_FIRST_OPTIDX.
- const char* name
- The name of the vdev type. This field should typically be NULL. When it is, the name is filled in with the name of the shared object the factory is in. The qvm process adds the vdev- prefix and the .so suffix.
- vdev_factory_flags_t factory_flags
- A bitset of VFF_* flags that control the parsing and creation of the device.
- unsigned acc_sizes
- A bitset of (
1u << byte_size) values that define a list of allowed access sizes. - unsigned extra_space
- 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 structure's v_device member.
Description:
The vdev_factory structure is used for creating new vdev instances. The only time you manipulate the pointer to this function is when you pass it to vdev_register_factory().
You can specify NULL in the fields that point to optional functions.
Page updated:
