separate virDomainDefParseRedirdevInfo from virDomainDefParseXML, move virDomainDefParseRedirdevInfo into virDomainDefParseDeviceInfo --- src/conf/domain_conf.c | 51 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 37fa996..b90c83a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -20688,6 +20688,41 @@ virDomainDefParseHubInfo(virDomainParseTotalParamPtr param) static int +virDomainDefParseRedirdevInfo(virDomainParseTotalParamPtr param) +{ + virDomainDefPtr def = param->def; + xmlXPathContextPtr ctxt = param->ctxt; + virDomainXMLOptionPtr xmlopt = param->xmlopt; + virHashTablePtr bootHash = param->bootHash; + unsigned int flags = param->flags; + + int ret = -1; + int n = 0; + size_t i; + xmlNodePtr *nodes = NULL; + + /* analysis of the redirected devices */ + if ((n = virXPathNodeSet("./devices/redirdev", ctxt, &nodes)) < 0) + goto cleanup; + if (n && VIR_ALLOC_N(def->redirdevs, n) < 0) + goto cleanup; + for (i = 0; i < n; i++) { + virDomainRedirdevDefPtr redirdev = + virDomainRedirdevDefParseXML(xmlopt, nodes[i], ctxt, bootHash, flags); + if (!redirdev) + goto cleanup; + + def->redirdevs[def->nredirdevs++] = redirdev; + } + ret = 0; + + cleanup: + VIR_FREE(nodes); + return ret; +} + + +static int virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param) { typedef int (*virDomainPreaseDeviceFuc)(virDomainParseTotalParamPtr param); @@ -20716,6 +20751,7 @@ virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param) virDomainDefParseTpmInfo, virDomainDefParseNvramInfo, virDomainDefParseHubInfo, + virDomainDefParseRedirdevInfo, NULL }; @@ -20818,21 +20854,6 @@ virDomainDefParseXML(xmlDocPtr xml, fun_index++; } - /* analysis of the redirected devices */ - if ((n = virXPathNodeSet("./devices/redirdev", ctxt, &nodes)) < 0) - goto error; - if (n && VIR_ALLOC_N(def->redirdevs, n) < 0) - goto error; - for (i = 0; i < n; i++) { - virDomainRedirdevDefPtr redirdev = - virDomainRedirdevDefParseXML(xmlopt, nodes[i], ctxt, bootHash, flags); - if (!redirdev) - goto error; - - def->redirdevs[def->nredirdevs++] = redirdev; - } - VIR_FREE(nodes); - /* analysis of the redirection filter rules */ if ((n = virXPathNodeSet("./devices/redirfilter", ctxt, &nodes)) < 0) goto error; -- 2.8.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list