[libvirt] [PATCH 1/7] qemu: QEMU_PCI constant consistency

Laine Stump laine at laine.org
Thu Apr 4 17:25:18 UTC 2013


On 04/03/2013 11:50 AM, Ján Tomko wrote:
> Change QEMU_PCI_ADDRESS_LAST_SLOT to the number of slots in the bus,
> not the maximum slot value, to match QEMU_PCI_ADDRESS_LAST_FUNCTION.
> ---

If you want to be *really* consistent, you should rename these to
VIR_QEMU_PCI_ADDRESS_SLOT_LAST and VIR_QEMU_PCI_ADDRESS_FUNCTION_LAST :-)

(i.e. start with "VIR_" and put "LAST" at the end)

>  src/qemu/qemu_command.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 693d30d..8321dcd 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -1185,7 +1185,7 @@ cleanup:
>      return ret;
>  }
>  
> -#define QEMU_PCI_ADDRESS_LAST_SLOT 31
> +#define QEMU_PCI_ADDRESS_LAST_SLOT 32
>  #define QEMU_PCI_ADDRESS_LAST_FUNCTION 8
>  struct _qemuDomainPCIAddressSet {
>      virHashTablePtr used;
> @@ -1536,8 +1536,8 @@ qemuDomainPCIAddressGetNextSlot(qemuDomainPCIAddressSetPtr addrs,
>      char *addr;
>  
>      tmp_addr.slot++;
> -    for (i = 0; i <= QEMU_PCI_ADDRESS_LAST_SLOT; i++, tmp_addr.slot++) {
> -        if (QEMU_PCI_ADDRESS_LAST_SLOT < tmp_addr.slot) {
> +    for (i = 0; i < QEMU_PCI_ADDRESS_LAST_SLOT; i++, tmp_addr.slot++) {
> +        if (QEMU_PCI_ADDRESS_LAST_SLOT <= tmp_addr.slot) {
>              tmp_addr.slot = 0;
>          }
>  




More information about the libvir-list mailing list