mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 01:45:17 +00:00
virNodeDevCapsDefParseXML: Use virXMLProp*
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
3a4027511d
commit
afedd6dde5
@ -1972,24 +1972,13 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
|
||||
const char *virt_type)
|
||||
{
|
||||
virNodeDevCapsDef *caps;
|
||||
g_autofree char *tmp = NULL;
|
||||
int val, ret = -1;
|
||||
int ret = -1;
|
||||
|
||||
caps = g_new0(virNodeDevCapsDef, 1);
|
||||
|
||||
tmp = virXMLPropString(node, "type");
|
||||
if (!tmp) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing capability type"));
|
||||
if (virXMLPropEnum(node, "type", virNodeDevCapTypeFromString,
|
||||
VIR_XML_PROP_REQUIRED, &caps->data.type) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if ((val = virNodeDevCapTypeFromString(tmp)) < 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("unknown capability type '%s'"), tmp);
|
||||
goto error;
|
||||
}
|
||||
caps->data.type = val;
|
||||
|
||||
switch (caps->data.type) {
|
||||
case VIR_NODE_DEV_CAP_SYSTEM:
|
||||
|
Loading…
x
Reference in New Issue
Block a user