bhyve: Use designated initializers for virtio_consts tables
This is easier to read and addresses some compiler warnings. One might expect these tables to be read-only but it seems that the snapshot/restore code may modify them. MFC after: 2 weeks
This commit is contained in:
parent
ee83710bc4
commit
6cb261620d
@ -105,18 +105,16 @@ static int pci_vt9p_cfgread(void *, int, int, uint32_t *);
|
||||
static void pci_vt9p_neg_features(void *, uint64_t);
|
||||
|
||||
static struct virtio_consts vt9p_vi_consts = {
|
||||
"vt9p", /* our name */
|
||||
1, /* we support 1 virtqueue */
|
||||
VT9P_CONFIGSPACESZ, /* config reg size */
|
||||
pci_vt9p_reset, /* reset */
|
||||
pci_vt9p_notify, /* device-wide qnotify */
|
||||
pci_vt9p_cfgread, /* read virtio config */
|
||||
NULL, /* write virtio config */
|
||||
pci_vt9p_neg_features, /* apply negotiated features */
|
||||
(1 << 0), /* our capabilities */
|
||||
.vc_name = "vt9p",
|
||||
.vc_nvq = 1,
|
||||
.vc_cfgsize = VT9P_CONFIGSPACESZ,
|
||||
.vc_reset = pci_vt9p_reset,
|
||||
.vc_qnotify = pci_vt9p_notify,
|
||||
.vc_cfgread = pci_vt9p_cfgread,
|
||||
.vc_apply_features = pci_vt9p_neg_features,
|
||||
.vc_hv_caps = (1 << 0),
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
pci_vt9p_reset(void *vsc)
|
||||
{
|
||||
|
@ -208,19 +208,19 @@ static int pci_vtblk_snapshot(void *, struct vm_snapshot_meta *);
|
||||
#endif
|
||||
|
||||
static struct virtio_consts vtblk_vi_consts = {
|
||||
"vtblk", /* our name */
|
||||
1, /* we support 1 virtqueue */
|
||||
sizeof(struct vtblk_config), /* config reg size */
|
||||
pci_vtblk_reset, /* reset */
|
||||
pci_vtblk_notify, /* device-wide qnotify */
|
||||
pci_vtblk_cfgread, /* read PCI config */
|
||||
pci_vtblk_cfgwrite, /* write PCI config */
|
||||
NULL, /* apply negotiated features */
|
||||
VTBLK_S_HOSTCAPS, /* our capabilities */
|
||||
.vc_name = "vtblk",
|
||||
.vc_nvq = 1,
|
||||
.vc_cfgsize = sizeof(struct vtblk_config),
|
||||
.vc_reset = pci_vtblk_reset,
|
||||
.vc_qnotify = pci_vtblk_notify,
|
||||
.vc_cfgread = pci_vtblk_cfgread,
|
||||
.vc_cfgwrite = pci_vtblk_cfgwrite,
|
||||
.vc_apply_features = NULL,
|
||||
.vc_hv_caps = VTBLK_S_HOSTCAPS,
|
||||
#ifdef BHYVE_SNAPSHOT
|
||||
pci_vtblk_pause, /* pause blockif threads */
|
||||
pci_vtblk_resume, /* resume blockif threads */
|
||||
pci_vtblk_snapshot, /* save / restore device state */
|
||||
.vc_pause = pci_vtblk_pause,
|
||||
.vc_resume = pci_vtblk_resume,
|
||||
.vc_snapshot = pci_vtblk_snapshot,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -169,18 +169,16 @@ static void pci_vtcon_announce_port(struct pci_vtcon_port *);
|
||||
static void pci_vtcon_open_port(struct pci_vtcon_port *, bool);
|
||||
|
||||
static struct virtio_consts vtcon_vi_consts = {
|
||||
"vtcon", /* our name */
|
||||
VTCON_MAXQ, /* we support VTCON_MAXQ virtqueues */
|
||||
sizeof(struct pci_vtcon_config), /* config reg size */
|
||||
pci_vtcon_reset, /* reset */
|
||||
NULL, /* device-wide qnotify */
|
||||
pci_vtcon_cfgread, /* read virtio config */
|
||||
pci_vtcon_cfgwrite, /* write virtio config */
|
||||
pci_vtcon_neg_features, /* apply negotiated features */
|
||||
VTCON_S_HOSTCAPS, /* our capabilities */
|
||||
.vc_name = "vtcon",
|
||||
.vc_nvq = VTCON_MAXQ,
|
||||
.vc_cfgsize = sizeof(struct pci_vtcon_config),
|
||||
.vc_reset = pci_vtcon_reset,
|
||||
.vc_cfgread = pci_vtcon_cfgread,
|
||||
.vc_cfgwrite = pci_vtcon_cfgwrite,
|
||||
.vc_apply_features = pci_vtcon_neg_features,
|
||||
.vc_hv_caps = VTCON_S_HOSTCAPS,
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
pci_vtcon_reset(void *vsc)
|
||||
{
|
||||
|
@ -159,15 +159,13 @@ static int pci_vtinput_cfgread(void *, int, int, uint32_t *);
|
||||
static int pci_vtinput_cfgwrite(void *, int, int, uint32_t);
|
||||
|
||||
static struct virtio_consts vtinput_vi_consts = {
|
||||
"vtinput", /* our name */
|
||||
VTINPUT_MAXQ, /* we support 1 virtqueue */
|
||||
sizeof(struct vtinput_config), /* config reg size */
|
||||
pci_vtinput_reset, /* reset */
|
||||
NULL, /* device-wide qnotify -- not used */
|
||||
pci_vtinput_cfgread, /* read virtio config */
|
||||
pci_vtinput_cfgwrite, /* write virtio config */
|
||||
NULL, /* apply negotiated features */
|
||||
0, /* our capabilities */
|
||||
.vc_name = "vtinput",
|
||||
.vc_nvq = VTINPUT_MAXQ,
|
||||
.vc_cfgsize = sizeof(struct vtinput_config),
|
||||
.vc_reset = pci_vtinput_reset,
|
||||
.vc_cfgread = pci_vtinput_cfgread,
|
||||
.vc_cfgwrite = pci_vtinput_cfgwrite,
|
||||
.vc_hv_caps = 0,
|
||||
};
|
||||
|
||||
static void
|
||||
|
@ -145,19 +145,18 @@ static int pci_vtnet_snapshot(void *, struct vm_snapshot_meta *);
|
||||
#endif
|
||||
|
||||
static struct virtio_consts vtnet_vi_consts = {
|
||||
"vtnet", /* our name */
|
||||
VTNET_MAXQ - 1, /* we currently support 2 virtqueues */
|
||||
sizeof(struct virtio_net_config), /* config reg size */
|
||||
pci_vtnet_reset, /* reset */
|
||||
NULL, /* device-wide qnotify -- not used */
|
||||
pci_vtnet_cfgread, /* read PCI config */
|
||||
pci_vtnet_cfgwrite, /* write PCI config */
|
||||
pci_vtnet_neg_features, /* apply negotiated features */
|
||||
VTNET_S_HOSTCAPS, /* our capabilities */
|
||||
.vc_name = "vtnet",
|
||||
.vc_nvq = VTNET_MAXQ - 1,
|
||||
.vc_cfgsize = sizeof(struct virtio_net_config),
|
||||
.vc_reset = pci_vtnet_reset,
|
||||
.vc_cfgread = pci_vtnet_cfgread,
|
||||
.vc_cfgwrite = pci_vtnet_cfgwrite,
|
||||
.vc_apply_features = pci_vtnet_neg_features,
|
||||
.vc_hv_caps = VTNET_S_HOSTCAPS,
|
||||
#ifdef BHYVE_SNAPSHOT
|
||||
pci_vtnet_pause, /* pause rx/tx threads */
|
||||
pci_vtnet_resume, /* resume rx/tx threads */
|
||||
pci_vtnet_snapshot, /* save / restore device state */
|
||||
.vc_pause = pci_vtnet_pause,
|
||||
.vc_resume = pci_vtnet_resume,
|
||||
.vc_snapshot = pci_vtnet_snapshot,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -84,18 +84,14 @@ static void pci_vtrnd_reset(void *);
|
||||
static void pci_vtrnd_notify(void *, struct vqueue_info *);
|
||||
|
||||
static struct virtio_consts vtrnd_vi_consts = {
|
||||
"vtrnd", /* our name */
|
||||
1, /* we support 1 virtqueue */
|
||||
0, /* config reg size */
|
||||
pci_vtrnd_reset, /* reset */
|
||||
pci_vtrnd_notify, /* device-wide qnotify */
|
||||
NULL, /* read virtio config */
|
||||
NULL, /* write virtio config */
|
||||
NULL, /* apply negotiated features */
|
||||
0, /* our capabilities */
|
||||
.vc_name = "vtrnd",
|
||||
.vc_nvq = 1,
|
||||
.vc_cfgsize = 0,
|
||||
.vc_reset = pci_vtrnd_reset,
|
||||
.vc_qnotify = pci_vtrnd_notify,
|
||||
.vc_hv_caps = 0,
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
pci_vtrnd_reset(void *vsc)
|
||||
{
|
||||
|
@ -248,15 +248,14 @@ static int pci_vtscsi_init_queue(struct pci_vtscsi_softc *,
|
||||
static int pci_vtscsi_init(struct vmctx *, struct pci_devinst *, nvlist_t *);
|
||||
|
||||
static struct virtio_consts vtscsi_vi_consts = {
|
||||
"vtscsi", /* our name */
|
||||
VTSCSI_MAXQ, /* we support 2+n virtqueues */
|
||||
sizeof(struct pci_vtscsi_config), /* config reg size */
|
||||
pci_vtscsi_reset, /* reset */
|
||||
NULL, /* device-wide qnotify */
|
||||
pci_vtscsi_cfgread, /* read virtio config */
|
||||
pci_vtscsi_cfgwrite, /* write virtio config */
|
||||
pci_vtscsi_neg_features, /* apply negotiated features */
|
||||
0, /* our capabilities */
|
||||
.vc_name = "vtscsi",
|
||||
.vc_nvq = VTSCSI_MAXQ,
|
||||
.vc_cfgsize = sizeof(struct pci_vtscsi_config),
|
||||
.vc_reset = pci_vtscsi_reset,
|
||||
.vc_cfgread = pci_vtscsi_cfgread,
|
||||
.vc_cfgwrite = pci_vtscsi_cfgwrite,
|
||||
.vc_apply_features = pci_vtscsi_neg_features,
|
||||
.vc_hv_caps = 0,
|
||||
};
|
||||
|
||||
static void *
|
||||
|
Loading…
x
Reference in New Issue
Block a user