[libvirt] [PATCH v2 1/2] conf: new function virDomainPCIAddressSetAllMulti()

Andrea Bolognani abologna at redhat.com
Tue Jan 10 17:47:34 UTC 2017


On Tue, 2017-01-10 at 11:55 -0500, Laine Stump wrote:
> This utility function iterates through all devices looking for any
> with a PCI address that has function != 0 (which implies that multiple
> functions are in use on that slot), then uses an inner iterator to
> find the device that's on function 0 of that same slot and sets the
> "multi" in its virDomainDeviceInfo (as long as it hasn't already been
> set explicitly by someone who presumably has better information than
> we do).
> 
> It isn't yet called from anywhere, so will have no functional effect.

[...]
> +static int
> +virDomainPCIAddressSetMultiIter(virDomainDefPtr def ATTRIBUTE_UNUSED,
> +                                virDomainDeviceDefPtr dev ATTRIBUTE_UNUSED,
> +                                virDomainDeviceInfoPtr info,
> +                                void *data)

virDomainPCIAddressSetAllMultiIterInner()?
Or maybe virDomainPCIAddressSetAllMultiInnerIter()?

Just kidding ;)

[...]
> +static int
> +virDomainPCIAddressSetAllMultiIter(virDomainDefPtr def,
> +                                   virDomainDeviceDefPtr dev ATTRIBUTE_UNUSED,
> +                                   virDomainDeviceInfoPtr info,
> +                                   void *data ATTRIBUTE_UNUSED)
> +{
> +    virPCIDeviceAddressPtr testAddr;
> +
> +    if (!info || info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)
> +       return 0;
> +
> +    testAddr = &info->addr.pci;

Empty line here.

> +    if (testAddr->function != 0) {
> +        ignore_value(virDomainDeviceInfoIterate(def,
> +                                                virDomainPCIAddressSetMultiIter,
> +                                                testAddr));
> +    }
> +
> +    return 0;
> +}

ACK

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list