Received: from eggs.gnu.org ([208.118.235.92]:55916) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TirGj-0007HC-DJ for qemu-devel@nongnu.org; Wed, 12 Dec 2012 13:43:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TirGX-0002Pw-9a for qemu-devel@nongnu.org; Wed, 12 Dec 2012 13:42:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48553) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TirGX-0002Pl-1Q for qemu-devel@nongnu.org; Wed, 12 Dec 2012 13:42:45 -0500 Date: Wed, 12 Dec 2012 16:44:19 -0200 From: Eduardo Habkost Message-ID: <20121212184419.GK3236@otherpad.lan.raisama.net> References: <1353888766-6951-1-git-send-email-afaerber@suse.de> <1353888766-6951-5-git-send-email-afaerber@suse.de> <20121212142905.GA5334@otherpad.lan.raisama.net> <50C8B606.4000102@suse.de> <20121212181633.GH3236@otherpad.lan.raisama.net> <50C8CBFD.3030905@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <50C8CBFD.3030905@suse.de> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC 04/34] qdev: Prepare "realized" property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: Paolo Bonzini , qemu-devel@nongnu.org, anthony@codemonkey.ws On Wed, Dec 12, 2012 at 07:25:01PM +0100, Andreas F=E4rber wrote: > Am 12.12.2012 19:16, schrieb Eduardo Habkost: > > So, just to check if I understood all correctly: > >=20 > > DeviceClass.init() is just the old and deprecated version of > > DeviceClass.realize() (just because the former has no Error parameter= ), > > but both have exactly the same semantics/purpose, and devices should = now > > use DeviceClass.realize() instead. Correct? >=20 > Almost! Some qdev initfns today do things that instance_init should do > and realizefn shouldn't. Creating child devices in qdev initfn tampers > with our future ability to set realized =3D true recursively. In those cases, where should the child device cration be moved to? Whatever the answer is, can we have those subtle differences documented inside DeviceClass? I specifically mean documenting the purpose of the init/realize/unrealize function pointers and their semantics/requirements for subclasses, not just documenting the semantics of the "realized" property and device_set_realized(). Knowing what device_set_realize() and qdev_init() are supposed to do when all classes already do what they are supposed to is easy. Knowing what exactly subclasses can/can't to do when setting init/realize/unrealize functions is a bit more complicated. >=20 > The other difference that I see (RFC) is that qdev uses an > only-the-instance's-class-sets-init approach, whereas with QOM any clas= s > in the hierarchy can set/override the "virtual" method but needs to tak= e > care of storing and (if desired) calling the parent's version itself, > i.e. an inversion of control towards child classes. I see. In theory we could change DeviceClass.init() to have the same requirements/semantic, but then we would need to change every class to save the parent's init() function and call it. --=20 Eduardo