qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] hmp: info spice: Show string channel name


From: Cole Robinson
Subject: [Qemu-devel] [PATCH] hmp: info spice: Show string channel name
Date: Thu, 26 Feb 2015 14:02:25 -0500

Useful for debugging.

https://bugzilla.redhat.com/show_bug.cgi?id=822418
Signed-off-by: Cole Robinson <address@hidden>
---
 hmp.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/hmp.c b/hmp.c
index 735097c..93fd5cd 100644
--- a/hmp.c
+++ b/hmp.c
@@ -545,6 +545,11 @@ void hmp_info_spice(Monitor *mon, const QDict *qdict)
 {
     SpiceChannelList *chan;
     SpiceInfo *info;
+    const char *channel_name;
+    /* String representations of SPICE_CHANNEL_* enum */
+    const char * const channel_names[] = {"main", "display", "input", "cursor",
+        "playback", "record", "tunnel", "smartcard", "usbredir", "port",
+        "webdav"};
 
     info = qmp_query_spice(NULL);
 
@@ -581,6 +586,14 @@ void hmp_info_spice(Monitor *mon, const QDict *qdict)
                            chan->value->connection_id);
             monitor_printf(mon, "     channel: %" PRId64 ":%" PRId64 "\n",
                            chan->value->channel_type, chan->value->channel_id);
+
+            channel_name = "unknown";
+            if (chan->value->channel_type > 0 &&
+                chan->value->channel_type <= sizeof(channel_names)) {
+                channel_name = channel_names[chan->value->channel_type - 1];
+            }
+
+            monitor_printf(mon, "     channel name: %s\n", channel_name);
         }
     }
 
-- 
2.1.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]