1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-11 09:17:52 +03:00

qemu: domain: Introduce helper for always fetching virStorageSource private data

Add a helper which will always return the storage source private data
even if it was not allocated before.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Peter Krempa 2020-05-22 12:29:10 +02:00
parent 852ee1950a
commit 47be725719
2 changed files with 12 additions and 0 deletions

View File

@ -570,6 +570,16 @@ qemuDomainStorageSourcePrivateDispose(void *obj)
}
qemuDomainStorageSourcePrivatePtr
qemuDomainStorageSourcePrivateFetch(virStorageSourcePtr src)
{
if (!src->privateData)
src->privateData = qemuDomainStorageSourcePrivateNew();
return QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
}
static virClassPtr qemuDomainVcpuPrivateClass;
static void qemuDomainVcpuPrivateDispose(void *obj);

View File

@ -320,6 +320,8 @@ struct _qemuDomainStorageSourcePrivate {
};
virObjectPtr qemuDomainStorageSourcePrivateNew(void);
qemuDomainStorageSourcePrivatePtr
qemuDomainStorageSourcePrivateFetch(virStorageSourcePtr src);
typedef struct _qemuDomainVcpuPrivate qemuDomainVcpuPrivate;
typedef qemuDomainVcpuPrivate *qemuDomainVcpuPrivatePtr;