qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Re: [PATCHv2] add "info ioapic" monitor command


From: Gleb Natapov
Subject: [Qemu-devel] Re: [PATCHv2] add "info ioapic" monitor command
Date: Wed, 30 Dec 2009 15:22:19 +0200

On Wed, Dec 30, 2009 at 11:19:30AM -0200, Luiz Capitulino wrote:
> On Wed, 30 Dec 2009 13:50:43 +0200
> Gleb Natapov <address@hidden> wrote:
> 
> > I am starring to learn this QObject kung-fu.
> 
>  Nice, you really got how to do it. Just two minor comments.
> 
> > One question:
> > Why qlist_iter(..., func, ...) and not
> >  FOREACH_QOBJ() {
> >    do things
> >  }
> 
>  Well, when I started working on the QObjects I was still getting
> familiar with QEMU internals and just ignored the FOREACH_ loops.
> 
>  Later, I realized that they could be better but then we were
> planning to have libqmp and now I'm wondering if it's ok to expose
> data structure members to the public.
> 
> > diff --git a/hw/ioapic.c b/hw/ioapic.c
> > index b0ad78f..efb9744 100644
> > --- a/hw/ioapic.c
> > +++ b/hw/ioapic.c
> > @@ -24,6 +24,12 @@
> >  #include "pc.h"
> >  #include "qemu-timer.h"
> >  #include "host-utils.h"
> > +#include "monitor.h"
> > +#include "qint.h"
> > +#include "qlist.h"
> > +#include "qdict.h"
> > +#include "qstring.h"
> > +#include "qjson.h"
> 
>  You can include qemu-objects.h.
> 
Hm. Copied all this from monitor.c

> > +void do_info_ioapic(Monitor *mon, QObject **ret_data)
> > +{
> > +    int i;
> > +    QList *list;
> > +
> > +    *ret_data = NULL;
> > +
> > +    if (!ioapic)
> > +        return;
> > +
> > +    list = qlist_new();
> > +
> > +    for (i = 0; i < IOAPIC_NUM_PINS; i++) {
> > +        QObject *obj;
> > +        uint64 e = ioapic->ioredtbl[i];
> > +        if (e & IOAPIC_LVT_MASKED) {
> > +            obj = qobject_from_jsonf("{'index': %d, 'masked': 1}", i);
> 
>  'masked' should be a bool, using %i will do it, like:
> 
> 
>  obj = qobject_from_jsonf("{'index': %d, 'masked': %i}", i);
No need to put anything here? ------------------------------^?
OR should it be
obj = qobject_from_jsonf("{'index': %d, 'masked': %i}", i, true);

--
                        Gleb.




reply via email to

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