[libvirt] [PATCH 2/8] conf: add privateData to virDomainGraphicsDef

Ján Tomko jtomko at redhat.com
Wed Jan 16 07:41:44 UTC 2019


Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/conf/domain_conf.c | 8 +++++++-
 src/conf/domain_conf.h | 3 +++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 82672c6493..21112c6336 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14115,13 +14115,19 @@ virDomainGraphicsDefParseXMLEGLHeadless(virDomainGraphicsDefPtr def,
 }
 
 virDomainGraphicsDefPtr
-virDomainGraphicsDefNew(virDomainXMLOptionPtr xmlopt ATTRIBUTE_UNUSED)
+virDomainGraphicsDefNew(virDomainXMLOptionPtr xmlopt)
 {
     virDomainGraphicsDefPtr def = NULL;
 
     if (VIR_ALLOC(def) < 0)
         return NULL;
 
+    if (xmlopt && xmlopt->privateData.graphicsNew &&
+        !(def->privateData = xmlopt->privateData.graphicsNew())) {
+        VIR_FREE(def);
+        def = NULL;
+    }
+
     return def;
 }
 
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 2a97ad8ab3..7776a3afb2 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1603,6 +1603,8 @@ struct _virDomainGraphicsListenDef {
 };
 
 struct _virDomainGraphicsDef {
+    virObjectPtr privateData;
+
     /* Port value discipline:
      * Value -1 is legacy syntax indicating that it should be auto-allocated.
      * Value 0 means port wasn't specified in XML at all.
@@ -2783,6 +2785,7 @@ struct _virDomainXMLPrivateDataCallbacks {
     virDomainXMLPrivateDataNewFunc    vcpuNew;
     virDomainXMLPrivateDataNewFunc    chrSourceNew;
     virDomainXMLPrivateDataNewFunc    vsockNew;
+    virDomainXMLPrivateDataNewFunc    graphicsNew;
     virDomainXMLPrivateDataFormatFunc format;
     virDomainXMLPrivateDataParseFunc  parse;
     /* following function shall return a pointer which will be used as the
-- 
2.20.1




More information about the libvir-list mailing list