From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58521) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmkqG-0004HT-T6 for qemu-devel@nongnu.org; Thu, 15 Oct 2015 11:53:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmkqD-0003gP-L6 for qemu-devel@nongnu.org; Thu, 15 Oct 2015 11:53:20 -0400 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:48523) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmkqD-0003fX-BJ for qemu-devel@nongnu.org; Thu, 15 Oct 2015 11:53:17 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 15 Oct 2015 16:53:15 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 160C017D805A for ; Thu, 15 Oct 2015 16:53:18 +0100 (BST) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t9FFrB2T35061998 for ; Thu, 15 Oct 2015 15:53:11 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t9FFrB8L003603 for ; Thu, 15 Oct 2015 09:53:11 -0600 Date: Thu, 15 Oct 2015 17:53:08 +0200 From: Greg Kurz Message-ID: <20151015175308.13e9a861@bahia.local> In-Reply-To: <20151015171436.1fffe807.cornelia.huck@de.ibm.com> References: <20151012085708.10877.51489.stgit@bahia.huguette.org> <20151012090008.10877.13169.stgit@bahia.huguette.org> <20151015171436.1fffe807.cornelia.huck@de.ibm.com> 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: Cornelia Huck Cc: aneesh.kumar@linux.vnet.ibm.com, "Michael S. Tsirkin" , qemu-devel@nongnu.org, Andreas =?UTF-8?B?RsOkcmJlcg==?= , Alexander Graf On Thu, 15 Oct 2015 17:14:36 +0200 Cornelia Huck wrote: > 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. > It makes sense indeed. I'll do that for next version. > > + return; > > + } > > + > > qdev_hot_removed = true; > > > > hotplug_ctrl = qdev_get_hotplug_handler(dev);