Received: from eggs.gnu.org ([2001:4830:134:3::10]:59594) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHwuW-0000kW-Jn for qemu-devel@nongnu.org; Tue, 28 Jun 2016 13:34:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHwuU-00038D-JT for qemu-devel@nongnu.org; Tue, 28 Jun 2016 13:34:55 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:32838) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHwuU-000385-CX for qemu-devel@nongnu.org; Tue, 28 Jun 2016 13:34:54 -0400 Received: by mail-wm0-x241.google.com with SMTP id r201so7671172wme.0 for ; Tue, 28 Jun 2016 10:34:54 -0700 (PDT) Received: from donizetti.lan (94-39-188-118.adsl-ull.clienti.tiscali.it. [94.39.188.118]) by smtp.gmail.com with ESMTPSA id c142sm5305wme.18.2016.06.28.10.34.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jun 2016 10:34:51 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 28 Jun 2016 19:33:47 +0200 Message-Id: <1467135242-874-18-git-send-email-pbonzini@redhat.com> In-Reply-To: <1467135242-874-1-git-send-email-pbonzini@redhat.com> References: <1467135242-874-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 17/32] scsi: esp: fix migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Commit 926cde5 ("scsi: esp: make cmdbuf big enough for maximum CDB size", 2016-06-16) changed the size of a migrated field. Split it in two parts, and only migrate the second part in a new vmstate version. Signed-off-by: Paolo Bonzini --- hw/scsi/esp.c | 5 +++-- include/migration/vmstate.h | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index baa0a2c..1f2f2d3 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -574,7 +574,7 @@ static bool esp_mem_accepts(void *opaque, hwaddr addr, const VMStateDescription vmstate_esp = { .name ="esp", - .version_id = 3, + .version_id = 4, .minimum_version_id = 3, .fields = (VMStateField[]) { VMSTATE_BUFFER(rregs, ESPState), @@ -585,7 +585,8 @@ const VMStateDescription vmstate_esp = { VMSTATE_BUFFER(ti_buf, ESPState), VMSTATE_UINT32(status, ESPState), VMSTATE_UINT32(dma, ESPState), - VMSTATE_BUFFER(cmdbuf, ESPState), + VMSTATE_PARTIAL_BUFFER(cmdbuf, ESPState, 16), + VMSTATE_BUFFER_START_MIDDLE_V(cmdbuf, ESPState, 16, 4), VMSTATE_UINT32(cmdlen, ESPState), VMSTATE_UINT32(do_cmd, ESPState), VMSTATE_UINT32(dma_left, ESPState), diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 25ea58a..15ea767 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -904,8 +904,11 @@ extern const VMStateInfo vmstate_info_bitmap; #define VMSTATE_PARTIAL_BUFFER(_f, _s, _size) \ VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, 0, _size) +#define VMSTATE_BUFFER_START_MIDDLE_V(_f, _s, _start, _v) \ + VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, _start, sizeof(typeof_field(_s, _f))) + #define VMSTATE_BUFFER_START_MIDDLE(_f, _s, _start) \ - VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, _start, sizeof(typeof_field(_s, _f))) + VMSTATE_BUFFER_START_MIDDLE_V(_f, _s, _start, 0) #define VMSTATE_PARTIAL_VBUFFER(_f, _s, _size) \ VMSTATE_VBUFFER(_f, _s, 0, NULL, 0, _size) -- 2.7.4