]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commit
storage: don't require caller to pre-allocate metadata struct
authorEric Blake <eblake@redhat.com>
Sat, 13 Oct 2012 17:01:27 +0000 (11:01 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 19 Oct 2012 23:35:10 +0000 (17:35 -0600)
commit1fc9593271c5981dc42d2d41e11ee38ee7c67ec5
treebc5d6f342a2283c41db8486d52d5668ce8946496
parent35c74c173320c8b54bc193df3e3ad0f9a8b4286b
storage: don't require caller to pre-allocate metadata struct

Requiring pre-allocation was an unusual idiom.  It allowed iteration
over the backing chain to use fewer mallocs, but made one-shot
clients harder to read.  Also, this makes it easier for a future
patch to move away from opening fds on every iteration over the chain.

* src/util/storage_file.h (virStorageFileGetMetadataFromFD): Alter
signature.
* src/util/storage_file.c (virStorageFileGetMetadataFromFD): Allocate
return value.
 (virStorageFileGetMetadata): Update clients.
* src/conf/domain_conf.c (virDomainDiskDefForeachPath): Likewise.
* src/qemu/qemu_driver.c (qemuDomainGetBlockInfo): Likewise.
* src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
Likewise.
src/conf/domain_conf.c
src/qemu/qemu_driver.c
src/storage/storage_backend_fs.c
src/util/storage_file.c
src/util/storage_file.h