qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 6/9] QError: Add qdev not found error


From: Luiz Capitulino
Subject: Re: [Qemu-devel] [PATCH 6/9] QError: Add qdev not found error
Date: Thu, 15 Oct 2009 10:34:05 -0300

On Wed, 14 Oct 2009 16:02:10 -0700
Hollis Blanchard <address@hidden> wrote:

> On Tue, 2009-10-13 at 13:57 -0300, Luiz Capitulino wrote:
> > Signed-off-by: Luiz Capitulino <address@hidden>
> > ---
> >  qerror.c |   12 ++++++++++++
> >  qerror.h |    1 +
> >  2 files changed, 13 insertions(+), 0 deletions(-)
> > 
> > diff --git a/qerror.c b/qerror.c
> > index bbea770..88a8208 100644
> > --- a/qerror.c
> > +++ b/qerror.c
> > @@ -24,11 +24,23 @@ static const QType qerror_type = {
> >      .destroy = qerror_destroy_obj,
> >  };
> > 
> > +static void qemu_err_qdev_nodev(const QError *qerror)
> > +{
> > +    QDict *qdict = qobject_to_qdict(qerror->data);
> > +    qemu_error("Device \"%s\" not found.  Try -device '?' for a list.\n",
> > +               qdict_get_str(qdict, "name"));
> > +}
> > +
> >  static QErrorTable qerror_table[] = {
> >      {
> >          .code   = QERR_UNKNOWN,
> >          .desc   = "unknown error",
> >      },
> > +    {
> > +        .code   = QERR_QDEV_NFOUND,
> > +        .desc   = "device not found",
> > +        .user_print = qemu_err_qdev_nodev,
> > +    },
> >  };
> > 
> >  /**
> > diff --git a/qerror.h b/qerror.h
> > index ed25ef1..820f25e 100644
> > --- a/qerror.h
> > +++ b/qerror.h
> > @@ -21,6 +21,7 @@
> >   */
> >  typedef enum QErrorCode {
> >      QERR_UNKNOWN,
> > +    QERR_QDEV_NFOUND,
> >      QERR_MAX,
> >  } QErrorCode;
> 
> I'm not really seeing the point: what is gained by moving the error text
> from the original site into this function-inside-a-structure?

 Compatibility and a way of having pretty printing functions w/o
breaking the machine protocol.




reply via email to

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