Re: [PATCH v3 4/5] qemu: auto-add pci-root controller for pc machine types

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

 



On 04/22/2013 02:37 PM, Laine Stump wrote:
> On 04/22/2013 02:43 PM, Ján Tomko wrote:
>> <controller type='pci' index='0' model='pci-root'/>
>> is auto-added to pc* machine types.
>> Without this controller PCI bus 0 is not available and
>> no PCI addresses are assigned by default.
>>
>> Since older libvirt supported PCI bus 0 even without
>> this controller, it is removed from the XML when migrating.
>> ---

>> +    /* Add implicit PCI root controller if the machine has one */
>> +    switch (def->os.arch) {
>> +    case VIR_ARCH_I686:
>> +    case VIR_ARCH_X86_64:
>> +        if (!def->os.machine)
>> +            break;
>> +        if (STRPREFIX(def->os.machine, "pc-q35") ||
>> +            STREQ(def->os.machine, "q35") ||
>> +            STREQ(def->os.machine, "isapc"))
>> +            break;
>> +        if (!STRPREFIX(def->os.machine, "pc-0.") &&
>> +            !STRPREFIX(def->os.machine, "pc-1.") &&
>> +            !STREQ(def->os.machine, "pc") &&
>> +            !STRPREFIX(def->os.machine, "rhel"))
>> +            break;
> 
> 
> If you're going to fall through to a different case like this, you
> should put a comment in the code something like this:
> 
>      /* FALL THROUGH TO NEXT CASE */
> 
> just so people don't have to think too hard :-)

That, and Coverity will ding you on unmarked fallthrough of a non-empty
case label.  Coverity recognizes several spellings, but our code base
seems to prefer the spelling "/* fallthrough */" as a form that works
across several static analyzers.

> ACK, with the addition of the "FALLTHROUGH" comment, or restructuring it
> is as I suggested.

Of course, restructuring it means you don't even have to worry about
magic comments :)

-- 
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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]