From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49468) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLh0f-0005mu-4N for qemu-devel@nongnu.org; Thu, 06 Mar 2014 17:43:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLh0Z-0005NW-7o for qemu-devel@nongnu.org; Thu, 06 Mar 2014 17:43:25 -0500 Received: from cantor2.suse.de ([195.135.220.15]:55185 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLh0Y-0005NN-SE for qemu-devel@nongnu.org; Thu, 06 Mar 2014 17:43:19 -0500 Message-ID: <5318FA02.8020007@suse.de> Date: Thu, 06 Mar 2014 23:43:14 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1394040647-20083-1-git-send-email-marcel.a@redhat.com> <1394040647-20083-2-git-send-email-marcel.a@redhat.com> In-Reply-To: <1394040647-20083-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 v3 1/3] 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: ehabkost@redhat.com, mst@redhat.com, armbru@redhat.com, lcapitulino@redhat.com, blauwirbel@gmail.com, aliguori@amazon.com, pbonzini@redhat.com, imammedo@redhat.com Am 05.03.2014 18:30, schrieb Marcel Apfelbaum: > The main functionality change is to convert QEMUMachine into MachineCla= ss > and QEMUMachineInitArgs into MachineState, instance of MachineClass. >=20 > As a first step, in order to make possible an incremental development, > both QEMUMachine and QEMUMachineInitArgs are being embedded into the > new types. >=20 > Reviewed-by: Michael S. Tsirkin > Signed-off-by: Marcel Apfelbaum > --- > hw/core/Makefile.objs | 2 +- > hw/core/machine.c | 28 +++++++++++++++++++++++++++ > include/hw/boards.h | 53 +++++++++++++++++++++++++++++++++++++++++++= ++++++++ > 3 files changed, 82 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..981593c 100644 > --- a/hw/core/Makefile.objs > +++ b/hw/core/Makefile.objs > @@ -8,7 +8,7 @@ common-obj-$(CONFIG_EMPTY_SLOT) +=3D empty_slot.o > common-obj-$(CONFIG_XILINX_AXI) +=3D stream.o > common-obj-$(CONFIG_PTIMER) +=3D ptimer.o > common-obj-$(CONFIG_SOFTMMU) +=3D sysbus.o > +common-obj-$(CONFIG_SOFTMMU) +=3D machine.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 > - > diff --git a/hw/core/machine.c b/hw/core/machine.c > new file mode 100644 > index 0000000..d3ffef7 > --- /dev/null > +++ b/hw/core/machine.c > @@ -0,0 +1,28 @@ > +/* > + * QEMU Machine > + * > + * Copyright (C) 2014 Red Hat Inc > + * > + * 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 const TypeInfo machine_info =3D { > + .name =3D TYPE_MACHINE, > + .parent =3D TYPE_OBJECT, > + .abstract =3D true, > + .class_size =3D sizeof(MachineClass), > + .instance_size =3D sizeof(MachineState), > +}; > + > +static void machine_register_types(void) > +{ > + type_register_static(&machine_info); > +} > + > +type_init(machine_register_types) > diff --git a/include/hw/boards.h b/include/hw/boards.h > index 2151460..15df78e 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,56 @@ QEMUMachine *find_default_machine(void); > =20 > extern QEMUMachine *current_machine; > =20 > +#define TYPE_MACHINE "machine" > +#define MACHINE(obj) \ > + OBJECT_CHECK(MachineState, (obj), TYPE_MACHINE) > +#define MACHINE_GET_CLASS(obj) \ > + OBJECT_GET_CLASS(MachineClass, (obj), TYPE_MACHINE) > +#define MACHINE_CLASS(klass) \ > + OBJECT_CLASS_CHECK(MachineClass, (klass), TYPE_MACHINE) > + > +typedef struct MachineState MachineState; > +typedef struct MachineClass MachineClass; > + > +/** > + * @MachineClass "MachineClass:" > + * > + * @parent_class: opaque parent class container > + */ > +struct MachineClass { > + /*< private >*/ > + ObjectClass parent_class; The very purpose of < private > is to suppress this field from documentation, so you don't need to document it. > + /*< public >*/ > + > + QEMUMachine *qemu_machine; > +}; > + > +/** > + * @MachineState > + * > + * @parent_obj: opaque parent object container > + */ > +struct MachineState { > + /*< private >*/ > + Object parent_obj; > + /*< public >*/ > + > + 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 Thanks, applied to qom-next with gtk-doc changes: https://github.com/afaerber/qemu-cpu/commits/qom-next Andreas diff --git a/include/hw/boards.h b/include/hw/boards.h index 15df78e..cb94db1 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -66,9 +66,8 @@ typedef struct MachineState MachineState; typedef struct MachineClass MachineClass; /** - * @MachineClass - * - * @parent_class: opaque parent class container + * MachineClass: + * @qemu_machine: #QEMUMachine */ struct MachineClass { /*< private >*/ @@ -79,9 +78,7 @@ struct MachineClass { }; /** - * @MachineState - * - * @parent_obj: opaque parent object container + * MachineState: */ struct MachineState { /*< private >*/ --=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