separate virDomainDefParseInputInfo from virDomainDefParseXML,
move virDomainDefParseInputInfo into virDomainDefParseDeviceInfo
---
src/conf/domain_conf.c | 76 +++++++++++++++++++++++++++++++-------------------
1 file changed, 48 insertions(+), 28 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 7c8fd45..eb610ed 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -20243,6 +20243,53 @@ virDomainDefParseChannelInfo(virDomainParseTotalParamPtr param)
static int
+virDomainDefParseInputInfo(virDomainParseTotalParamPtr param)
+{
+ virDomainDefPtr def = param->def;
+ xmlXPathContextPtr ctxt = param->ctxt;
+ virDomainXMLOptionPtr xmlopt = param->xmlopt;
+ unsigned int flags = param->flags;
+
+ int ret = -1;
+ int n = 0;
+ size_t i;
+ xmlNodePtr *nodes = NULL;
+
+ /* analysis of the input devices */
+ if ((n = virXPathNodeSet("./devices/input", ctxt, &nodes)) < 0)
+ goto cleanup;
+ if (n && VIR_ALLOC_N(def->inputs, n) < 0)
+ goto cleanup;
+
+ for (i = 0; i < n; i++) {
+ virDomainInputDefPtr input = virDomainInputDefParseXML(xmlopt,
+ def,
+ nodes[i],
+ ctxt,
+ flags);
+ if (!input)
+ goto cleanup;
+
+ /* Check if USB bus is required */
+ if (input->bus == VIR_DOMAIN_INPUT_BUS_USB && param->usb_none) {
+ virDomainInputDefFree(input);
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Can't add USB input device. "
+ "USB bus is disabled"));
+ goto cleanup;
+ }
+
+ def->inputs[def->ninputs++] = input;
+ }
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(nodes);
+ return ret;
+}
+
+
+static int
virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param)
{
typedef int (*virDomainPreaseDeviceFuc)(virDomainParseTotalParamPtr param);
@@ -20260,6 +20307,7 @@ virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param)
virDomainDefParseSerialInfo,
virDomainDefParseConsoleInfo,
virDomainDefParseChannelInfo,
+ virDomainDefParseInputInfo,
NULL
};
@@ -20363,34 +20411,6 @@ virDomainDefParseXML(xmlDocPtr xml,
fun_index++;
}
- /* analysis of the input devices */
- if ((n = virXPathNodeSet("./devices/input", ctxt, &nodes)) < 0)
- goto error;
- if (n && VIR_ALLOC_N(def->inputs, n) < 0)
- goto error;
-
- for (i = 0; i < n; i++) {
- virDomainInputDefPtr input = virDomainInputDefParseXML(xmlopt,
- def,
- nodes[i],
- ctxt,
- flags);
- if (!input)
- goto error;
-
- /* Check if USB bus is required */
- if (input->bus == VIR_DOMAIN_INPUT_BUS_USB && usb_none) {
- virDomainInputDefFree(input);
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("Can't add USB input device. "
- "USB bus is disabled"));
- goto error;
- }
-
- def->inputs[def->ninputs++] = input;
- }
- VIR_FREE(nodes);
-
/* analysis of the graphics devices */
if ((n = virXPathNodeSet("./devices/graphics", ctxt, &nodes)) < 0)
goto error;
--
2.8.3