On Thu, May 21, 2015 at 13:53:16 +0200, Boris Fiuczynski wrote:
On 05/21/2015 11:42 AM, Jiri Denemark wrote:
> Sometimes the only thing we need is the pointer to virDomainDiskDef and
> having to call virDomainDiskIndexBy* APIs, storing the disk index, and
> looking it up in the disks array is ugly. After this patch, we can just
> call virDomainDiskBy* and get the pointer in one step.
>
> Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
> ---
> src/conf/domain_conf.c | 20 ++++++++++++++++++++
> src/conf/domain_conf.h | 8 ++++++++
> src/libvirt_private.syms | 2 ++
> 3 files changed, 30 insertions(+)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 394890e..892d7d7 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -12349,6 +12349,17 @@ virDomainDiskIndexByAddress(virDomainDefPtr def,
> return -1;
> }
>
> +virDomainDiskDefPtr
> +virDomainDiskByAddress(virDomainDefPtr def,
> + virDevicePCIAddressPtr pci_address,
> + unsigned int bus,
> + unsigned int target,
> + unsigned int unit)
Shouldn't this new function be called virDomainDiskByPCIAddess(..)?
No. For two reasons, it matches the name of virDomainDiskIndexByAddress
and both functions also work with drive addresses (controller, bus,
target, unit).
Jirka