|
|
2cf05b |
From 286c821eee3b682d6aa4aeaa13aad92382708803 Mon Sep 17 00:00:00 2001
|
|
|
2cf05b |
Message-Id: <286c821eee3b682d6aa4aeaa13aad92382708803@dist-git>
|
|
|
2cf05b |
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
|
|
2cf05b |
Date: Fri, 13 May 2022 12:31:13 +0200
|
|
|
2cf05b |
Subject: [PATCH] nodedev: refactor css XML parsing from ccw XML parsing
|
|
|
2cf05b |
|
|
|
2cf05b |
In preparation for easier extension later.
|
|
|
2cf05b |
|
|
|
2cf05b |
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
|
|
2cf05b |
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
2cf05b |
(cherry picked from commit 245ff2d6634b3afb0dbf0d295051e458095bfc80)
|
|
|
2cf05b |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
|
|
|
2cf05b |
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
|
|
2cf05b |
---
|
|
|
2cf05b |
src/conf/node_device_conf.c | 40 +++++++++++++++++++++++++++----------
|
|
|
2cf05b |
1 file changed, 30 insertions(+), 10 deletions(-)
|
|
|
2cf05b |
|
|
|
2cf05b |
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
|
|
|
2cf05b |
index 8982368465..fcb5be24e1 100644
|
|
|
2cf05b |
--- a/src/conf/node_device_conf.c
|
|
|
2cf05b |
+++ b/src/conf/node_device_conf.c
|
|
|
2cf05b |
@@ -1193,6 +1193,31 @@ virNodeDevCCWDeviceAddressParseXML(xmlXPathContextPtr ctxt,
|
|
|
2cf05b |
return 0;
|
|
|
2cf05b |
}
|
|
|
2cf05b |
|
|
|
2cf05b |
+
|
|
|
2cf05b |
+static int
|
|
|
2cf05b |
+virNodeDevCapCCWParseXML(xmlXPathContextPtr ctxt,
|
|
|
2cf05b |
+ virNodeDeviceDef *def,
|
|
|
2cf05b |
+ xmlNodePtr node,
|
|
|
2cf05b |
+ virNodeDevCapCCW *ccw_dev)
|
|
|
2cf05b |
+{
|
|
|
2cf05b |
+ VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
|
|
2cf05b |
+ g_autofree virCCWDeviceAddress *ccw_addr = NULL;
|
|
|
2cf05b |
+
|
|
|
2cf05b |
+ ctxt->node = node;
|
|
|
2cf05b |
+
|
|
|
2cf05b |
+ ccw_addr = g_new0(virCCWDeviceAddress, 1);
|
|
|
2cf05b |
+
|
|
|
2cf05b |
+ if (virNodeDevCCWDeviceAddressParseXML(ctxt, node, def->name, ccw_addr) < 0)
|
|
|
2cf05b |
+ return -1;
|
|
|
2cf05b |
+
|
|
|
2cf05b |
+ ccw_dev->cssid = ccw_addr->cssid;
|
|
|
2cf05b |
+ ccw_dev->ssid = ccw_addr->ssid;
|
|
|
2cf05b |
+ ccw_dev->devno = ccw_addr->devno;
|
|
|
2cf05b |
+
|
|
|
2cf05b |
+ return 0;
|
|
|
2cf05b |
+}
|
|
|
2cf05b |
+
|
|
|
2cf05b |
+
|
|
|
2cf05b |
static int
|
|
|
2cf05b |
virNodeDevCSSCapabilityParseXML(xmlXPathContextPtr ctxt,
|
|
|
2cf05b |
xmlNodePtr node,
|
|
|
2cf05b |
@@ -1221,7 +1246,7 @@ virNodeDevCSSCapabilityParseXML(xmlXPathContextPtr ctxt,
|
|
|
2cf05b |
|
|
|
2cf05b |
|
|
|
2cf05b |
static int
|
|
|
2cf05b |
-virNodeDevCapCCWParseXML(xmlXPathContextPtr ctxt,
|
|
|
2cf05b |
+virNodeDevCapCSSParseXML(xmlXPathContextPtr ctxt,
|
|
|
2cf05b |
virNodeDeviceDef *def,
|
|
|
2cf05b |
xmlNodePtr node,
|
|
|
2cf05b |
virNodeDevCapCCW *ccw_dev)
|
|
|
2cf05b |
@@ -1230,19 +1255,12 @@ virNodeDevCapCCWParseXML(xmlXPathContextPtr ctxt,
|
|
|
2cf05b |
g_autofree xmlNodePtr *nodes = NULL;
|
|
|
2cf05b |
int n = 0;
|
|
|
2cf05b |
size_t i = 0;
|
|
|
2cf05b |
- g_autofree virCCWDeviceAddress *ccw_addr = NULL;
|
|
|
2cf05b |
|
|
|
2cf05b |
ctxt->node = node;
|
|
|
2cf05b |
|
|
|
2cf05b |
- ccw_addr = g_new0(virCCWDeviceAddress, 1);
|
|
|
2cf05b |
-
|
|
|
2cf05b |
- if (virNodeDevCCWDeviceAddressParseXML(ctxt, node, def->name, ccw_addr) < 0)
|
|
|
2cf05b |
+ if (virNodeDevCapCCWParseXML(ctxt, def, node, ccw_dev) < 0)
|
|
|
2cf05b |
return -1;
|
|
|
2cf05b |
|
|
|
2cf05b |
- ccw_dev->cssid = ccw_addr->cssid;
|
|
|
2cf05b |
- ccw_dev->ssid = ccw_addr->ssid;
|
|
|
2cf05b |
- ccw_dev->devno = ccw_addr->devno;
|
|
|
2cf05b |
-
|
|
|
2cf05b |
if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) < 0)
|
|
|
2cf05b |
return -1;
|
|
|
2cf05b |
|
|
|
2cf05b |
@@ -2282,9 +2300,11 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
|
|
|
2cf05b |
ret = virNodeDevCapMdevParseXML(ctxt, def, node, &caps->data.mdev);
|
|
|
2cf05b |
break;
|
|
|
2cf05b |
case VIR_NODE_DEV_CAP_CCW_DEV:
|
|
|
2cf05b |
- case VIR_NODE_DEV_CAP_CSS_DEV:
|
|
|
2cf05b |
ret = virNodeDevCapCCWParseXML(ctxt, def, node, &caps->data.ccw_dev);
|
|
|
2cf05b |
break;
|
|
|
2cf05b |
+ case VIR_NODE_DEV_CAP_CSS_DEV:
|
|
|
2cf05b |
+ ret = virNodeDevCapCSSParseXML(ctxt, def, node, &caps->data.ccw_dev);
|
|
|
2cf05b |
+ break;
|
|
|
2cf05b |
case VIR_NODE_DEV_CAP_AP_CARD:
|
|
|
2cf05b |
ret = virNodeDevCapAPCardParseXML(ctxt, def, node,
|
|
|
2cf05b |
&caps->data.ap_card);
|
|
|
2cf05b |
--
|
|
|
2cf05b |
2.39.1
|
|
|
2cf05b |
|