qemu-devel
[Top][All Lists]
Advanced

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

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


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH] hmp: info spice: Show string channel name
Date: Fri, 27 Feb 2015 08:35:37 +0100

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 <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"};
> >  
> 
> 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





reply via email to

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