separate virDomainDefParseRedirFilterInfo from virDomainDefParseXML, move virDomainDefParseRedirFilterInfo into virDomainDefParseDeviceInfo --- src/conf/domain_conf.c | 55 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b90c83a..d19d4de 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -20723,6 +20723,41 @@ virDomainDefParseRedirdevInfo(virDomainParseTotalParamPtr param) static int +virDomainDefParseRedirFilterInfo(virDomainParseTotalParamPtr param) +{ + virDomainDefPtr def = param->def; + xmlXPathContextPtr ctxt = param->ctxt; + + int ret = -1; + int n = 0; + xmlNodePtr *nodes = NULL; + + /* analysis of the redirection filter rules */ + if ((n = virXPathNodeSet("./devices/redirfilter", ctxt, &nodes)) < 0) + goto cleanup; + if (n > 1) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("only one set of redirection filter rule is supported")); + goto cleanup; + } + + if (n) { + virDomainRedirFilterDefPtr redirfilter = + virDomainRedirFilterDefParseXML(nodes[0], ctxt); + if (!redirfilter) + goto cleanup; + + def->redirfilter = redirfilter; + } + ret = 0; + + cleanup: + VIR_FREE(nodes); + return ret; +} + + +static int virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param) { typedef int (*virDomainPreaseDeviceFuc)(virDomainParseTotalParamPtr param); @@ -20752,6 +20787,7 @@ virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param) virDomainDefParseNvramInfo, virDomainDefParseHubInfo, virDomainDefParseRedirdevInfo, + virDomainDefParseRedirFilterInfo, NULL }; @@ -20854,25 +20890,6 @@ virDomainDefParseXML(xmlDocPtr xml, fun_index++; } - /* analysis of the redirection filter rules */ - if ((n = virXPathNodeSet("./devices/redirfilter", ctxt, &nodes)) < 0) - goto error; - if (n > 1) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("only one set of redirection filter rule is supported")); - goto error; - } - - if (n) { - virDomainRedirFilterDefPtr redirfilter = - virDomainRedirFilterDefParseXML(nodes[0], ctxt); - if (!redirfilter) - goto error; - - def->redirfilter = redirfilter; - } - VIR_FREE(nodes); - /* analysis of the panic devices */ if ((n = virXPathNodeSet("./devices/panic", ctxt, &nodes)) < 0) goto error; -- 2.8.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list