From patchwork Fri Nov 29 10:17:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 295272 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0DE5C2C00C7 for ; Fri, 29 Nov 2013 22:22:09 +1100 (EST) Received: from localhost ([::1]:46573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VmLEr-0006MJ-Tm for incoming@patchwork.ozlabs.org; Fri, 29 Nov 2013 05:23:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53396) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VmL9G-0005j0-7M for qemu-devel@nongnu.org; Fri, 29 Nov 2013 05:18:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VmL9A-0004BT-EB for qemu-devel@nongnu.org; Fri, 29 Nov 2013 05:18:10 -0500 Received: from mail-ea0-x22f.google.com ([2a00:1450:4013:c01::22f]:36529) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VmL9A-0004BI-7i; Fri, 29 Nov 2013 05:18:04 -0500 Received: by mail-ea0-f175.google.com with SMTP id z10so6563453ead.20 for ; Fri, 29 Nov 2013 02:18:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=tRfu3N0KI9wz4oFrZhdS8YY5tEsFDE1ec0NQ4JX8P1Q=; b=FJ+ISYo9WueVDA3SR1KqtAp0jL8f7AxMRFG7gTijTllBgrX6IwvOqX17ugy4Z69ZFx 7X+9Y43+niIpN+yyZnZvbL+UFxgi1I6xc079fGEmkOusGQCmd9xwizUzlof/0tJqH7QR O1dgccl/MRu5AbrWiYyBErRwtzN5cvyOjii59guZzYx0K+cadmd3gY7ys5zao1lFZ+tQ Y9e6mniMeyWE7tMOAFPsRePUNmfQXZsY1jjCgwV5qPklJEBboc89v7MkRUUiW4yF2gdd zrKAW52SBCaDWLIfmX6eIeZg+MqG+iPjE7+Cpdg/IaOCnmNuhw0apa1UyVDLgnewEZ+v Xh1A== X-Received: by 10.14.184.200 with SMTP id s48mr1717620eem.72.1385720283355; Fri, 29 Nov 2013 02:18:03 -0800 (PST) Received: from playground.lan (net-37-117-137-113.cust.dsl.vodafone.it. [37.117.137.113]) by mx.google.com with ESMTPSA id b42sm39055362eem.9.2013.11.29.02.18.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Nov 2013 02:18:02 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 29 Nov 2013 11:17:18 +0100 Message-Id: <1385720262-14107-7-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1385720262-14107-1-git-send-email-pbonzini@redhat.com> References: <1385720262-14107-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::22f Cc: qemu-stable@nongnu.org, afaerber@suse.de, mst@redhat.com Subject: [Qemu-devel] [PATCH 06/30] virtio-blk: switch exit callback to VirtioDeviceClass X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This ensures hot-unplug is handled properly by the proxy. Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini --- hw/block/virtio-blk.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 13f6d82..7f0440f 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -728,20 +728,18 @@ static int virtio_blk_device_init(VirtIODevice *vdev) return 0; } -static int virtio_blk_device_exit(DeviceState *dev) +static void virtio_blk_device_exit(VirtIODevice *vdev) { - VirtIODevice *vdev = VIRTIO_DEVICE(dev); - VirtIOBlock *s = VIRTIO_BLK(dev); + VirtIOBlock *s = VIRTIO_BLK(vdev); #ifdef CONFIG_VIRTIO_BLK_DATA_PLANE remove_migration_state_change_notifier(&s->migration_state_notifier); virtio_blk_data_plane_destroy(s->dataplane); s->dataplane = NULL; #endif qemu_del_vm_change_state_handler(s->change); - unregister_savevm(dev, "virtio-blk", s); + unregister_savevm(DEVICE(vdev), "virtio-blk", s); blockdev_mark_auto_del(s->bs); virtio_cleanup(vdev); - return 0; } static Property virtio_blk_properties[] = { @@ -753,10 +751,10 @@ static void virtio_blk_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass); - dc->exit = virtio_blk_device_exit; dc->props = virtio_blk_properties; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); vdc->init = virtio_blk_device_init; + vdc->exit = virtio_blk_device_exit; vdc->get_config = virtio_blk_update_config; vdc->set_config = virtio_blk_set_config; vdc->get_features = virtio_blk_get_features;