[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 2/2] qdev: Prepare "realized" property
From: |
Eduardo Habkost |
Subject: |
Re: [Qemu-devel] [PATCH v2 2/2] qdev: Prepare "realized" property |
Date: |
Mon, 7 Jan 2013 11:52:01 -0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Sun, Jan 06, 2013 at 07:48:42PM +0100, Andreas Färber wrote:
> Based on earlier patches by Paolo and me, introduce the QOM realizefn at
> device level only, as requested by Anthony.
>
> For now this just wraps the qdev initfn, which it deprecates.
>
> Signed-off-by: Paolo Bonzini <address@hidden>
> Signed-off-by: Andreas Färber <address@hidden>
> Cc: Anthony Liguori <address@hidden>
> ---
> hw/qdev-core.h | 4 +++
> hw/qdev.c | 96
> ++++++++++++++++++++++++++++++++++++++++++--------------
> 2 Dateien geändert, 76 Zeilen hinzugefügt(+), 24 Zeilen entfernt(-)
>
> diff --git a/hw/qdev-core.h b/hw/qdev-core.h
> index 5836e35..e50c866 100644
> --- a/hw/qdev-core.h
> +++ b/hw/qdev-core.h
> @@ -20,6 +20,8 @@ enum {
> typedef int (*qdev_initfn)(DeviceState *dev);
> typedef int (*qdev_event)(DeviceState *dev);
> typedef void (*qdev_resetfn)(DeviceState *dev);
> +typedef void (*DeviceRealize)(DeviceState *dev, Error **err);
> +typedef void (*DeviceUnrealize)(DeviceState *dev, Error **err);
>
> struct VMStateDescription;
>
> @@ -38,6 +40,8 @@ typedef struct DeviceClass {
> const struct VMStateDescription *vmsd;
>
> /* Private to qdev / bus. */
> + DeviceRealize realize;
> + DeviceUnrealize unrealize;
> qdev_initfn init;
Can we get the semantics of the realize/unrealize/init functions
documented here? For example, explicitly document that subclasses are
supposed to call the parent's realize function (this is the case,
right?), and the differences between DeviceState.init and
DeviceState.realize.
I took some time to understand the reason for DeviceState.realize to
exist when we already have DeviceState.init, and I am sure I already
forgot half of the explanation, and I will forget it completely in 1 or
2 months. :-)
> [...]
--
Eduardo