[libvirt] [PATCH v3 1/8] conf: use struct instead of int for each slot in virDomainPCIAddressBus

Andrea Bolognani abologna at redhat.com
Tue Dec 20 13:33:35 UTC 2016


On Mon, 2016-12-19 at 10:23 -0500, Laine Stump wrote:
> When keeping track of which functions of which slots are allocated, we
> will need to have more information than just the current bitmap with a
> bit for each function that is currently stored for each slot in a
> virDomainPCIAddressBus. To prepare for adding more per-slot info, this
> patch changes "int slots" into "virDomainPCIAddressSlot slot", which

The original struct member was uint8_t rather than int.

I also don't agree with the name change: "slots" is already a
perfectly good name for an array of "virDomainPCIAddressSlot"s.

[...]
> @@ -653,7 +653,8 @@ int
>  virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetPtr addrs,
>                                 virPCIDeviceAddressPtr addr)
>  {
> -    addrs->buses[addr->bus].slots[addr->slot] &= ~(1 << addr->function);
> +    addrs->buses[addr->bus].slot[addr->slot].functions
> +       &= ~(1 << addr->function);

Keep this on a single line.

[...]
> @@ -71,6 +71,13 @@ virDomainPCIConnectFlags
>  virDomainPCIControllerModelToConnectType(virDomainControllerModelPCI model);
>  
>  typedef struct {
> +    /* each function is represented by one it, set if that function is

s/by one it/by one bit/

> +     * in use by a device, or clear if it isn't.
> +     */
> +    uint8_t functions;
> +    } virDomainPCIAddressSlot;

Weird indentation here.


ACK with the nits fixed.

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list