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

[libvirt] [PATCH 01/17] graphics: use enums instead of int



Signed-off-by: Pavel Hrdina <phrdina redhat com>
---
 src/conf/domain_conf.c  |  2 ++
 src/conf/domain_conf.h  | 14 +++++++-------
 src/libxl/libxl_conf.c  |  8 ++++++++
 src/qemu/qemu_command.c | 14 +++++++++++++-
 4 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2c97bc1..73f8620 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -21519,6 +21519,8 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
         virDomainGraphicsAuthDefFormatAttr(buf, &def->data.spice.auth, flags);
         break;
 
+    case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
+        break;
     }
 
     for (i = 0; i < def->nListens; i++) {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index b7b099c..b825477 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1552,7 +1552,7 @@ typedef enum {
 typedef struct _virDomainGraphicsListenDef virDomainGraphicsListenDef;
 typedef virDomainGraphicsListenDef *virDomainGraphicsListenDefPtr;
 struct _virDomainGraphicsListenDef {
-    int type;   /* enum virDomainGraphicsListenType */
+    virDomainGraphicsListenType type;
     char *address;
     char *network;
     bool fromConfig;    /* true if the @address is config file originated */
@@ -1564,7 +1564,7 @@ struct _virDomainGraphicsDef {
      * Value 0 means port wasn't specified in XML at all.
      * Positive value is actual port number given in XML.
      */
-    int type;
+    virDomainGraphicsType type;
     union {
         struct {
             int port;
@@ -1597,20 +1597,20 @@ struct _virDomainGraphicsDef {
             int tlsPort;
             bool portReserved;
             bool tlsPortReserved;
-            int mousemode;
+            virDomainGraphicsSpiceMouseMode mousemode;
             char *keymap;
             virDomainGraphicsAuthDef auth;
             bool autoport;
             int channels[VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST];
-            int defaultMode; /* enum virDomainGraphicsSpiceChannelMode */
+            virDomainGraphicsSpiceChannelMode defaultMode;
             int image;
             int jpeg;
             int zlib;
             int playback;
             int streaming;
-            int copypaste; /* enum virTristateBool */
-            int filetransfer; /* enum virTristateBool */
-            int gl; /* enum virTristateBool */
+            virTristateBool copypaste;
+            virTristateBool filetransfer;
+            virTristateBool gl;
         } spice;
     } data;
     /* nListens, listens, and *port are only useful if type is vnc,
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 30f2ce9..d927b37 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -1463,6 +1463,12 @@ libxlMakeVfb(virPortAllocatorPtr graphicsports,
             if (VIR_STRDUP(x_vfb->keymap, l_vfb->data.vnc.keymap) < 0)
                 return -1;
             break;
+
+        case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+        case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
+        case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
+        case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
+            break;
     }
 
     return 0;
@@ -1579,6 +1585,8 @@ libxlMakeBuildInfoVfb(virPortAllocatorPtr graphicsports,
         case VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_SERVER:
             libxl_defbool_set(&b_info->u.hvm.spice.agent_mouse, false);
             break;
+        case VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST:
+            break;
         }
 
 #ifdef LIBXL_HAVE_SPICE_VDAGENT
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 08c6c61..8ec550e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7381,6 +7381,10 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
                 if (VIR_STRDUP(gListen->address, netAddr) < 0)
                     goto error;
                 break;
+
+            case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE:
+            case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST:
+                break;
             }
         }
 
@@ -7538,6 +7542,10 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
                 if (VIR_STRDUP(gListen->address, listenAddr) < 0)
                     goto error;
                 break;
+
+            case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE:
+            case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST:
+                break;
             }
         }
 
@@ -7663,7 +7671,7 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
         }
     }
 
-    if (graphics->data.spice.gl == VIR_TRISTATE_SWITCH_ON) {
+    if (graphics->data.spice.gl == VIR_TRISTATE_BOOL_YES) {
         if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE_GL)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("This QEMU doesn't support spice OpenGL"));
@@ -9256,6 +9264,10 @@ qemuBuildCommandLineValidate(virQEMUDriverPtr driver,
         case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
             ++spice;
             break;
+        case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+        case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
+        case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
+            break;
         }
     }
 
-- 
2.8.2


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