
On 06/06/14 00:52, Eric Blake wrote:
As part of the work on backing chains, I'm finding that it would be easier to directly manipulate chains of pointers (adding a snapshot merely adjusts pointers to form the correct list) rather than copy data from one struct to another. This patch converts domain disk source to be a pointer.
In this patch, the pointer is ALWAYS allocated (thanks in part to the previous patch forwarding all disk def allocation through a common point), and all other changse are just mechanical fallout of the new type; there should be no functional change. It is possible that we may want to leave the pointer NULL for a cdrom with no medium in a later patch, but as that requires a closer audit of the source to ensure we don't fault on a null dereference, I didn't do it here.
* src/conf/domain_conf.h (_virDomainDiskDef): Change type of src. * src/conf/domain_conf.c: Adjust all clients. * src/security/security_selinux.c: Likewise. * src/qemu/qemu_domain.c: Likewise. * src/qemu/qemu_command.c: Likewise. * src/qemu/qemu_conf.c: Likewise. * src/qemu/qemu_process.c: Likewise. * src/qemu/qemu_migration.c: Likewise. * src/qemu/qemu_driver.c: Likewise. * src/lxc/lxc_driver.c: Likewise. * src/lxc/lxc_controller.c: Likewise. * tests/securityselinuxlabeltest.c: Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com> --- src/conf/domain_conf.c | 141 +++++++++---------- src/conf/domain_conf.h | 2 +- src/lxc/lxc_controller.c | 8 +- src/lxc/lxc_driver.c | 8 +- src/qemu/qemu_command.c | 286 ++++++++++++++++++++------------------- src/qemu/qemu_conf.c | 86 ++++++------ src/qemu/qemu_domain.c | 14 +- src/qemu/qemu_driver.c | 232 +++++++++++++++---------------- src/qemu/qemu_migration.c | 4 +- src/qemu/qemu_process.c | 8 +- src/security/security_selinux.c | 4 +- tests/securityselinuxlabeltest.c | 6 +- 12 files changed, 403 insertions(+), 396 deletions(-)
Missing change in src/security/virt-aa-helper.c which breaks the build: diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index bf540b4..1d246c7 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -951,9 +951,9 @@ get_files(vahControl * ctl) /* XXX - if we knew the qemu user:group here we could send it in * so that the open could be re-tried as that user:group. */ - if (!disk->src.backingStore) { + if (!disk->src->backingStore) { bool probe = ctl->allowDiskFormatProbing; - virStorageFileGetMetadata(&disk->src, -1, -1, probe); + virStorageFileGetMetadata(disk->src, -1, -1, probe); } /* XXX passing ignoreOpenFailure = true to get back to the behavior
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index ffe3583..3585537 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -598,7 +598,7 @@ typedef virDomainBlockIoTuneInfo *virDomainBlockIoTuneInfoPtr;
/* Stores the virtual disk configuration */ struct _virDomainDiskDef { - virStorageSource src; + virStorageSourcePtr src;
Maybe we should mention here that src is currently guaranteed to be non-NULL.
int device; /* enum virDomainDiskDevice */ int bus; /* enum virDomainDiskBus */
ACK with the nits addressed. Peter