[libvirt] [PATCHv4 3/9] Introduce virDomainUSBAddressSet

John Ferlan jferlan at redhat.com
Wed Jul 13 21:41:34 UTC 2016



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.

ACK for what's here

John




More information about the libvir-list mailing list