Andreas Färber <afaer...@suse.de> writes:

> Did you mean avalanche?

Yes, fixing...

> Am 13.06.2015 um 13:18 schrieb Markus Armbruster:
>> Reproducer:
>> 
>>     $ qemu-system-x86_64 -nodefaults -device virtio-rng-pci -device 
>> virtio-rng-pci -device virtio-rng-device,bus=virtio-bus
>>     qemu-system-x86_64: -device virtio-rng-device,bus=virtio-bus: Bus 
>> 'virtio-bus' is full
>>     qemu-system-x86_64: -device virtio-rng-device,bus=virtio-bus: Bus 
>> 'virtio-bus' is full
>>     qemu-system-x86_64: -device virtio-rng-device,bus=virtio-bus: Bus 
>> 'virtio-bus' not found
>> 
>> qbus_find_recursive() reports the "is full" error itself, and leaves
>> reporting "not found" to its caller.  The result is confusion.  Write
>> it a function contract that permits leaving all error reporting to the
>> caller, and implement it.  Update callers to detect and report "is
>> full".
>> 
>> Screwed up when commit 1395af6 added the max_dev limit and the "is
>> full" error condition to enforce it.
>> 
>> Signed-off-by: Markus Armbruster <arm...@redhat.com>
>> Reviewed-by: Eric Blake <ebl...@redhat.com>
>> ---
>>  qdev-monitor.c | 62 
>> ++++++++++++++++++++++++++++++++++++----------------------
>>  1 file changed, 39 insertions(+), 23 deletions(-)
>> 
>> diff --git a/qdev-monitor.c b/qdev-monitor.c
>> index 7dd62dd..1408c86 100644
>> --- a/qdev-monitor.c
>> +++ b/qdev-monitor.c
>> @@ -364,43 +364,55 @@ static DeviceState *qbus_find_dev(BusState *bus, char 
>> *elem)
>>      return NULL;
>>  }
>>  
>> +static inline bool qbus_is_full(BusState *bus)
>> +{
>> +    BusClass *bus_class = BUS_GET_CLASS(bus);
>> +    return bus_class->max_dev && bus->max_index >= bus_class->max_dev;
>> +}
>> +
>> +/**
>
> This should probably just be "/*".

Fixing...

> I'll trust you on getting the functional logic right, can't do a full
> review right now.

Thank you all the same!

Reply via email to