mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-13 17:18:01 +03:00
virDomainTimerDef: Convert 'name' field to proper enum type
Adjust the type and the corresponding parser to use virXMLPropEnum. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
a9a2ecec54
commit
7fc2c87200
@ -10546,24 +10546,15 @@ virDomainTimerDefParseXML(xmlNodePtr node,
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
||||
xmlNodePtr catchup;
|
||||
int ret;
|
||||
g_autofree char *name = NULL;
|
||||
g_autofree char *tickpolicy = NULL;
|
||||
g_autofree char *track = NULL;
|
||||
g_autofree char *mode = NULL;
|
||||
|
||||
ctxt->node = node;
|
||||
|
||||
name = virXMLPropString(node, "name");
|
||||
if (name == NULL) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing timer name"));
|
||||
if (virXMLPropEnum(node, "name", virDomainTimerNameTypeFromString,
|
||||
VIR_XML_PROP_REQUIRED, &def->name) < 0)
|
||||
return NULL;
|
||||
}
|
||||
if ((def->name = virDomainTimerNameTypeFromString(name)) < 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("unknown timer name '%s'"), name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (virXMLPropTristateBool(node, "present",
|
||||
VIR_XML_PROP_NONE,
|
||||
|
@ -2472,7 +2472,7 @@ struct _virDomainTimerCatchupDef {
|
||||
};
|
||||
|
||||
struct _virDomainTimerDef {
|
||||
int name;
|
||||
virDomainTimerNameType name;
|
||||
virTristateBool present;
|
||||
int tickpolicy; /* enum virDomainTimerTickpolicyType */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user