From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43359) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmkF1-00027F-6A for qemu-devel@nongnu.org; Thu, 15 Oct 2015 11:14:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmkEw-000482-70 for qemu-devel@nongnu.org; Thu, 15 Oct 2015 11:14:51 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:34796) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmkEv-00047C-R5 for qemu-devel@nongnu.org; Thu, 15 Oct 2015 11:14:46 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 15 Oct 2015 16:14:43 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id CE6F6219004D for ; Thu, 15 Oct 2015 16:14:37 +0100 (BST) Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t9FFEdRp33947702 for ; Thu, 15 Oct 2015 15:14:39 GMT Received: from d06av08.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t9FFEc23032106 for ; Thu, 15 Oct 2015 09:14:39 -0600 Date: Thu, 15 Oct 2015 17:14:36 +0200 From: Cornelia Huck Message-ID: <20151015171436.1fffe807.cornelia.huck@de.ibm.com> In-Reply-To: <20151012090008.10877.13169.stgit@bahia.huguette.org> References: <20151012085708.10877.51489.stgit@bahia.huguette.org> <20151012090008.10877.13169.stgit@bahia.huguette.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 2/5] qdev: add the HotUnpluggable handler List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz Cc: aneesh.kumar@linux.vnet.ibm.com, "Michael S. Tsirkin" , qemu-devel@nongnu.org, Andreas =?UTF-8?B?RsOkcmJlcg==?= , Alexander Graf On Mon, 12 Oct 2015 11:00:13 +0200 Greg Kurz 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 > --- > 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);