]> git.ipfire.org Git - thirdparty/libvirt.git/commit
conf: add enum constants for default controller models
authorDaniel P. Berrangé <berrange@redhat.com>
Wed, 14 Feb 2018 10:51:26 +0000 (10:51 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Tue, 20 Feb 2018 14:58:39 +0000 (14:58 +0000)
commita302480dcb17acb759b0034b3d5ae70a0fb5e9da
tree4444f82f99e416790b7e60c95b377ddf3eb3766d
parentcbd1eba8b7b22dafe1dd57f6825dfd06aef072e1
conf: add enum constants for default controller models

The controller model is slightly unusual in that the default value is
-1, not 0. As a result the default value is not covered by any of the
existing enum cases. This in turn means that any switch() statements
that think they have covered all cases, will in fact not match the
default value at all. In the qemuDomainDeviceCalculatePCIConnectFlags()
method this has caused a serious mistake where we fallthrough from the
SCSI controller case, to the VirtioSerial controller case, and from
the USB controller case to the IDE controller case.

By adding explicit enum constant starting at -1, we can ensure switches
remember to handle the default case.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/conf/domain_addr.c
src/conf/domain_conf.c
src/conf/domain_conf.h
src/libxl/libxl_conf.c
src/qemu/qemu_command.c
src/qemu/qemu_domain.c
src/qemu/qemu_domain_address.c
src/qemu/qemu_hotplug.c
src/vbox/vbox_common.c
src/vmx/vmx.c