[PATCH 3/8] qemu: annotate some VIDEO_TYPE enum switch

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

 



For the ram/vram monitor wrappers, just add a default: clause...
seems like it should be rarely extended so this saves every committer
from needing to update

For the validation switch, fill in the missing values

Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c       |  3 ++-
 src/qemu/qemu_monitor_json.c | 16 ++++------------
 src/qemu/qemu_process.c      |  7 ++-----
 3 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 90f489840..ac1bc1a1e 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2950,10 +2950,11 @@ qemuDomainDefValidateVideo(const virDomainDef *def)
     for (i = 0; i < def->nvideos; i++) {
         video = def->videos[i];
 
-        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:
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("video type '%s' is not supported with QEMU"),
                            virDomainVideoTypeToString(video->type));
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 5ddc09ca6..2afc03329 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -1565,7 +1565,7 @@ qemuMonitorJSONUpdateVideoMemorySize(qemuMonitorPtr mon,
         {0}
     };
 
-    switch (video->type) {
+    switch ((virDomainVideoType) video->type) {
     case VIR_DOMAIN_VIDEO_TYPE_VGA:
         if (qemuMonitorJSONGetObjectProperty(mon, path, "vgamem_mb", &prop) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -1608,10 +1608,7 @@ qemuMonitorJSONUpdateVideoMemorySize(qemuMonitorPtr mon,
         }
         video->vram = prop.val.ul * 1024;
         break;
-    case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
-    case VIR_DOMAIN_VIDEO_TYPE_XEN:
-    case VIR_DOMAIN_VIDEO_TYPE_VBOX:
-    case VIR_DOMAIN_VIDEO_TYPE_LAST:
+    default:
         break;
     }
 
@@ -1635,7 +1632,7 @@ qemuMonitorJSONUpdateVideoVram64Size(qemuMonitorPtr mon,
         {0}
     };
 
-    switch (video->type) {
+    switch ((virDomainVideoType) video->type) {
     case VIR_DOMAIN_VIDEO_TYPE_QXL:
         if (video->vram64 != 0) {
             if (qemuMonitorJSONGetObjectProperty(mon, path,
@@ -1648,12 +1645,7 @@ qemuMonitorJSONUpdateVideoVram64Size(qemuMonitorPtr mon,
             video->vram64 = prop.val.ul * 1024;
         }
         break;
-    case VIR_DOMAIN_VIDEO_TYPE_VGA:
-    case VIR_DOMAIN_VIDEO_TYPE_VMVGA:
-    case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
-    case VIR_DOMAIN_VIDEO_TYPE_XEN:
-    case VIR_DOMAIN_VIDEO_TYPE_VBOX:
-    case VIR_DOMAIN_VIDEO_TYPE_LAST:
+    default:
         break;
     }
 
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index d669dfb32..fb6e2c82b 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2605,7 +2605,7 @@ qemuProcessUpdateVideoRamSize(virQEMUDriverPtr driver,
     for (i = 0; i < vm->def->nvideos; i++) {
         video = vm->def->videos[i];
 
-        switch (video->type) {
+        switch ((virDomainVideoType) video->type) {
         case VIR_DOMAIN_VIDEO_TYPE_VGA:
             if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VGA_VGAMEM)) {
                 if (qemuMonitorUpdateVideoMemorySize(priv->mon, video, "VGA") < 0)
@@ -2642,10 +2642,7 @@ qemuProcessUpdateVideoRamSize(virQEMUDriverPtr driver,
                     goto error;
             }
             break;
-        case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
-        case VIR_DOMAIN_VIDEO_TYPE_XEN:
-        case VIR_DOMAIN_VIDEO_TYPE_VBOX:
-        case VIR_DOMAIN_VIDEO_TYPE_LAST:
+        default:
             break;
         }
 
-- 
2.13.0

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