mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
nodedev: refactor css XML parsing from ccw XML parsing
In preparation for easier extension later. Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
4402295d37
commit
245ff2d663
@ -1195,6 +1195,31 @@ virNodeDevCCWDeviceAddressParseXML(xmlXPathContextPtr ctxt,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virNodeDevCapCCWParseXML(xmlXPathContextPtr ctxt,
|
||||
virNodeDeviceDef *def,
|
||||
xmlNodePtr node,
|
||||
virNodeDevCapCCW *ccw_dev)
|
||||
{
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
||||
g_autofree virCCWDeviceAddress *ccw_addr = NULL;
|
||||
|
||||
ctxt->node = node;
|
||||
|
||||
ccw_addr = g_new0(virCCWDeviceAddress, 1);
|
||||
|
||||
if (virNodeDevCCWDeviceAddressParseXML(ctxt, node, def->name, ccw_addr) < 0)
|
||||
return -1;
|
||||
|
||||
ccw_dev->cssid = ccw_addr->cssid;
|
||||
ccw_dev->ssid = ccw_addr->ssid;
|
||||
ccw_dev->devno = ccw_addr->devno;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virNodeDevCSSCapabilityParseXML(xmlXPathContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
@ -1223,7 +1248,7 @@ virNodeDevCSSCapabilityParseXML(xmlXPathContextPtr ctxt,
|
||||
|
||||
|
||||
static int
|
||||
virNodeDevCapCCWParseXML(xmlXPathContextPtr ctxt,
|
||||
virNodeDevCapCSSParseXML(xmlXPathContextPtr ctxt,
|
||||
virNodeDeviceDef *def,
|
||||
xmlNodePtr node,
|
||||
virNodeDevCapCCW *ccw_dev)
|
||||
@ -1232,19 +1257,12 @@ virNodeDevCapCCWParseXML(xmlXPathContextPtr ctxt,
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
int n = 0;
|
||||
size_t i = 0;
|
||||
g_autofree virCCWDeviceAddress *ccw_addr = NULL;
|
||||
|
||||
ctxt->node = node;
|
||||
|
||||
ccw_addr = g_new0(virCCWDeviceAddress, 1);
|
||||
|
||||
if (virNodeDevCCWDeviceAddressParseXML(ctxt, node, def->name, ccw_addr) < 0)
|
||||
if (virNodeDevCapCCWParseXML(ctxt, def, node, ccw_dev) < 0)
|
||||
return -1;
|
||||
|
||||
ccw_dev->cssid = ccw_addr->cssid;
|
||||
ccw_dev->ssid = ccw_addr->ssid;
|
||||
ccw_dev->devno = ccw_addr->devno;
|
||||
|
||||
if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) < 0)
|
||||
return -1;
|
||||
|
||||
@ -2284,9 +2302,11 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
|
||||
ret = virNodeDevCapMdevParseXML(ctxt, def, node, &caps->data.mdev);
|
||||
break;
|
||||
case VIR_NODE_DEV_CAP_CCW_DEV:
|
||||
case VIR_NODE_DEV_CAP_CSS_DEV:
|
||||
ret = virNodeDevCapCCWParseXML(ctxt, def, node, &caps->data.ccw_dev);
|
||||
break;
|
||||
case VIR_NODE_DEV_CAP_CSS_DEV:
|
||||
ret = virNodeDevCapCSSParseXML(ctxt, def, node, &caps->data.ccw_dev);
|
||||
break;
|
||||
case VIR_NODE_DEV_CAP_AP_CARD:
|
||||
ret = virNodeDevCapAPCardParseXML(ctxt, def, node,
|
||||
&caps->data.ap_card);
|
||||
|
Loading…
Reference in New Issue
Block a user