mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 06:43:53 -06:00
scsi: Fix migration of scsi sense data
c5f52875
changed the size of sense array in vmstate_scsi_device by
mistake. This patch restores the old size, and add a subsection for the
remaining part of the buffer size. So that migration is not broken.
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
22956a3755
commit
2e323f03bf
3 changed files with 33 additions and 1 deletions
|
@ -1905,6 +1905,26 @@ static const VMStateInfo vmstate_info_scsi_requests = {
|
|||
.put = put_scsi_requests,
|
||||
};
|
||||
|
||||
static bool scsi_sense_state_needed(void *opaque)
|
||||
{
|
||||
SCSIDevice *s = opaque;
|
||||
|
||||
return s->sense_len > SCSI_SENSE_BUF_SIZE_OLD;
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_scsi_sense_state = {
|
||||
.name = "SCSIDevice/sense",
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.minimum_version_id_old = 1,
|
||||
.fields = (VMStateField []) {
|
||||
VMSTATE_UINT8_SUB_ARRAY(sense, SCSIDevice,
|
||||
SCSI_SENSE_BUF_SIZE_OLD,
|
||||
SCSI_SENSE_BUF_SIZE - SCSI_SENSE_BUF_SIZE_OLD),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
const VMStateDescription vmstate_scsi_device = {
|
||||
.name = "SCSIDevice",
|
||||
.version_id = 1,
|
||||
|
@ -1915,7 +1935,7 @@ const VMStateDescription vmstate_scsi_device = {
|
|||
VMSTATE_UINT8(unit_attention.asc, SCSIDevice),
|
||||
VMSTATE_UINT8(unit_attention.ascq, SCSIDevice),
|
||||
VMSTATE_BOOL(sense_is_ua, SCSIDevice),
|
||||
VMSTATE_UINT8_ARRAY(sense, SCSIDevice, SCSI_SENSE_BUF_SIZE),
|
||||
VMSTATE_UINT8_SUB_ARRAY(sense, SCSIDevice, 0, SCSI_SENSE_BUF_SIZE_OLD),
|
||||
VMSTATE_UINT32(sense_len, SCSIDevice),
|
||||
{
|
||||
.name = "requests",
|
||||
|
@ -1927,6 +1947,14 @@ const VMStateDescription vmstate_scsi_device = {
|
|||
.offset = 0,
|
||||
},
|
||||
VMSTATE_END_OF_LIST()
|
||||
},
|
||||
.subsections = (VMStateSubsection []) {
|
||||
{
|
||||
.vmsd = &vmstate_scsi_sense_state,
|
||||
.needed = scsi_sense_state_needed,
|
||||
}, {
|
||||
/* empty */
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue