[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 09/13] Add exit callback to DeviceInfo.
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 09/13] Add exit callback to DeviceInfo. |
Date: |
Thu, 24 Sep 2009 21:02:53 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) |
Gerd Hoffmann <address@hidden> writes:
> This adds a exit callback for device destruction to DeviceInfo, so
> we can hook cleanups into qdev device destruction.
>
> Followup patches will put that into use.
>
> Signed-off-by: Gerd Hoffmann <address@hidden>
> ---
> hw/qdev.c | 2 ++
> hw/qdev.h | 2 ++
> 2 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/hw/qdev.c b/hw/qdev.c
> index 4931da1..a25245a 100644
> --- a/hw/qdev.c
> +++ b/hw/qdev.c
> @@ -245,6 +245,8 @@ void qdev_free(DeviceState *dev)
> #endif
> if (dev->info->reset)
> qemu_unregister_reset(dev->info->reset, dev);
> + if (dev->info->exit)
> + dev->info->exit(dev);
> }
> QLIST_REMOVE(dev, sibling);
> qemu_free(dev);
> diff --git a/hw/qdev.h b/hw/qdev.h
> index c036aff..0db2d32 100644
> --- a/hw/qdev.h
> +++ b/hw/qdev.h
> @@ -107,6 +107,7 @@ BusState *qdev_get_child_bus(DeviceState *dev, const char
> *name);
> /*** Device API. ***/
>
> typedef int (*qdev_initfn)(DeviceState *dev, DeviceInfo *info);
> +typedef int (*qdev_exitfn)(DeviceState *dev);
>
> struct DeviceInfo {
> const char *name;
> @@ -124,6 +125,7 @@ struct DeviceInfo {
>
> /* Private to qdev / bus. */
> qdev_initfn init;
> + qdev_exitfn exit;
> BusInfo *bus_info;
> struct DeviceInfo *next;
> };
I don't like the name "exit". The buddy of init() is often called
fini().
- Re: [Qemu-devel] [PATCH 10/13] Implement scsi device destruction, (continued)
[Qemu-devel] [PATCH 12/13] pci: move unregister from PCIDevice to PCIDeviceInfo, Gerd Hoffmann, 2009/09/22
[Qemu-devel] [PATCH 09/13] Add exit callback to DeviceInfo., Gerd Hoffmann, 2009/09/22
[Qemu-devel] [PATCH 13/13] usb: hook unplug into qdev, cleanups + fixes., Gerd Hoffmann, 2009/09/22
[Qemu-devel] [PATCH 06/13] convert pci bridge to qdev, Gerd Hoffmann, 2009/09/22
[Qemu-devel] [PATCH 08/13] qdev: device free fixups., Gerd Hoffmann, 2009/09/22
[Qemu-devel] [PATCH 11/13] pci: use qdev for device destruction., Gerd Hoffmann, 2009/09/22