mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
virDomainRNGDef: Convert 'model' field to proper enum type
Convert the field and adjust the XML parser to use virXMLPropEnum(). Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
27a653b893
commit
53edfa23f1
@ -12116,21 +12116,16 @@ virDomainRNGDefParseXML(virDomainXMLOption *xmlopt,
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
||||
int nbackends;
|
||||
g_autofree xmlNodePtr *backends = NULL;
|
||||
g_autofree char *model = NULL;
|
||||
g_autofree char *backend = NULL;
|
||||
g_autofree char *type = NULL;
|
||||
|
||||
def = g_new0(virDomainRNGDef, 1);
|
||||
|
||||
if (!(model = virXMLPropString(node, "model"))) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s", _("missing RNG device model"));
|
||||
if (virXMLPropEnum(node, "model",
|
||||
virDomainRNGModelTypeFromString,
|
||||
VIR_XML_PROP_REQUIRED,
|
||||
&def->model) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if ((def->model = virDomainRNGModelTypeFromString(model)) < 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown RNG model '%1$s'"), model);
|
||||
goto error;
|
||||
}
|
||||
|
||||
ctxt->node = node;
|
||||
|
||||
|
@ -2609,7 +2609,7 @@ typedef enum {
|
||||
} virDomainRNGBackend;
|
||||
|
||||
struct _virDomainRNGDef {
|
||||
int model;
|
||||
virDomainRNGModel model;
|
||||
int backend;
|
||||
unsigned int rate; /* bytes per period */
|
||||
unsigned int period; /* milliseconds */
|
||||
|
@ -912,7 +912,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDef *dev,
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_RNG:
|
||||
switch ((virDomainRNGModel) dev->data.rng->model) {
|
||||
switch (dev->data.rng->model) {
|
||||
case VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL:
|
||||
/* Transitional devices only work in conventional PCI slots */
|
||||
return pciFlags;
|
||||
|
Loading…
x
Reference in New Issue
Block a user