From 9bb1ec33d836d0c601feddb2eec14f1c6107148c Mon Sep 17 00:00:00 2001 From: Xiao Wang Date: Tue, 30 Aug 2011 06:40:56 -0300 Subject: [RHEL6 qemu-kvm PATCH 10/11] revert "floppy: save and restore DIR register" RH-Author: Xiao Wang Message-id: <20110830064055.25422.55047.stgit@dhcp-91-7.nay.redhat.com.englab.nay.redhat.com> Patchwork-id: 32037 O-Subject: [RHEL6.2 qemu-kvm V2 PATCH] revert "floppy: save and restore DIR register" Bugzilla: 718664 RH-Acked-by: Paolo Bonzini RH-Acked-by: Michael S. Tsirkin RH-Acked-by: Juan Quintela bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=718664 upstream: N/A, see notes brew build: https://brewweb.devel.redhat.com/taskinfo?taskID=3591217 test status: test migration between post/pre fix notes: 1 upstream propose a patch of completely revert which is sub-optimial for rhel as it may break the migration between pre and post fix. 2 as 6.0z is obseleted, not sure whether this bug is suitable for 6.2 or we can make it for 6.3 Patch "floppy: save and restore DIR register" would break the migration to old version as the subsection were sent almost every time. Instead of reverting it completely which could break the migration, this patch does the reverting by leave it as a subsection just for compability. This is done by letting .needed always return zero and using VM_STATE_UNUSED. With this patch applied, migration compability were kept and we were also ready for upstream fix. As this is in fact a revert, so we still need patches to save/store the DIR register during the migration by either bumpping the version or use another subsection. Signed-off-by: Jason Wang --- blockdev.c | 2 -- hw/fdc.c | 29 +++-------------------------- 2 files changed, 3 insertions(+), 28 deletions(-) Signed-off-by: Eduardo Habkost --- blockdev.c | 2 -- hw/fdc.c | 29 +++-------------------------- 2 files changed, 3 insertions(+), 28 deletions(-) diff --git a/blockdev.c b/blockdev.c index 88a7c64..a2df451 100644 --- a/blockdev.c +++ b/blockdev.c @@ -246,10 +246,8 @@ int drives_reopen(void) QTAILQ_FOREACH(dinfo, &drives, next) { if (dinfo->opened && !bdrv_is_read_only(dinfo->bdrv)) { int res; - int media_changed = dinfo->bdrv->media_changed; bdrv_close(dinfo->bdrv); res = drive_open(dinfo); - dinfo->bdrv->media_changed = media_changed; if (res) { fprintf(stderr, "qemu: re-open of %s failed wth error %d\n", dinfo->file, res); diff --git a/hw/fdc.c b/hw/fdc.c index 4848bb2..b5a9511 100644 --- a/hw/fdc.c +++ b/hw/fdc.c @@ -34,7 +34,6 @@ #include "sysbus.h" #include "qdev-addr.h" #include "sysemu.h" -#include "block_int.h" /********************************************************/ /* debug Floppy devices */ @@ -96,7 +95,6 @@ typedef struct fdrive_t { uint8_t max_track; /* Nb of tracks */ uint16_t bps; /* Bytes per sector */ uint8_t ro; /* Is read-only */ - uint8_t media_changed; /* Is media changed */ } fdrive_t; static void fd_init (fdrive_t *drv) @@ -633,30 +631,11 @@ static CPUWriteMemoryFunc * const fdctrl_mem_write_strict[3] = { NULL, }; -static void fdrive_media_changed_pre_save(void *opaque) -{ - fdrive_t *drive = opaque; - - drive->media_changed = drive->bs->media_changed; -} - -static int fdrive_media_changed_post_load(void *opaque, int version_id) -{ - fdrive_t *drive = opaque; - - if (drive->bs != NULL) { - drive->bs->media_changed = drive->media_changed; - } - - /* User ejected the floppy when drive->bs == NULL */ - return 0; -} static bool fdrive_media_changed_needed(void *opaque) { - fdrive_t *drive = opaque; - - return (drive->bs != NULL && drive->bs->media_changed != 1); + /* Do not send the subsection to maintain the compatibility */ + return 0; } static const VMStateDescription vmstate_fdrive_media_changed = { @@ -664,10 +643,8 @@ static const VMStateDescription vmstate_fdrive_media_changed = { .version_id = 1, .minimum_version_id = 1, .minimum_version_id_old = 1, - .pre_save = fdrive_media_changed_pre_save, - .post_load = fdrive_media_changed_post_load, .fields = (VMStateField[]) { - VMSTATE_UINT8(media_changed, fdrive_t), + VMSTATE_UNUSED(1), /* for compatibility */ VMSTATE_END_OF_LIST() } }; -- 1.7.3.2