[libvirt] [PATCH 3/7] the key of hash table should include the function value

Daniel P. Berrange berrange at redhat.com
Fri Jun 3 13:25:58 UTC 2011


On Fri, May 27, 2011 at 06:20:41PM +0800, Wen Congyang wrote:
> We save all used PCI address in the hash table. The key is generated by domain,
> bus and slot now. We will support multi function PCI device, so the key should
> be generated by domain, bus, slot and function.
> ---
>  src/qemu/qemu_command.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index ef2d002..4ca6fe3 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -684,10 +684,11 @@ static char *qemuPCIAddressAsString(virDomainDeviceInfoPtr dev)
>          return NULL;
>      }
>  
> -    if (virAsprintf(&addr, "%d:%d:%d",
> +    if (virAsprintf(&addr, "%d:%d:%d.%d",
>                      dev->addr.pci.domain,
>                      dev->addr.pci.bus,
> -                    dev->addr.pci.slot) < 0) {
> +                    dev->addr.pci.slot,
> +                    dev->addr.pci.function) < 0) {
>          virReportOOMError();
>          return NULL;
>      }
> @@ -817,6 +818,7 @@ int qemuDomainPCIAddressReserveSlot(qemuDomainPCIAddressSetPtr addrs,
>      dev.addr.pci.domain = 0;
>      dev.addr.pci.bus = 0;
>      dev.addr.pci.slot = slot;
> +    dev.addr.pci.function = 0;
>  
>      return qemuDomainPCIAddressReserveAddr(addrs, &dev);
>  }
> @@ -879,6 +881,7 @@ int qemuDomainPCIAddressSetNextAddr(qemuDomainPCIAddressSetPtr addrs,
>          maybe.addr.pci.domain = 0;
>          maybe.addr.pci.bus = 0;
>          maybe.addr.pci.slot = i;
> +        maybe.addr.pci.function = 0;
>  
>          if (!(addr = qemuPCIAddressAsString(&maybe)))
>              return -1;

ACK,

If we want to be really pedantic, this would be merged with patch 4, so
we don't have a functionality regression at this point in the bisect,
but it isn't really too important.


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list