[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 2/5] qdev: add the HotUnpluggable handler
From: |
Cornelia Huck |
Subject: |
Re: [Qemu-devel] [PATCH v2 2/5] qdev: add the HotUnpluggable handler |
Date: |
Thu, 15 Oct 2015 17:14:36 +0200 |
On Mon, 12 Oct 2015 11:00:13 +0200
Greg Kurz <address@hidden> wrote:
> This handler allows to ask a device instance if it can be hot-unplugged. It
> is to be defined in device classes where hot-unpluggability depends on the
> device state (for example, virtio-9p devices cannot be unplugged if the 9p
> share is mounted in the guest).
>
> Signed-off-by: Greg Kurz <address@hidden>
> ---
> hw/core/qdev.c | 4 ++++
> include/hw/qdev-core.h | 4 ++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 4ab04aa31e78..2b2339c7c6ad 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -287,6 +287,10 @@ void qdev_unplug(DeviceState *dev, Error **errp)
> return;
> }
>
> + if (dc->unpluggable && !dc->unpluggable(dev, errp)) {
I think I'd prefer something like "unplug_is_blocked" or so. Makes it
more obvious that this is something that is rather the exception.
> + return;
> + }
> +
> qdev_hot_removed = true;
>
> hotplug_ctrl = qdev_get_hotplug_handler(dev);
- [Qemu-devel] [PATCH v2 0/5] virtio-9p: hotplug and migration support, Greg Kurz, 2015/10/12
- [Qemu-devel] [PATCH v2 1/5] virtio-9p-coth: fix init function, Greg Kurz, 2015/10/12
- [Qemu-devel] [PATCH v2 2/5] qdev: add the HotUnpluggable handler, Greg Kurz, 2015/10/12
- Re: [Qemu-devel] [PATCH v2 2/5] qdev: add the HotUnpluggable handler,
Cornelia Huck <=
- [Qemu-devel] [PATCH v2 3/5] virtio-9p: block hot-unplug when device is active, Greg Kurz, 2015/10/12
- [Qemu-devel] [PATCH v2 4/5] virtio-9p: add unrealize handler, Greg Kurz, 2015/10/12
- [Qemu-devel] [PATCH v2 5/5] virtio-9p: add savem handlers, Greg Kurz, 2015/10/12