From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44978) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXYCG-0006Ni-Jp for qemu-devel@nongnu.org; Thu, 03 Sep 2015 13:21:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXYCC-0005nn-C6 for qemu-devel@nongnu.org; Thu, 03 Sep 2015 13:21:12 -0400 Received: from mx2.suse.de ([195.135.220.15]:57889) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXYCC-0005nN-2m for qemu-devel@nongnu.org; Thu, 03 Sep 2015 13:21:08 -0400 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> <20150903170914.GX31547@redhat.com> From: =?UTF-8?Q?Andreas_F=c3=a4rber?= Message-ID: <55E88183.1010706@suse.de> Date: Thu, 3 Sep 2015 19:21:07 +0200 MIME-Version: 1.0 In-Reply-To: <20150903170914.GX31547@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH RFC 1/7] qom: allow properties to be registered against classes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , Markus Armbruster Cc: Paolo Bonzini , qemu-devel@nongnu.org Am 03.09.2015 um 19:09 schrieb Daniel P. Berrange: > On Thu, Sep 03, 2015 at 07:02:25PM +0200, Markus Armbruster wrote: >> Andreas F=C3=A4rber writes: >> >>> 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. >>>> >>>> I remember Anthony's assertion that this is the case, but I don't >>>> remember the actual problems where this is actually the case. >>>> >>>> What properties do we currently define that could not be defined aga= inst >>>> the class? >>> >>> All child<> properties and everything on Container objects. >> >> Apologies if you had to explain this a dozen times already, but here >> goes my ignorant question anyway: why can't these properties be define= d >> against the class? >=20 > 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. >=20 > 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. For that array concept I reserved literal "[*]" recently (patches welcome= !), > I think it could be worth exploring this idea, but here child<...> is the type. Properties can have arbitrary names, in some cases (containers) varying from instance to instance, thus are dynamic. E.g., -device =3D> /machine/peripheral-anon/device[n]. The peculiarity of child<> properties is that the property itself contains the value pointer, rather than its parent object instance. Therefore we'll need both class and object level properties, as I thought you had done in your patch. Markus, if we need an in-depth discussion, please put it on the agenda for Tuesday. :) Regards, Andreas --=20 SUSE Linux GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Felix Imend=C3=B6rffer, Jane Smithard, Graham Norton; HRB 21284 (AG N= =C3=BCrnberg)