[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 07/15] virtio-net: Incorporate a DeviceState pointer
From: |
Alex Williamson |
Subject: |
[Qemu-devel] [PATCH 07/15] virtio-net: Incorporate a DeviceState pointer and let savevm track instances |
Date: |
Wed, 23 Jun 2010 22:41:40 -0600 |
User-agent: |
StGIT/0.14.3 |
Stuff a pointer to the DeviceState into the VirtIONet structure so that
we can easily remove the vmstate entry later. Also, let vmstate track
the instance number (it should always be zero internally since the
device path should now be unique).
Signed-off-by: Alex Williamson <address@hidden>
---
hw/virtio-net.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index e9768e0..f41db45 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -60,6 +60,7 @@ typedef struct VirtIONet
uint8_t *macs;
} mac_table;
uint32_t *vlans;
+ DeviceState *qdev;
} VirtIONet;
/* TODO
@@ -890,7 +891,6 @@ static void virtio_net_vmstate_change(void *opaque, int
running, int reason)
VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf)
{
VirtIONet *n;
- static int virtio_net_id;
n = (VirtIONet *)virtio_common_init("virtio-net", VIRTIO_ID_NET,
sizeof(struct virtio_net_config),
@@ -923,7 +923,8 @@ VirtIODevice *virtio_net_init(DeviceState *dev, NICConf
*conf)
n->vlans = qemu_mallocz(MAX_VLAN >> 3);
- register_savevm(NULL, "virtio-net", virtio_net_id++, VIRTIO_NET_VM_VERSION,
+ n->qdev = dev;
+ register_savevm(dev, "virtio-net", -1, VIRTIO_NET_VM_VERSION,
virtio_net_save, virtio_net_load, n);
n->vmstate = qemu_add_vm_change_state_handler(virtio_net_vmstate_change,
n);
@@ -941,7 +942,7 @@ void virtio_net_exit(VirtIODevice *vdev)
qemu_purge_queued_packets(&n->nic->nc);
- unregister_savevm(NULL, "virtio-net", n);
+ unregister_savevm(n->qdev, "virtio-net", n);
qemu_free(n->mac_table.macs);
qemu_free(n->vlans);
- [Qemu-devel] [PATCH 00/15] Make migration work with hotplug, Alex Williamson, 2010/06/24
- [Qemu-devel] [PATCH 01/15] Remove uses of ram.last_offset (aka last_ram_offset), Alex Williamson, 2010/06/24
- [Qemu-devel] [PATCH 02/15] qdev: Add a get_dev_path() function to BusInfo, Alex Williamson, 2010/06/24
- [Qemu-devel] [PATCH 03/15] pci: Implement BusInfo.get_dev_path(), Alex Williamson, 2010/06/24
- [Qemu-devel] [PATCH 04/15] savevm: Add DeviceState param, Alex Williamson, 2010/06/24
- [Qemu-devel] [PATCH 05/15] savevm: Make use of DeviceState, Alex Williamson, 2010/06/24
- [Qemu-devel] [PATCH 06/15] eepro100: Add a dev field to eeprom new/free functions, Alex Williamson, 2010/06/24
- [Qemu-devel] [PATCH 07/15] virtio-net: Incorporate a DeviceState pointer and let savevm track instances,
Alex Williamson <=
- [Qemu-devel] [PATCH 08/15] qemu_ram_alloc: Add DeviceState and name parameters, Alex Williamson, 2010/06/24
- [Qemu-devel] [PATCH 10/15] savevm: Migrate RAM based on name/offset, Alex Williamson, 2010/06/24
- [Qemu-devel] [PATCH 09/15] ramblocks: Make use of DeviceState pointer and BusInfo.get_dev_path, Alex Williamson, 2010/06/24
- [Qemu-devel] [PATCH 11/15] savevm: Use RAM blocks for basis of migration, Alex Williamson, 2010/06/24
- [Qemu-devel] [PATCH 12/15] savevm: Create a new continue flag to avoid resending block name, Alex Williamson, 2010/06/24
- [Qemu-devel] [PATCH 13/15] qemu_ram_free: Implement it, Alex Williamson, 2010/06/24
- [Qemu-devel] [PATCH 14/15] pci: Free the space allocated for the option rom on removal, Alex Williamson, 2010/06/24