separate virDomainDefParseVideoInfo from virDomainDefParseXML,
move virDomainDefParseVideoInfo into virDomainDefParseDeviceInfo
---
src/conf/domain_conf.c | 87 ++++++++++++++++++++++++++++++--------------------
1 file changed, 53 insertions(+), 34 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6ffde63..e2a4ce2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -20360,6 +20360,58 @@ virDomainDefParseSoundInfo(virDomainParseTotalParamPtr param)
static int
+virDomainDefParseVideoInfo(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 video devices */
+ if ((n = virXPathNodeSet("./devices/video", ctxt, &nodes)) < 0)
+ goto cleanup;
+ if (n && VIR_ALLOC_N(def->videos, n) < 0)
+ goto cleanup;
+ for (i = 0; i < n; i++) {
+ virDomainVideoDefPtr video;
+ ssize_t insertAt = -1;
+
+ if (!(video = virDomainVideoDefParseXML(xmlopt, nodes[i],
+ ctxt, def, flags)))
+ goto cleanup;
+
+ if (video->primary) {
+ if (def->nvideos != 0 && def->videos[0]->primary) {
+ virDomainVideoDefFree(video);
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Only one primary video device is
supported"));
+ goto cleanup;
+ }
+
+ insertAt = 0;
+ }
+ if (VIR_INSERT_ELEMENT_INPLACE(def->videos,
+ insertAt,
+ def->nvideos,
+ video) < 0) {
+ virDomainVideoDefFree(video);
+ goto cleanup;
+ }
+ }
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(nodes);
+ return ret;
+}
+
+
+static int
virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param)
{
typedef int (*virDomainPreaseDeviceFuc)(virDomainParseTotalParamPtr param);
@@ -20380,6 +20432,7 @@ virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param)
virDomainDefParseInputInfo,
virDomainDefParseGraphicsInfo,
virDomainDefParseSoundInfo,
+ virDomainDefParseVideoInfo,
NULL
};
@@ -20483,40 +20536,6 @@ virDomainDefParseXML(xmlDocPtr xml,
fun_index++;
}
- /* analysis of the video devices */
- if ((n = virXPathNodeSet("./devices/video", ctxt, &nodes)) < 0)
- goto error;
- if (n && VIR_ALLOC_N(def->videos, n) < 0)
- goto error;
- for (i = 0; i < n; i++) {
- virDomainVideoDefPtr video;
- ssize_t insertAt = -1;
-
- if (!(video = virDomainVideoDefParseXML(xmlopt, nodes[i],
- ctxt, def, flags)))
- goto error;
-
- if (video->primary) {
- if (def->nvideos != 0 && def->videos[0]->primary) {
- virDomainVideoDefFree(video);
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("Only one primary video device is
supported"));
- goto error;
- }
-
- insertAt = 0;
- }
- if (VIR_INSERT_ELEMENT_INPLACE(def->videos,
- insertAt,
- def->nvideos,
- video) < 0) {
- virDomainVideoDefFree(video);
- goto error;
- }
- }
-
- VIR_FREE(nodes);
-
/* analysis of the host devices */
if ((n = virXPathNodeSet("./devices/hostdev", ctxt, &nodes)) < 0)
goto error;
--
2.8.3