Re: [PATCH v2 1/2] Implement virPCIDeviceGetAddress function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 14.01.2015 12:02, Shivaprasad G Bhat wrote:
> Basically a getter function which is implemented for accessing the
> address fields in virPCIDevice.
> 
> Signed-off-by: Shivaprasad G Bhat <sbhat@xxxxxxxxxxxxxxxxxx>
> ---
>  src/util/virpci.c |   16 ++++++++++++++++
>  src/util/virpci.h |    1 +
>  2 files changed, 17 insertions(+)
> 
> diff --git a/src/util/virpci.c b/src/util/virpci.c
> index cd78212..831a5d8 100644
> --- a/src/util/virpci.c
> +++ b/src/util/virpci.c
> @@ -1655,6 +1655,22 @@ virPCIDeviceFree(virPCIDevicePtr dev)
>      VIR_FREE(dev);
>  }
>  

I'm adding a comment here to note explicitly that caller must free the
returned value.

> +virPCIDeviceAddressPtr virPCIDeviceGetAddress(virPCIDevicePtr dev)
> +{
> +
> +    virPCIDeviceAddressPtr pciAddrPtr;
> +
> +    if (!dev || (VIR_ALLOC(pciAddrPtr) < 0))
> +        return NULL;
> +
> +    pciAddrPtr->domain = dev->domain;
> +    pciAddrPtr->bus = dev->bus;
> +    pciAddrPtr->slot = dev->slot;
> +    pciAddrPtr->function = dev->function;
> +
> +    return pciAddrPtr;
> +}
> +
>  const char *
>  virPCIDeviceGetName(virPCIDevicePtr dev)
>  {
> diff --git a/src/util/virpci.h b/src/util/virpci.h
> index 1ce9821..64b9e96 100644
> --- a/src/util/virpci.h
> +++ b/src/util/virpci.h
> @@ -94,6 +94,7 @@ int virPCIDeviceSetStubDriver(virPCIDevicePtr dev,
>                                const char *driver)
>      ATTRIBUTE_NONNULL(2);
>  const char *virPCIDeviceGetStubDriver(virPCIDevicePtr dev);
> +virPCIDeviceAddressPtr virPCIDeviceGetAddress(virPCIDevicePtr dev);
>  int virPCIDeviceSetUsedBy(virPCIDevice *dev,
>                            const char *drv_name,
>                            const char *dom_name);
> 

ACK

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]