[libvirt] [PATCHv4 3/9] Introduce virDomainUSBAddressSet

Erik Skultety eskultet at redhat.com
Mon Jul 18 13:11:02 UTC 2016


On 13/07/16 23:41, John Ferlan wrote:
> 
> 
> On 07/01/2016 11:38 AM, Ján Tomko wrote:
>> A new type to track USB addresses.
>>
>> Every <controller type='usb' index='i'/> is represented by an
>> object of type virDomainUSBAddressHub located at buses[i].
>>
>> Each of these hubs has up to 'nports' ports.
>> If a port is occupied, it has the corresponding bit set in
>> the 'ports' bitmap, e.g. port 1 would have the 0th bit set.
>> If there is a hub on this port, then hubs[i] will point
>> to this hub.
>> ---
>>  src/conf/domain_addr.c   | 46 ++++++++++++++++++++++++++++++++++++++++++++++
>>  src/conf/domain_addr.h   | 22 ++++++++++++++++++++++
>>  src/libvirt_private.syms |  2 ++
>>  3 files changed, 70 insertions(+)
>>
> 
> Possibly trading fast/direct array access for linear searches matching
> numerical controller values.
> 
> I wonder how this would play in a "common" <addr> algorithm. That is
> could PCI, SCSI, etc. make use of this paradigm. Secondarily whether
> "usb#" could be used as a key to a hashTable of addresses (where # is
> the controller index).  OK beyond the scope of this change...
> 
> The one confusing thing to see is "nports" is used to walk the 'hubs'
> array.  Maybe if 'ports' was renamed 'portmap' and then 'hubs' changed
> to 'ports'... I dunno, guess you understand where things are going
> better so I'm fine as is, albeit a bit odd.

^^^ I agree with John's rename proposal. It felt a bit odd for me as
well, but since I could not come up with a suitable alternative I didn't
want to just say "I'm not sure about this naming because it's not clear
enough..."

Erik

> 
> ACK for what's here
> 
> John
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
> 




More information about the libvir-list mailing list