qemu-devel
[Top][All Lists]
Advanced

[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);




reply via email to

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