From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41321) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXY0o-0000BN-Iq for qemu-devel@nongnu.org; Thu, 03 Sep 2015 13:09:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXY0l-0000ST-DO for qemu-devel@nongnu.org; Thu, 03 Sep 2015 13:09:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43240) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXY0l-0000SI-1o for qemu-devel@nongnu.org; Thu, 03 Sep 2015 13:09:19 -0400 Date: Thu, 3 Sep 2015 18:09:14 +0100 From: "Daniel P. Berrange" Message-ID: <20150903170914.GX31547@redhat.com> References: <1440590594-5514-1-git-send-email-berrange@redhat.com> <1440590594-5514-2-git-send-email-berrange@redhat.com> <55E72154.7070404@suse.de> <20150903154952.GK31547@redhat.com> <87oahjmpaw.fsf@blackfin.pond.sub.org> <55E87831.5040405@suse.de> <87a8t3l9lq.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87a8t3l9lq.fsf@blackfin.pond.sub.org> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH RFC 1/7] qom: allow properties to be registered against classes Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Paolo Bonzini , Andreas =?utf-8?Q?F=C3=A4rber?= , qemu-devel@nongnu.org On Thu, Sep 03, 2015 at 07:02:25PM +0200, Markus Armbruster wrote: > Andreas F=C3=A4rber writes: >=20 > > Am 03.09.2015 um 18:37 schrieb Markus Armbruster: > >> "Daniel P. Berrange" writes: > >>> On Wed, Sep 02, 2015 at 06:18:28PM +0200, Andreas F=C3=A4rber wrote= : > >>>> I had suggested exactly this looong time ago, but Anthony opposed = it. I > >>>> don't quite remember why... > >>> > >>> It is a while back now so I don't remember all aspects of the discu= ssion > >>> either. The main thing I remember is that we could not simply use t= he > >>> existing GObject model from glib, since that exclusively records pr= operties > >>> against the object class. In some cases, particularly the relations= hips > >>> between objects, QEMU needed to be able to define properties on the= fly > >>> against object instances. > >>=20 > >> I remember Anthony's assertion that this is the case, but I don't > >> remember the actual problems where this is actually the case. > >>=20 > >> What properties do we currently define that could not be defined aga= inst > >> the class? > > > > All child<> properties and everything on Container objects. >=20 > Apologies if you had to explain this a dozen times already, but here > goes my ignorant question anyway: why can't these properties be defined > against the class? IIUC, you can have zero or more "child" properties registered. You only know how many such properties to register at runtime, and the count can vary per object instance. So you have to register "child<1>", "child<2>", etc properties on objects. If we wanted to register these against the class, we could introduce an "array of objects" property type. So we would just register a "children" array property against the class, which can be populated with arbitrary number of objects at runtime. If we did this though, we'd probably need to setup some backwards compat support so that any code (or external user of QEMU) that tries to use "child<1>" would get transparently forwarded to "children" property, element 1. I think it could be worth exploring this idea, but since it is a significantly more complex thing I didn't try in this series, and just ignored the child/container problem. Regards, Daniel --=20 |: http://berrange.com -o- http://www.flickr.com/photos/dberrange= / :| |: http://libvirt.org -o- http://virt-manager.or= g :| |: http://autobuild.org -o- http://search.cpan.org/~danberr= / :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vn= c :|