An object for storing driver-specific data in the vsock definition. https://bugzilla.redhat.com/show_bug.cgi?id=1291851 Signed-off-by: Ján Tomko <jto...@redhat.com> --- src/conf/domain_conf.c | 16 ++++++++++++++-- src/conf/domain_conf.h | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5b4b182fd2..b2982fc3d4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2029,7 +2029,7 @@ virDomainActualNetDefFree(virDomainActualNetDefPtr def) virDomainVsockDefPtr -virDomainVsockDefNew(virDomainXMLOptionPtr xmlopt ATTRIBUTE_UNUSED) +virDomainVsockDefNew(virDomainXMLOptionPtr xmlopt) { virDomainVsockDefPtr ret = NULL; virDomainVsockDefPtr vsock; @@ -2037,14 +2037,26 @@ virDomainVsockDefNew(virDomainXMLOptionPtr xmlopt ATTRIBUTE_UNUSED) if (VIR_ALLOC(vsock) < 0) return NULL; + if (xmlopt && + xmlopt->privateData.vsockNew && + !(vsock->privateData = xmlopt->privateData.vsockNew())) + goto cleanup; + VIR_STEAL_PTR(ret, vsock); + cleanup: + virDomainVsockDefFree(vsock); return ret; } void -virDomainVsockDefFree(virDomainVsockDefPtr vsock ATTRIBUTE_UNUSED) +virDomainVsockDefFree(virDomainVsockDefPtr vsock) { + if (!vsock) + return; + + virObjectUnref(vsock->privateData); + vsock->privateData = NULL; } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 0eae14e732..4fa67ae7b7 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2314,6 +2314,7 @@ struct _virDomainIOMMUDef { }; struct _virDomainVsockDef { + virObjectPtr privateData; }; struct _virDomainVirtioOptions { @@ -2678,6 +2679,7 @@ struct _virDomainXMLPrivateDataCallbacks { virDomainXMLPrivateDataNewFunc diskNew; virDomainXMLPrivateDataNewFunc vcpuNew; virDomainXMLPrivateDataNewFunc chrSourceNew; + virDomainXMLPrivateDataNewFunc vsockNew; virDomainXMLPrivateDataFormatFunc format; virDomainXMLPrivateDataParseFunc parse; virDomainXMLPrivateDataStorageSourceParseFunc storageParse; -- 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list