qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org, Juan Quintela <quintela@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Markus Armbruster <armbru@redhat.com>
Subject: [Qemu-devel] [PATCH 5/5] vmstate: Add max_version_id field to VMStateDescription
Date: Mon, 14 Oct 2013 13:45:48 -0300	[thread overview]
Message-ID: <1381769148-22400-6-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1381769148-22400-1-git-send-email-ehabkost@redhat.com>

This will allow us to load data that has a high version_id, while using
a lower version_id when saving.

Useful in case we need to revert vmstate changes but keep compatibility
with QEMU versions that had a higher version_id.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/migration/vmstate.h | 1 +
 savevm.c                    | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 9d09e60..cc9dbb4 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -126,6 +126,7 @@ struct VMStateDescription {
     const char *name;
     int unmigratable;
     int version_id;
+    int max_version_id;
     int minimum_version_id;
     int minimum_version_id_old;
     LoadStateHandler *load_state_old;
diff --git a/savevm.c b/savevm.c
index 87773ad..89d20d0 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1679,7 +1679,7 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
     VMStateField *field;
     int ret;
 
-    if (version_id > vmsd->version_id) {
+    if (version_id > MAX(vmsd->version_id, vmsd->max_version_id)) {
         return -EINVAL;
     }
     if (version_id < vmsd->minimum_version_id_old) {
-- 
1.8.3.1

      parent reply	other threads:[~2013-10-14 16:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-14 16:45 [Qemu-devel] [PATCH 0/5] vmstate: Add max_version_id field Eduardo Habkost
2013-10-14 16:45 ` [Qemu-devel] [PATCH 1/5] savevm: Coding style line length fix Eduardo Habkost
2013-10-14 16:45 ` [Qemu-devel] [PATCH 2/5] vmstate: Replace while (...) with for (...) Eduardo Habkost
2013-10-14 16:45 ` [Qemu-devel] [PATCH 3/5] vmstate: Simplify field-skipping load/save logic Eduardo Habkost
2013-10-15  8:01   ` Markus Armbruster
2013-10-15 12:12     ` Eduardo Habkost
2013-10-15 11:32   ` Paolo Bonzini
2013-10-14 16:45 ` [Qemu-devel] [PATCH 4/5] vmstate: Use version_id when saving Eduardo Habkost
2013-10-14 16:45 ` Eduardo Habkost [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=1381769148-22400-6-git-send-email-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=armbru@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /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).