From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKWzj-0007a9-Cs for qemu-devel@nongnu.org; Mon, 03 Mar 2014 12:49:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WKWzc-0006TW-2T for qemu-devel@nongnu.org; Mon, 03 Mar 2014 12:49:39 -0500 Received: from cantor2.suse.de ([195.135.220.15]:42570 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKWzb-0006TR-Nm for qemu-devel@nongnu.org; Mon, 03 Mar 2014 12:49:31 -0500 Message-ID: <5314C0AA.4090001@suse.de> Date: Mon, 03 Mar 2014 18:49:30 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1393765632-2753-1-git-send-email-marcel.a@redhat.com> <1393765632-2753-2-git-send-email-marcel.a@redhat.com> In-Reply-To: <1393765632-2753-2-git-send-email-marcel.a@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 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: Marcel Apfelbaum , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, peter.crosthwaite@petalogix.com, ehabkost@redhat.com, mst@redhat.com, mtosatti@redhat.com, edgar.iglesias@gmail.com, mdroth@linux.vnet.ibm.com, 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, rth@twiddle.net Am 02.03.2014 14:07, schrieb Marcel Apfelbaum: > The main functionality change is to convert QEMUMachine into QemuMachin= eClass > and QEMUMachineInitArgs into QemuMachineState, instance of QemuMachineC= lass. 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. >=20 > As a first step, in order to make possible an incremental developement, "development" > both QEMUMachine and QEMUMachineInitArgs are being embeded into the "embedded" > 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 Cleaning up that trailing white line is good. Might it make sense to move the new line to above null-machine.o though? > 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 2014? > + * > + * Authors: > + * Marcel Apfelbaum > + * > + * This work is licensed under the terms of the GNU GPL, version 2 or = later. > + * See the COPYING file in the top-level directory. > + */ > + > +#include "hw/boards.h" > + > +static void qemu_machine_initfn(Object *obj) My preference would be to just use machine_ prefix. > +{ > +} > + > +static void qemu_machine_class_init(ObjectClass *oc, void *data) > +{ > +} No-op functions could be left out here and added once needed. > + > +static const TypeInfo qemu_machine_info =3D { > + .name =3D TYPE_QEMU_MACHINE, TYPE_MACHINE? > + .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) machine_register_types? > +{ > + type_register_static(&qemu_machine_info); > +} > + > +type_init(register_types); No semicolon needed. > 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 { /*< private >*/ > + ObjectClass parent_class; /*< public >*/ > + > + QEMUMachine *qemu_machine; > +}; > + > +/** > + * @QemuMachineState > + * > + * @parent: opaque parent object container > + */ > +struct QemuMachineState { > + /* private */ > + Object parent; > + /* public */ /*< ... >*/ is the gtk-doc syntax, and parent_obj please. > + > + Double white line intentional? > + 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 Regards, Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg