qemu: caps: Make capability filler functions void

Most of them don't have anything to report so we can simplify the logic.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Peter Krempa 2019-10-25 13:25:20 +02:00
parent e60174fb3a
commit 6b9f2e8847

View File

@ -5250,7 +5250,7 @@ virQEMUCapsFillDomainOSCaps(virDomainCapsOSPtr os,
} }
static int static void
virQEMUCapsFillDomainCPUCaps(virCapsPtr caps, virQEMUCapsFillDomainCPUCaps(virCapsPtr caps,
virQEMUCapsPtr qemuCaps, virQEMUCapsPtr qemuCaps,
virDomainCapsPtr domCaps) virDomainCapsPtr domCaps)
@ -5287,23 +5287,19 @@ virQEMUCapsFillDomainCPUCaps(virCapsPtr caps,
} }
domCaps->cpu.custom = filtered; domCaps->cpu.custom = filtered;
} }
return 0;
} }
static int static void
virQEMUCapsFillDomainIOThreadCaps(virQEMUCapsPtr qemuCaps, virQEMUCapsFillDomainIOThreadCaps(virQEMUCapsPtr qemuCaps,
virDomainCapsPtr domCaps) virDomainCapsPtr domCaps)
{ {
domCaps->iothreads = virTristateBoolFromBool( domCaps->iothreads = virTristateBoolFromBool(
virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)); virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD));
return 0;
} }
static int static void
virQEMUCapsFillDomainDeviceDiskCaps(virQEMUCapsPtr qemuCaps, virQEMUCapsFillDomainDeviceDiskCaps(virQEMUCapsPtr qemuCaps,
const char *machine, const char *machine,
virDomainCapsDeviceDiskPtr disk) virDomainCapsDeviceDiskPtr disk)
@ -5348,12 +5344,10 @@ virQEMUCapsFillDomainDeviceDiskCaps(virQEMUCapsPtr qemuCaps,
VIR_DOMAIN_CAPS_ENUM_SET(disk->model, VIR_DOMAIN_CAPS_ENUM_SET(disk->model,
VIR_DOMAIN_DISK_MODEL_VIRTIO_NON_TRANSITIONAL); VIR_DOMAIN_DISK_MODEL_VIRTIO_NON_TRANSITIONAL);
} }
return 0;
} }
static int static void
virQEMUCapsFillDomainDeviceGraphicsCaps(virQEMUCapsPtr qemuCaps, virQEMUCapsFillDomainDeviceGraphicsCaps(virQEMUCapsPtr qemuCaps,
virDomainCapsDeviceGraphicsPtr dev) virDomainCapsDeviceGraphicsPtr dev)
{ {
@ -5365,12 +5359,10 @@ virQEMUCapsFillDomainDeviceGraphicsCaps(virQEMUCapsPtr qemuCaps,
VIR_DOMAIN_CAPS_ENUM_SET(dev->type, VIR_DOMAIN_GRAPHICS_TYPE_VNC); VIR_DOMAIN_CAPS_ENUM_SET(dev->type, VIR_DOMAIN_GRAPHICS_TYPE_VNC);
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE)) if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE))
VIR_DOMAIN_CAPS_ENUM_SET(dev->type, VIR_DOMAIN_GRAPHICS_TYPE_SPICE); VIR_DOMAIN_CAPS_ENUM_SET(dev->type, VIR_DOMAIN_GRAPHICS_TYPE_SPICE);
return 0;
} }
static int static void
virQEMUCapsFillDomainDeviceVideoCaps(virQEMUCapsPtr qemuCaps, virQEMUCapsFillDomainDeviceVideoCaps(virQEMUCapsPtr qemuCaps,
virDomainCapsDeviceVideoPtr dev) virDomainCapsDeviceVideoPtr dev)
{ {
@ -5389,12 +5381,10 @@ virQEMUCapsFillDomainDeviceVideoCaps(virQEMUCapsPtr qemuCaps,
VIR_DOMAIN_CAPS_ENUM_SET(dev->modelType, VIR_DOMAIN_VIDEO_TYPE_VIRTIO); VIR_DOMAIN_CAPS_ENUM_SET(dev->modelType, VIR_DOMAIN_VIDEO_TYPE_VIRTIO);
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_BOCHS_DISPLAY)) if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_BOCHS_DISPLAY))
VIR_DOMAIN_CAPS_ENUM_SET(dev->modelType, VIR_DOMAIN_VIDEO_TYPE_BOCHS); VIR_DOMAIN_CAPS_ENUM_SET(dev->modelType, VIR_DOMAIN_VIDEO_TYPE_BOCHS);
return 0;
} }
static int static void
virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps, virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps,
virDomainCapsDeviceHostdevPtr hostdev) virDomainCapsDeviceHostdevPtr hostdev)
{ {
@ -5432,12 +5422,10 @@ virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps,
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT, VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT,
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO); VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO);
} }
return 0;
} }
static int static void
virQEMUCapsFillDomainDeviceRNGCaps(virQEMUCapsPtr qemuCaps, virQEMUCapsFillDomainDeviceRNGCaps(virQEMUCapsPtr qemuCaps,
virDomainCapsDeviceRNGPtr rng) virDomainCapsDeviceRNGPtr rng)
{ {
@ -5460,8 +5448,6 @@ virQEMUCapsFillDomainDeviceRNGCaps(virQEMUCapsPtr qemuCaps,
VIR_DOMAIN_CAPS_ENUM_SET(rng->backendModel, VIR_DOMAIN_RNG_BACKEND_EGD); VIR_DOMAIN_CAPS_ENUM_SET(rng->backendModel, VIR_DOMAIN_RNG_BACKEND_EGD);
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_RNG_RANDOM)) if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_RNG_RANDOM))
VIR_DOMAIN_CAPS_ENUM_SET(rng->backendModel, VIR_DOMAIN_RNG_BACKEND_RANDOM); VIR_DOMAIN_CAPS_ENUM_SET(rng->backendModel, VIR_DOMAIN_RNG_BACKEND_RANDOM);
return 0;
} }
@ -5523,10 +5509,8 @@ virQEMUCapsSupportsGICVersion(virQEMUCapsPtr qemuCaps,
* and virtualization type. Moreover, a common format is used to store * and virtualization type. Moreover, a common format is used to store
* information about enumerations in @domCaps, so further processing is * information about enumerations in @domCaps, so further processing is
* required. * required.
*
* Returns: 0 on success, <0 on failure
*/ */
static int static void
virQEMUCapsFillDomainFeatureGICCaps(virQEMUCapsPtr qemuCaps, virQEMUCapsFillDomainFeatureGICCaps(virQEMUCapsPtr qemuCaps,
virDomainCapsPtr domCaps) virDomainCapsPtr domCaps)
{ {
@ -5536,7 +5520,7 @@ virQEMUCapsFillDomainFeatureGICCaps(virQEMUCapsPtr qemuCaps,
gic->supported = VIR_TRISTATE_BOOL_NO; gic->supported = VIR_TRISTATE_BOOL_NO;
if (!qemuDomainMachineIsARMVirt(domCaps->machine, domCaps->arch)) if (!qemuDomainMachineIsARMVirt(domCaps->machine, domCaps->arch))
return 0; return;
for (version = VIR_GIC_VERSION_LAST - 1; for (version = VIR_GIC_VERSION_LAST - 1;
version > VIR_GIC_VERSION_NONE; version > VIR_GIC_VERSION_NONE;
@ -5551,8 +5535,6 @@ virQEMUCapsFillDomainFeatureGICCaps(virQEMUCapsPtr qemuCaps,
VIR_DOMAIN_CAPS_ENUM_SET(gic->version, VIR_DOMAIN_CAPS_ENUM_SET(gic->version,
version); version);
} }
return 0;
} }
@ -5564,17 +5546,15 @@ virQEMUCapsFillDomainFeatureGICCaps(virQEMUCapsPtr qemuCaps,
* Take the information about SEV capabilities that has been obtained * Take the information about SEV capabilities that has been obtained
* using the 'query-sev-capabilities' QMP command and stored in @qemuCaps * using the 'query-sev-capabilities' QMP command and stored in @qemuCaps
* and convert it to a form suitable for @domCaps. * and convert it to a form suitable for @domCaps.
*
* Returns: 0 on success, -1 on failure
*/ */
static int static void
virQEMUCapsFillDomainFeatureSEVCaps(virQEMUCapsPtr qemuCaps, virQEMUCapsFillDomainFeatureSEVCaps(virQEMUCapsPtr qemuCaps,
virDomainCapsPtr domCaps) virDomainCapsPtr domCaps)
{ {
virSEVCapability *cap = qemuCaps->sevCapabilities; virSEVCapability *cap = qemuCaps->sevCapabilities;
if (!cap) if (!cap)
return 0; return;
domCaps->sev = g_new0(virSEVCapability, 1); domCaps->sev = g_new0(virSEVCapability, 1);
@ -5582,8 +5562,6 @@ virQEMUCapsFillDomainFeatureSEVCaps(virQEMUCapsPtr qemuCaps,
domCaps->sev->cert_chain = g_strdup(cap->cert_chain); domCaps->sev->cert_chain = g_strdup(cap->cert_chain);
domCaps->sev->cbitpos = cap->cbitpos; domCaps->sev->cbitpos = cap->cbitpos;
domCaps->sev->reduced_phys_bits = cap->reduced_phys_bits; domCaps->sev->reduced_phys_bits = cap->reduced_phys_bits;
return 0;
} }
@ -5623,19 +5601,19 @@ virQEMUCapsFillDomainCaps(virCapsPtr caps,
domCaps->machine, domCaps->machine,
domCaps->arch, domCaps->arch,
privileged, privileged,
firmwares, nfirmwares) < 0 || firmwares, nfirmwares) < 0)
virQEMUCapsFillDomainCPUCaps(caps, qemuCaps, domCaps) < 0 ||
virQEMUCapsFillDomainIOThreadCaps(qemuCaps, domCaps) < 0 ||
virQEMUCapsFillDomainDeviceDiskCaps(qemuCaps,
domCaps->machine, disk) < 0 ||
virQEMUCapsFillDomainDeviceGraphicsCaps(qemuCaps, graphics) < 0 ||
virQEMUCapsFillDomainDeviceVideoCaps(qemuCaps, video) < 0 ||
virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev) < 0 ||
virQEMUCapsFillDomainDeviceRNGCaps(qemuCaps, rng) < 0 ||
virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps) < 0 ||
virQEMUCapsFillDomainFeatureSEVCaps(qemuCaps, domCaps) < 0)
return -1; return -1;
virQEMUCapsFillDomainCPUCaps(caps, qemuCaps, domCaps);
virQEMUCapsFillDomainIOThreadCaps(qemuCaps, domCaps);
virQEMUCapsFillDomainDeviceDiskCaps(qemuCaps, domCaps->machine, disk);
virQEMUCapsFillDomainDeviceGraphicsCaps(qemuCaps, graphics);
virQEMUCapsFillDomainDeviceVideoCaps(qemuCaps, video);
virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev);
virQEMUCapsFillDomainDeviceRNGCaps(qemuCaps, rng);
virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps);
virQEMUCapsFillDomainFeatureSEVCaps(qemuCaps, domCaps);
return 0; return 0;
} }