qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cole Robinson <crobinso@redhat.com>
To: qemu-devel@nongnu.org
Cc: Cole Robinson <crobinso@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Luiz Capitulino <lcapitulino@redhat.com>
Subject: [Qemu-devel] [PATCH] hmp: info spice: Show string channel name
Date: Thu, 26 Feb 2015 14:02:25 -0500	[thread overview]
Message-ID: <ba2448d0378c0e86ecaae4d39ee74ea7ef197935.1424977275.git.crobinso@redhat.com> (raw)

Useful for debugging.

https://bugzilla.redhat.com/show_bug.cgi?id=822418
Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
 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	other threads:[~2015-02-26 19:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-26 19:02 Cole Robinson [this message]
2015-02-26 20:48 ` [Qemu-devel] [PATCH] hmp: info spice: Show string channel name Eric Blake
2015-02-27  7:35   ` Gerd Hoffmann
2015-02-27 14:56     ` Cole Robinson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ba2448d0378c0e86ecaae4d39ee74ea7ef197935.1424977275.git.crobinso@redhat.com \
    --to=crobinso@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).