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

Eric Blake eblake at redhat.com
Mon Apr 22 22:37:11 UTC 2013


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130422/64e129c2/attachment-0001.sig>


More information about the libvir-list mailing list