From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKYBf-0001cq-3M for qemu-devel@nongnu.org; Mon, 03 Mar 2014 14:06:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WKYBZ-0007eR-2y for qemu-devel@nongnu.org; Mon, 03 Mar 2014 14:06:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:9080) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKYBY-0007eF-R6 for qemu-devel@nongnu.org; Mon, 03 Mar 2014 14:05:57 -0500 Message-ID: <1393873561.3882.46.camel@localhost.localdomain> From: Marcel Apfelbaum Date: Mon, 03 Mar 2014 21:06:01 +0200 In-Reply-To: <5314C0AA.4090001@suse.de> References: <1393765632-2753-1-git-send-email-marcel.a@redhat.com> <1393765632-2753-2-git-send-email-marcel.a@redhat.com> <5314C0AA.4090001@suse.de> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH RFC V2 1/9] hw/core: introduced qemu machine as QOM object List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?ISO-8859-1?Q?F=E4rber?= Cc: peter.maydell@linaro.org, peter.crosthwaite@petalogix.com, mdroth@linux.vnet.ibm.com, mst@redhat.com, rth@twiddle.net, mtosatti@redhat.com, edgar.iglesias@gmail.com, qemu-devel@nongnu.org, armbru@redhat.com, blauwirbel@gmail.com, quintela@redhat.com, agraf@suse.de, aliguori@amazon.com, pbonzini@redhat.com, scottwood@freescale.com, imammedo@redhat.com, lcapitulino@redhat.com, ehabkost@redhat.com On Mon, 2014-03-03 at 18:49 +0100, Andreas F=C3=A4rber wrote: > Am 02.03.2014 14:07, schrieb Marcel Apfelbaum: > > The main functionality change is to convert QEMUMachine into QemuMach= ineClass > > and QEMUMachineInitArgs into QemuMachineState, instance of QemuMachin= eClass. >=20 > I wonder why go from QEMUMachine* to QemuMachine*? I don't spot a name > clash, and keeping QEMU like we use PCI or USB would make the correct > spelling clearer. Well, it was mostly a "conservative" choice, but MachineClass/MachineStat= e sounds great to me, I am going to replace them, thanks! >=20 > >=20 > > As a first step, in order to make possible an incremental developemen= t, >=20 > "development" Oops >=20 > > both QEMUMachine and QEMUMachineInitArgs are being embeded into the >=20 > "embedded" Another oops, I usually run a spelling cycle before sending, I'll be more careful, thanks. =20 >=20 > > new types. > >=20 > > Signed-off-by: Marcel Apfelbaum > > --- > > hw/core/Makefile.objs | 2 +- > > hw/core/machine.c | 38 +++++++++++++++++++++++++++++++++++++ > > include/hw/boards.h | 52 +++++++++++++++++++++++++++++++++++++++++= ++++++++++ > > 3 files changed, 91 insertions(+), 1 deletion(-) > > create mode 100644 hw/core/machine.c > >=20 > > diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs > > index 9e324be..f80c13c 100644 > > --- a/hw/core/Makefile.objs > > +++ b/hw/core/Makefile.objs > > @@ -11,4 +11,4 @@ common-obj-$(CONFIG_SOFTMMU) +=3D sysbus.o > > common-obj-$(CONFIG_SOFTMMU) +=3D null-machine.o > > common-obj-$(CONFIG_SOFTMMU) +=3D loader.o > > common-obj-$(CONFIG_SOFTMMU) +=3D qdev-properties-system.o > > - > > +common-obj-$(CONFIG_SOFTMMU) +=3D machine.o >=20 > Cleaning up that trailing white line is good. Might it make sense to > move the new line to above null-machine.o though? >=20 > > diff --git a/hw/core/machine.c b/hw/core/machine.c > > new file mode 100644 > > index 0000000..2c6e1a3 > > --- /dev/null > > +++ b/hw/core/machine.c > > @@ -0,0 +1,38 @@ > > +/* > > + * QEMU Machine > > + * > > + * Copyright (C) 2013 Red Hat Inc >=20 > 2014? Yes it is :) , maybe I started a draft on December? I'll update, of cours= e. >=20 > > + * > > + * Authors: > > + * Marcel Apfelbaum > > + * > > + * This work is licensed under the terms of the GNU GPL, version 2 o= r later. > > + * See the COPYING file in the top-level directory. > > + */ > > + > > +#include "hw/boards.h" > > + > > +static void qemu_machine_initfn(Object *obj) >=20 > My preference would be to just use machine_ prefix. Removing the "qemu" when not necessary, sure. >=20 > > +{ > > +} > > + > > +static void qemu_machine_class_init(ObjectClass *oc, void *data) > > +{ > > +} >=20 > No-op functions could be left out here and added once needed. Go it. >=20 > > + > > +static const TypeInfo qemu_machine_info =3D { > > + .name =3D TYPE_QEMU_MACHINE, >=20 > TYPE_MACHINE? Sure, I'll replace. >=20 > > + .parent =3D TYPE_OBJECT, > > + .abstract =3D true, > > + .class_size =3D sizeof(QemuMachineClass), > > + .class_init =3D qemu_machine_class_init, > > + .instance_size =3D sizeof(QemuMachineState), > > + .instance_init =3D qemu_machine_initfn, > > +}; > > + > > +static void register_types(void) >=20 > machine_register_types? OK >=20 > > +{ > > + type_register_static(&qemu_machine_info); > > +} > > + > > +type_init(register_types); >=20 > No semicolon needed. OK >=20 > > diff --git a/include/hw/boards.h b/include/hw/boards.h > > index 2151460..7b4708d 100644 > > --- a/include/hw/boards.h > > +++ b/include/hw/boards.h > > @@ -5,6 +5,7 @@ > > =20 > > #include "sysemu/blockdev.h" > > #include "hw/qdev.h" > > +#include "qom/object.h" > > =20 > > typedef struct QEMUMachine QEMUMachine; > > =20 > > @@ -53,4 +54,55 @@ QEMUMachine *find_default_machine(void); > > =20 > > extern QEMUMachine *current_machine; > > =20 > > +#define TYPE_QEMU_MACHINE "machine" > > +#define QEMU_MACHINE(obj) \ > > + OBJECT_CHECK(QemuMachineState, (obj), TYPE_QEMU_MACHINE) > > +#define QEMU_MACHINE_GET_CLASS(obj) \ > > + OBJECT_GET_CLASS(QemuMachineClass, (obj), TYPE_QEMU_MACHINE) > > +#define QEMU_MACHINE_CLASS(klass) \ > > + OBJECT_CLASS_CHECK(QemuMachineClass, (klass), TYPE_QEMU_MACHINE) > > + > > +typedef struct QemuMachineState QemuMachineState; > > +typedef struct QemuMachineClass QemuMachineClass; > > + > > +/** > > + * @QemuMachineClass > > + * > > + * @parent_class: opaque parent class container > > + */ > > +struct QemuMachineClass { >=20 > /*< private >*/ >=20 > > + ObjectClass parent_class; >=20 > /*< public >*/ OK >=20 > > + > > + QEMUMachine *qemu_machine; > > +}; > > + > > +/** > > + * @QemuMachineState > > + * > > + * @parent: opaque parent object container > > + */ > > +struct QemuMachineState { > > + /* private */ > > + Object parent; > > + /* public */ >=20 > /*< ... >*/ is the gtk-doc syntax, and parent_obj please. Sure, I've kind of took this from another QOM object, picked=20 the wrong one to follow, I'll change, thanks for the tip. >=20 > > + > > + >=20 > Double white line intentional? Yes, prefer one? I saw this double line in a few places. >=20 > > + char *accel; > > + bool kernel_irqchip; > > + int kvm_shadow_mem; > > + char *kernel; > > + char *initrd; > > + char *append; > > + char *dtb; > > + char *dumpdtb; > > + int phandle_start; > > + char *dt_compatible; > > + bool dump_guest_core; > > + bool mem_merge; > > + bool usb; > > + char *firmware; > > + > > + QEMUMachineInitArgs init_args; > > +}; > > + > > #endif > >=20 >=20 Thanks for the thorough review! Marcel > Regards, > Andreas >=20