
On 2014/8/22 18:47, Maxime Leroy wrote:
This patch adds configuration support for the shmem device as described in the schema in the previous patch.
Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com> ---
+static virDomainShmemDefPtr +virDomainShmemDefParseXML(xmlNodePtr node, + xmlXPathContextPtr ctxt, + unsigned int flags) +{ + char *model = virXMLPropString(node, "model"); + virDomainShmemDefPtr def; + + if (VIR_ALLOC(def) < 0) + return NULL; + + if (model) { + if ((def->model == virDomainShmemModelTypeFromString(model)) < 0) {
I guess you intend 'def->modle = ...' not 'def->model == ...' .
+ virReportError(VIR_ERR_XML_ERROR, + _("Unknown <shmem> model '%s'"), model); + goto error; + } + } else + def->model = VIR_DOMAIN_SHMEM_MODEL_IVSHMEM; + + if (!(def->name = virXMLPropString(node, "name"))) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("<shmem> must contain 'name' attribute")); + goto error; + }
As Martin mentioned, 'name' is not necessary.
+static int virDomainShmemDefFormat(virBufferPtr buf, + virDomainShmemDefPtr def, + unsigned int flags) +{ + virBufferAsprintf(buf, "<shmem name='%s' model='%s'>\n", + def->name, virDomainShmemModelTypeToString(def->model));
Here too, 'name' is not necessary