From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46200) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRFSd-0000yp-LN for qemu-devel@nongnu.org; Fri, 27 Feb 2015 02:35:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YRFSZ-0003QP-W9 for qemu-devel@nongnu.org; Fri, 27 Feb 2015 02:35:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35337) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRFSZ-0003Pf-5s for qemu-devel@nongnu.org; Fri, 27 Feb 2015 02:35:43 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1R7Zf19012821 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 27 Feb 2015 02:35:41 -0500 Message-ID: <1425022537.20883.9.camel@nilsson.home.kraxel.org> From: Gerd Hoffmann Date: Fri, 27 Feb 2015 08:35:37 +0100 In-Reply-To: <54EF8696.4000706@redhat.com> References: <54EF8696.4000706@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 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: Eric Blake Cc: Markus Armbruster , Luiz Capitulino , qemu-devel@nongnu.org, Cole Robinson 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