qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 4/3] vmstate: complain about devices without vmstate
Date: Fri,  8 Jul 2011 15:43:57 +0200	[thread overview]
Message-ID: <1310132637-20611-1-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1310115239-19288-1-git-send-email-kraxel@redhat.com>

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/hw.h   |    2 ++
 hw/qdev.c |    7 ++++++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/hw/hw.h b/hw/hw.h
index 1eb3486..6d6c493 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -336,6 +336,8 @@ struct VMStateDescription {
     const VMStateSubsection *subsections;
 };
 
+#define VMSD_NONE ((const VMStateDescription*)1)
+
 extern const VMStateInfo vmstate_info_bool;
 
 extern const VMStateInfo vmstate_info_int8;
diff --git a/hw/qdev.c b/hw/qdev.c
index 292b52f..fafbbae 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -283,7 +283,12 @@ int qdev_init(DeviceState *dev)
         qdev_free(dev);
         return rc;
     }
-    if (dev->info->vmsd) {
+    if (dev->info->vmsd == NULL) {
+        /* TODO: fixup qemu source code, then make this an assert() */
+        error_report("WARNING: device %s has no vmstate\n", dev->info->name);
+    } else if (dev->info->vmsd == VMSD_NONE) {
+        /* device doesn't need vmstate */;
+    } else {
         vmstate_register_with_alias_id(dev, -1, dev->info->vmsd, dev,
                                        dev->instance_id_alias,
                                        dev->alias_required_for_version);
-- 
1.7.1

      parent reply	other threads:[~2011-07-08 13:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-08  8:53 [Qemu-devel] [PATCH 0/3] non-migratable devices Gerd Hoffmann
2011-07-08  8:53 ` [Qemu-devel] [PATCH 1/3] vmstate: add no_migrate flag to VMStateDescription Gerd Hoffmann
2011-07-08 14:26   ` Anthony Liguori
2011-07-08 15:44     ` Gerd Hoffmann
2011-07-08 16:04       ` Gerd Hoffmann
2011-07-08 17:07         ` Anthony Liguori
2011-07-11  6:29           ` Gerd Hoffmann
2011-07-08  8:53 ` [Qemu-devel] [PATCH 2/3] ahci doesn't support migration Gerd Hoffmann
2011-07-08  8:53 ` [Qemu-devel] [PATCH 3/3] ehci " Gerd Hoffmann
2011-07-08  9:54 ` [Qemu-devel] [PATCH 0/3] non-migratable devices Paolo Bonzini
2011-07-08  9:59   ` Gerd Hoffmann
2011-07-08 10:17     ` Paolo Bonzini
2011-07-08 11:47       ` Gerd Hoffmann
2011-07-08 12:05         ` Paolo Bonzini
2011-07-08 12:47           ` Gerd Hoffmann
2011-07-08 12:59             ` Paolo Bonzini
2011-07-08 13:21               ` Gerd Hoffmann
2011-07-08 11:45     ` Markus Armbruster
2011-07-08 13:43 ` Gerd Hoffmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1310132637-20611-1-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).