On 04/17/2013 01:00 PM, Ján Tomko wrote:
> Each bus is represented as an array of 32 8-bit integers
> where each bit represents a PCI function and each byte represents
> a PCI slot.
> 
> Uses just one bus so far.
> ---
>  src/qemu/qemu_command.c | 152 
> ++++++++++++++----------------------------------
>  1 file changed, 45 insertions(+), 107 deletions(-)

Less code to represent less in-memory storage - nice :)

> @@ -1268,7 +1274,7 @@ static int qemuCollectPCIAddress(virDomainDefPtr def 
> ATTRIBUTE_UNUSED,
>      if (!(str = qemuPCIAddressAsString(addr)))
>          goto cleanup;
>  
> -    if (virHashLookup(addrs->used, str)) {
> +    if (addrs->used[addr->bus][addr->slot] & 1 << addr->function) {

I had to remind myself that << has higher precedence than &; adding ()
might help, although not strictly necessary.

> @@ -1434,48 +1403,47 @@ int 
> qemuDomainPCIAddressReserveAddr(qemuDomainPCIAddressSetPtr addrs,
>  {
>      char *str;
>  
> -    str = qemuPCIAddressAsString(addr);
> -    if (!str)
> +    if (!(str = qemuPCIAddressAsString(addr)))
>          return -1;
>  
>      VIR_DEBUG("Reserving PCI addr %s", str);
>  
> -    if (virHashLookup(addrs->used, str)) {
> +    if (addrs->used[addr->bus][addr->slot] & 1 << addr->function) {

Same comment.

ACK.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to