]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qdev: integrate vmstate
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 1 Sep 2009 07:56:14 +0000 (09:56 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Wed, 9 Sep 2009 19:57:20 +0000 (14:57 -0500)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/qdev.c
hw/qdev.h

index 675248fc124234cc3fcc2590f62221f824d8cdcd..6451b8a6d73c41a898d36b0a29b03b0d029ecd12 100644 (file)
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -221,12 +221,18 @@ int qdev_init(DeviceState *dev)
         return rc;
     if (dev->info->reset)
         qemu_register_reset(dev->info->reset, dev);
+    if (dev->info->vmsd)
+        vmstate_register(-1, dev->info->vmsd, dev);
     return 0;
 }
 
 /* Unlink device from bus and free the structure.  */
 void qdev_free(DeviceState *dev)
 {
+#if 0 /* FIXME: need sane vmstate_unregister function */
+    if (dev->info->vmsd)
+        vmstate_unregister(dev->info->vmsd, dev);
+#endif
     if (dev->info->reset)
         qemu_unregister_reset(dev->info->reset, dev);
     LIST_REMOVE(dev, sibling);
index b146aa14061bdad207949065a34e3e65df19a0d6..6d0d7f4f214264281c3b7d4cf3ec242e436d7823 100644 (file)
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -111,6 +111,9 @@ struct DeviceInfo {
     /* callbacks */
     QEMUResetHandler *reset;
 
+    /* device state */
+    const VMStateDescription *vmsd;
+
     /* Private to qdev / bus.  */
     qdev_initfn init;
     BusInfo *bus_info;