[PATCH 4/5] qemu: validate: Enforce compile time switch type checking for videos

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

 



There wasn't an explicit type case to the video type enum in
qemuDomainDeviceDefValidateVideo, _TYPE_GOP was also missing from the
switch.

Signed-off-by: Erik Skultety <eskultet@xxxxxxxxxx>
---
 src/conf/domain_conf.h | 2 +-
 src/qemu/qemu_domain.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 834a7c1d7f..6d73a0b5d3 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1454,7 +1454,7 @@ struct _virDomainVideoDriverDef {
 };
 
 struct _virDomainVideoDef {
-    int type;
+    int type;   /* enum virDomainVideoType */
     unsigned int ram;  /* kibibytes (multiples of 1024) */
     unsigned int vram; /* kibibytes (multiples of 1024) */
     unsigned int vram64; /* kibibytes (multiples of 1024) */
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 32128bf04d..42b7635ef4 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4443,10 +4443,11 @@ qemuDomainDeviceDefValidateHostdev(const virDomainHostdevDef *hostdev,
 static int
 qemuDomainDeviceDefValidateVideo(const virDomainVideoDef *video)
 {
-    switch (video->type) {
+    switch ((virDomainVideoType) video->type) {
     case VIR_DOMAIN_VIDEO_TYPE_XEN:
     case VIR_DOMAIN_VIDEO_TYPE_VBOX:
     case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
+    case VIR_DOMAIN_VIDEO_TYPE_GOP:
     case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("video type '%s' is not supported with QEMU"),
-- 
2.14.4

--
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]

  Powered by Linux