separate virDomainDefParseChannelInfo from virDomainDefParseXML,
move virDomainDefParseChannelInfo into virDomainDefParseDeviceInfo
---
src/conf/domain_conf.c | 59 +++++++++++++++++++++++++++++++++-----------------
1 file changed, 39 insertions(+), 20 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b74e332..7c8fd45 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -20205,6 +20205,44 @@ virDomainDefParseConsoleInfo(virDomainParseTotalParamPtr param)
static int
+virDomainDefParseChannelInfo(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;
+
+ if ((n = virXPathNodeSet("./devices/channel", ctxt, &nodes)) < 0)
+ goto cleanup;
+ if (n && VIR_ALLOC_N(def->channels, n) < 0)
+ goto cleanup;
+
+ for (i = 0; i < n; i++) {
+ virDomainChrDefPtr chr = virDomainChrDefParseXML(xmlopt,
+ ctxt,
+ nodes[i],
+ def->seclabels,
+ def->nseclabels,
+ flags);
+ if (!chr)
+ goto cleanup;
+
+ def->channels[def->nchannels++] = chr;
+ }
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(nodes);
+ return ret;
+}
+
+
+static int
virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param)
{
typedef int (*virDomainPreaseDeviceFuc)(virDomainParseTotalParamPtr param);
@@ -20221,6 +20259,7 @@ virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param)
virDomainDefParseParallelInfo,
virDomainDefParseSerialInfo,
virDomainDefParseConsoleInfo,
+ virDomainDefParseChannelInfo,
NULL
};
@@ -20324,26 +20363,6 @@ virDomainDefParseXML(xmlDocPtr xml,
fun_index++;
}
- if ((n = virXPathNodeSet("./devices/channel", ctxt, &nodes)) < 0)
- goto error;
- if (n && VIR_ALLOC_N(def->channels, n) < 0)
- goto error;
-
- for (i = 0; i < n; i++) {
- virDomainChrDefPtr chr = virDomainChrDefParseXML(xmlopt,
- ctxt,
- nodes[i],
- def->seclabels,
- def->nseclabels,
- flags);
- if (!chr)
- goto error;
-
- def->channels[def->nchannels++] = chr;
- }
- VIR_FREE(nodes);
-
-
/* analysis of the input devices */
if ((n = virXPathNodeSet("./devices/input", ctxt, &nodes)) < 0)
goto error;
--
2.8.3