On Wed, Dec 30, 2009 at 11:19:30AM -0200, Luiz Capitulino wrote: > On Wed, 30 Dec 2009 13:50:43 +0200 > Gleb Natapov <g...@redhat.com> 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.