From: "Daniel P. Berrange" <berrange@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: "Pavel Fedin" <p.fedin@samsung.com>,
qemu-devel@nongnu.org, "Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] Stick to loops (was: [PATCH v3 1/5] qom: introduce object_property_foreach method)
Date: Tue, 13 Oct 2015 13:09:32 +0100 [thread overview]
Message-ID: <20151013120932.GH18659@redhat.com> (raw)
In-Reply-To: <20151012100004.GH21855@redhat.com>
On Mon, Oct 12, 2015 at 11:00:04AM +0100, Daniel P. Berrange wrote:
> On Fri, Oct 09, 2015 at 10:31:26AM +0200, Markus Armbruster wrote:
> > We have quite a few _foreach-functions to help iterate over various
> > things. They are easy enough to write, but I find them awkward to use.
> >
> > Implementing bdrv_next() is no harder than bdrv_iterate(). Compare:
> >
> > BlockDriverState *bdrv_next(BlockDriverState *bs)
> > {
> > if (!bs) {
> > return QTAILQ_FIRST(&bdrv_states);
> > }
> > return QTAILQ_NEXT(bs, device_list);
> > }
> >
> > void bdrv_iterate(void (*it)(void *opaque, BlockDriverState *bs), void *opaque)
> > {
> > BlockDriverState *bs;
> >
> > QTAILQ_FOREACH(bs, &bdrv_states, device_list) {
> > it(opaque, bs);
> > }
> > }
>
> I don't think your example here is a reasonable comparison when you consider
> the full extent of this patch series. You are only having to iterate over a
> single data structure here. At the end of this patch series we have to
> iterate over multiple data structures spread across the object instance
> and class hierarchy, so writing a 'next' like method is not as trivial
> as you suggest with this comparison.
So it turns out I was wrong here. After a little more thinking I found
it was in fact fairly trivial to support a "next" like iterator in this
QOM property scenario, even when taking class properties into account.
So I'll re-spin this patch series with that approach, since it makes
the diffs much smaller
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
next prev parent reply other threads:[~2015-10-13 12:09 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-08 14:08 [Qemu-devel] [PATCH v3 0/5] qom: more efficient object property handling Daniel P. Berrange
2015-10-08 14:09 ` [Qemu-devel] [PATCH v3 1/5] qom: introduce object_property_foreach method Daniel P. Berrange
2015-10-08 16:29 ` Eric Blake
2015-10-09 8:31 ` [Qemu-devel] Stick to loops (was: [PATCH v3 1/5] qom: introduce object_property_foreach method) Markus Armbruster
2015-10-12 10:00 ` Daniel P. Berrange
2015-10-12 10:24 ` [Qemu-devel] Stick to loops Paolo Bonzini
2015-10-12 11:56 ` Markus Armbruster
2015-10-13 12:09 ` Daniel P. Berrange [this message]
2015-10-08 14:09 ` [Qemu-devel] [PATCH v3 2/5] qmp: convert to use object_property_foreach iterators Daniel P. Berrange
2015-10-08 16:35 ` Eric Blake
2015-10-08 14:09 ` [Qemu-devel] [PATCH v3 3/5] vl: convert machine help to use object_property_foreach Daniel P. Berrange
2015-10-08 19:06 ` Eric Blake
2015-10-08 14:09 ` [Qemu-devel] [PATCH v3 4/5] qom: replace object property list with GHashTable Daniel P. Berrange
2015-10-08 15:05 ` Pavel Fedin
2015-10-08 19:13 ` Eric Blake
2015-10-08 14:09 ` [Qemu-devel] [PATCH v3 5/5] qom: allow properties to be registered against classes Daniel P. Berrange
2015-10-08 19:35 ` Eric Blake
2015-10-08 15:12 ` [Qemu-devel] [PATCH v3 0/5] qom: more efficient object property handling Eric Blake
2015-10-08 15:27 ` Pavel Fedin
2015-10-08 15:48 ` Daniel P. Berrange
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151013120932.GH18659@redhat.com \
--to=berrange@redhat.com \
--cc=afaerber@suse.de \
--cc=armbru@redhat.com \
--cc=p.fedin@samsung.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.