[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 1/2 v3] Fix virDomainChrDefParseTargetXML() to parse the target port if available



On 02/21/2011 02:38 AM, Michal Novotny wrote:
> [snip]
>> We've got other code in domain_conf.c that assigns ports
>> to the first available slot; for example, look near line 5628 at how
>> virtio-serial ports are assigned using maxport and traversal of all
>> previously assigned ports.
>>
> Is the code correct there?
> 
> The code is:
> 
>         if (chr->info.type ==
> VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL &&
>             chr->info.addr.vioserial.port == 0) {
>             int maxport = 0;

virtio-serial has to start at port 1 (not 0, which is reserved), so
maxport starts at 0...

>             chr->info.addr.vioserial.port = maxport + 1;

and the assignment guarantees 1 or greater.  But serial and parallel
support port 0, so start maxport at -1  instead of 0, to reuse the same
logic.

-- 
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]