From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLnWU-0006p0-DF for qemu-devel@nongnu.org; Fri, 07 Mar 2014 00:40:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLnWO-0003eT-7t for qemu-devel@nongnu.org; Fri, 07 Mar 2014 00:40:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43038) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLnWN-0003dx-T2 for qemu-devel@nongnu.org; Fri, 07 Mar 2014 00:40:36 -0500 Message-ID: <1394170851.2663.30.camel@localhost.localdomain> From: Marcel Apfelbaum Date: Fri, 07 Mar 2014 07:40:51 +0200 In-Reply-To: <53191DD9.2020009@ozlabs.ru> References: <1394040647-20083-1-git-send-email-marcel.a@redhat.com> <1394040647-20083-4-git-send-email-marcel.a@redhat.com> <5319087A.3090403@suse.de> <53191DD9.2020009@ozlabs.ru> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 3/3] hw/boards: converted current_machine to be an instance of MachineCLass List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: ehabkost@redhat.com, mst@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, lcapitulino@redhat.com, blauwirbel@gmail.com, aliguori@amazon.com, pbonzini@redhat.com, imammedo@redhat.com, Andreas =?ISO-8859-1?Q?F=E4rber?= On Fri, 2014-03-07 at 12:16 +1100, Alexey Kardashevskiy wrote: > On 03/07/2014 10:44 AM, Andreas F=C3=A4rber wrote: > > Am 05.03.2014 18:30, schrieb Marcel Apfelbaum: > >> In order to allow attaching machine options to a machine instance, > >> current_machine is converted into MachineState. > >> As a first step of deprecating QEMUMachine, some of the functions > >> were modified to return MachineCLass. > >> > >> Signed-off-by: Marcel Apfelbaum > >=20 > > Looks mostly good, but same issue as Alexey's patch: We are risking > > qdev_get_machine() creating a Container-typed /machine node. >=20 > Sorry, I am not following you here. object_resolve_path() can create ob= jects? Hi Alexey, No, object_resolve_path() does not create objects, the point is that the = machine is created before, you only need to get it. You don't want to risk creati= ng a container.=20 >=20 >=20 > > What about the following on top? > >=20 > > Alexey, if we reach agreement here, this means for you that we can ju= st > > use type_register_static() in place of qemu_machine_register() to > > register your custom machine type with interface added. >=20 > I am perfectly fine with that, I just do not see what difference does i= t > make and why do you still keep qemu_machine_register() (or this is in t= he > plan already?)? It is in my plan to eliminate qemu_machine_register(), however it will take some time as it includes making changes to lots of files. For the moment, subclassing MachineClass and registering it to QOM will be exactly like calling qemu_machine_register(). Thanks, Marcel >=20 >=20 >=20 > > Regards, > > Andreas > >=20 > > diff --git a/hw/core/qdev.c b/hw/core/qdev.c > > index b6deebd..749c83a 100644 > > --- a/hw/core/qdev.c > > +++ b/hw/core/qdev.c > > @@ -861,7 +861,8 @@ Object *qdev_get_machine(void) > > static Object *dev; > >=20 > > if (dev =3D=3D NULL) { > > - dev =3D container_get(object_get_root(), "/machine"); > > + dev =3D object_resolve_path("/machine", NULL); > > + g_assert(dev); > > } > >=20 > > return dev; > >=20 > >=20 >=20 >=20