From patchwork Mon Oct 14 16:45:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 283348 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7B78E2C0345 for ; Tue, 15 Oct 2013 03:46:47 +1100 (EST) Received: from localhost ([::1]:37965 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVlI5-00067X-8N for incoming@patchwork.ozlabs.org; Mon, 14 Oct 2013 12:46:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49144) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVlHV-0005vU-FI for qemu-devel@nongnu.org; Mon, 14 Oct 2013 12:46:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VVlHP-0008KL-9u for qemu-devel@nongnu.org; Mon, 14 Oct 2013 12:46:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13252) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVlHP-0008KB-23 for qemu-devel@nongnu.org; Mon, 14 Oct 2013 12:46:03 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9EGk2SO016742 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 14 Oct 2013 12:46:02 -0400 Received: from localhost (vpn1-5-101.gru2.redhat.com [10.97.5.101]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r9EGk1c9022768; Mon, 14 Oct 2013 12:46:01 -0400 From: Eduardo Habkost To: qemu-devel@nongnu.org, Juan Quintela Date: Mon, 14 Oct 2013 13:45:48 -0300 Message-Id: <1381769148-22400-6-git-send-email-ehabkost@redhat.com> In-Reply-To: <1381769148-22400-1-git-send-email-ehabkost@redhat.com> References: <1381769148-22400-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Paolo Bonzini , Markus Armbruster Subject: [Qemu-devel] [PATCH 5/5] vmstate: Add max_version_id field to VMStateDescription X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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) {