From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRML3-0005vk-Jk for qemu-devel@nongnu.org; Fri, 27 Feb 2015 09:56:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YRMKz-0003rs-Ec for qemu-devel@nongnu.org; Fri, 27 Feb 2015 09:56:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35836) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRMKz-0003rf-6S for qemu-devel@nongnu.org; Fri, 27 Feb 2015 09:56:21 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1REuJ1J024333 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 27 Feb 2015 09:56:20 -0500 Message-ID: <54F08592.1020204@redhat.com> Date: Fri, 27 Feb 2015 09:56:18 -0500 From: Cole Robinson MIME-Version: 1.0 References: <54EF8696.4000706@redhat.com> <1425022537.20883.9.camel@nilsson.home.kraxel.org> In-Reply-To: <1425022537.20883.9.camel@nilsson.home.kraxel.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] hmp: info spice: Show string channel name List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann , Eric Blake Cc: qemu-devel@nongnu.org, Markus Armbruster , Luiz Capitulino On 02/27/2015 02:35 AM, Gerd Hoffmann wrote: > On Do, 2015-02-26 at 13:48 -0700, Eric Blake wrote: >> On 02/26/2015 12:02 PM, Cole Robinson wrote: >>> Useful for debugging. >>> >>> https://bugzilla.redhat.com/show_bug.cgi?id=822418 >>> Signed-off-by: Cole Robinson >>> --- >>> 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"}; >>> >> >> Hmm. I wonder if we should have a QAPI enum for this, instead of >> open-coding it here. But as this is already a strict improvement, > > These numbers are defined by spice not qemu, so a qapi enum isn't going > to fly here. > > Nevertheless it would be great to declare the array using c99 syntax ... > > [ SPICE_CHANNEL_foo ] = "foo", > > ... to make clear how we are mapping spice enums (or #defines?) to > strings here. > > cheers, > Gerd > > > Good idea, I'll send a v2 Thanks, Cole