qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 1/3] hw/core: introduced qemu machine as QOM


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH v3 1/3] hw/core: introduced qemu machine as QOM object
Date: Thu, 06 Mar 2014 23:43:14 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

Am 05.03.2014 18:30, schrieb Marcel Apfelbaum:
> The main functionality change is to convert QEMUMachine into MachineClass
> and QEMUMachineInitArgs into MachineState, instance of MachineClass.
> 
> As a first step, in order to make possible an incremental development,
> both QEMUMachine and QEMUMachineInitArgs are being embedded into the
> new types.
> 
> Reviewed-by: Michael S. Tsirkin <address@hidden>
> Signed-off-by: Marcel Apfelbaum <address@hidden>
> ---
>  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
> 
> 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) += empty_slot.o
>  common-obj-$(CONFIG_XILINX_AXI) += stream.o
>  common-obj-$(CONFIG_PTIMER) += ptimer.o
>  common-obj-$(CONFIG_SOFTMMU) += sysbus.o
> +common-obj-$(CONFIG_SOFTMMU) += machine.o
>  common-obj-$(CONFIG_SOFTMMU) += null-machine.o
>  common-obj-$(CONFIG_SOFTMMU) += loader.o
>  common-obj-$(CONFIG_SOFTMMU) += 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 <address@hidden>
> + *
> + * 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 = {
> +    .name = TYPE_MACHINE,
> +    .parent = TYPE_OBJECT,
> +    .abstract = true,
> +    .class_size = sizeof(MachineClass),
> +    .instance_size = 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 @@
>  
>  #include "sysemu/blockdev.h"
>  #include "hw/qdev.h"
> +#include "qom/object.h"
>  
>  typedef struct QEMUMachine QEMUMachine;
>  
> @@ -53,4 +54,56 @@ QEMUMachine *find_default_machine(void);
>  
>  extern QEMUMachine *current_machine;
>  
> +#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 >*/



-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]