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

Re: [libvirt] [PATCH 5/7] Add function virDevicePCIAddressEqual



On 08/16/2012 11:42 AM, Shradha Shah wrote:
> This function is needed by the network driver in a later commit.
> This function is useful in functions like networkNotifyActualDevice
> and networkReleaseActualDevice
> ---
>  src/conf/device_conf.c   |   16 ++++++++++++++++
>  src/conf/device_conf.h   |    3 +++
>  src/libvirt_private.syms |    1 +
>  3 files changed, 20 insertions(+), 0 deletions(-)
>
> diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
> index ca600c5..8edcc0a 100644
> --- a/src/conf/device_conf.c
> +++ b/src/conf/device_conf.c
> @@ -129,3 +129,19 @@ virDevicePCIAddressFormat(virBufferPtr buf,
>                        addr.function);
>      return 0;
>  }
> +
> +int
> +virDevicePCIAddressEqual(virDevicePCIAddress addr1,
> +                         virDevicePCIAddress addr2)
> +{
> +    int ret = -1;


The other xxxEqual() functions in libvirt return a bool true/false
rather than 0 / -1. ACK with that fix (don't bother re-sending - I'll
just fix it up (along with the places you call it in later patches)
before I push.

> +
> +    if (addr1.domain == addr2.domain &&
> +        addr1.bus == addr2.bus &&
> +        addr1.slot == addr2.slot &&
> +        addr1.function == addr2.function) {
> +        ret = 0;
> +    }
> +
> +    return ret;
> +}
> diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
> index c679bce..7c4d356 100644
> --- a/src/conf/device_conf.h
> +++ b/src/conf/device_conf.h
> @@ -59,6 +59,9 @@ int virDevicePCIAddressFormat(virBufferPtr buf,
>                                virDevicePCIAddress addr,
>                                bool includeTypeInAddr);
>  
> +int virDevicePCIAddressEqual(virDevicePCIAddress addr1,
> +                             virDevicePCIAddress addr2);
> +
>  
>  VIR_ENUM_DECL(virDeviceAddressPciMulti)
>  
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index 1f32f8e..063d0bc 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -224,6 +224,7 @@ virDeviceAddressPciMultiTypeToString;
>  virDevicePCIAddressIsValid;
>  virDevicePCIAddressParseXML;
>  virDevicePCIAddressFormat;
> +virDevicePCIAddressEqual;
>  
>  # dnsmasq.h
>  dnsmasqAddDhcpHost;


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