|
|
9ae3a8 |
From fed60f16a54ee6689b6c03025bbe4704a8e4b251 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 23 Jan 2014 14:03:36 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 09/14] virtio-net: switch exit callback to VirtioDeviceClass
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1390485820-7585-7-git-send-email-armbru@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 56926
|
|
|
9ae3a8 |
O-Subject: [PATCH 7.0 qemu-kvm 06/10] virtio-net: switch exit callback to VirtioDeviceClass
|
|
|
9ae3a8 |
Bugzilla: 983344
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
This ensures hot-unplug is handled properly by the proxy, and avoids
|
|
|
9ae3a8 |
leaking bus_name which is freed by virtio_device_exit.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Cc: qemu-stable@nongnu.org
|
|
|
9ae3a8 |
Acked-by: Andreas Faerber <afaerber@suse.de>
|
|
|
9ae3a8 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 3786cff5eb384d058395a2729af627fa3253d056)
|
|
|
9ae3a8 |
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/net/virtio-net.c | 11 ++++-------
|
|
|
9ae3a8 |
1 file changed, 4 insertions(+), 7 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/net/virtio-net.c | 11 ++++-------
|
|
|
9ae3a8 |
1 files changed, 4 insertions(+), 7 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
|
|
|
9ae3a8 |
index 21b126f..06c53fe 100644
|
|
|
9ae3a8 |
--- a/hw/net/virtio-net.c
|
|
|
9ae3a8 |
+++ b/hw/net/virtio-net.c
|
|
|
9ae3a8 |
@@ -1506,16 +1506,15 @@ static int virtio_net_device_init(VirtIODevice *vdev)
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int virtio_net_device_exit(DeviceState *qdev)
|
|
|
9ae3a8 |
+static void virtio_net_device_exit(VirtIODevice *vdev)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
- VirtIONet *n = VIRTIO_NET(qdev);
|
|
|
9ae3a8 |
- VirtIODevice *vdev = VIRTIO_DEVICE(qdev);
|
|
|
9ae3a8 |
+ VirtIONet *n = VIRTIO_NET(vdev);
|
|
|
9ae3a8 |
int i;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
/* This will stop vhost backend if appropriate. */
|
|
|
9ae3a8 |
virtio_net_set_status(vdev, 0);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- unregister_savevm(qdev, "virtio-net", n);
|
|
|
9ae3a8 |
+ unregister_savevm(DEVICE(vdev), "virtio-net", n);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (n->netclient_name) {
|
|
|
9ae3a8 |
g_free(n->netclient_name);
|
|
|
9ae3a8 |
@@ -1546,8 +1545,6 @@ static int virtio_net_device_exit(DeviceState *qdev)
|
|
|
9ae3a8 |
g_free(n->vqs);
|
|
|
9ae3a8 |
qemu_del_nic(n->nic);
|
|
|
9ae3a8 |
virtio_cleanup(vdev);
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static void virtio_net_instance_init(Object *obj)
|
|
|
9ae3a8 |
@@ -1574,10 +1571,10 @@ static void virtio_net_class_init(ObjectClass *klass, void *data)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
DeviceClass *dc = DEVICE_CLASS(klass);
|
|
|
9ae3a8 |
VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
|
|
|
9ae3a8 |
- dc->exit = virtio_net_device_exit;
|
|
|
9ae3a8 |
dc->props = virtio_net_properties;
|
|
|
9ae3a8 |
set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
|
|
|
9ae3a8 |
vdc->init = virtio_net_device_init;
|
|
|
9ae3a8 |
+ vdc->exit = virtio_net_device_exit;
|
|
|
9ae3a8 |
vdc->get_config = virtio_net_get_config;
|
|
|
9ae3a8 |
vdc->set_config = virtio_net_set_config;
|
|
|
9ae3a8 |
vdc->get_features = virtio_net_get_features;
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|