Patchwork [v2,6/6] atapi: Save / load the new GESN event states during migration

login
register
mail settings
Submitter Amit Shah
Date April 12, 2011, 9:27 a.m.
Message ID <618d52d111bc5657efc46d78e76f15c80d077ac4.1302600061.git.amit.shah@redhat.com>
Download mbox | patch
Permalink /patch/90754/
State New
Headers show

Comments

Amit Shah - April 12, 2011, 9:27 a.m.
Add a new subsection to save and restore the events state for the
GET_EVENT_STATUS_NOTIFICATION command.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 hw/ide/core.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
Kevin Wolf - April 12, 2011, 10:43 a.m.
Am 12.04.2011 11:27, schrieb Amit Shah:
> Add a new subsection to save and restore the events state for the
> GET_EVENT_STATUS_NOTIFICATION command.
> 
> Signed-off-by: Amit Shah <amit.shah@redhat.com>

Looks good, but I think it should be merged into patch 5, so that there
are no commits for which migration is broken.

Kevin

Patch

diff --git a/hw/ide/core.c b/hw/ide/core.c
index 2683070..7043341 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2882,6 +2882,25 @@  static bool ide_drive_pio_state_needed(void *opaque)
     return (s->status & DRQ_STAT) != 0;
 }
 
+static bool ide_atapi_gesn_needed(void *opaque)
+{
+    IDEState *s = opaque;
+
+    return s->events.new_media || s->events.eject_request;
+}
+
+/* Fields for GET_EVENT_STATUS_NOTIFICATION ATAPI command */
+const VMStateDescription vmstate_ide_atapi_gesn_state = {
+    .name ="ide_drive/atapi/gesn_state",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields = (VMStateField []) {
+        VMSTATE_BOOL(events.new_media, IDEState),
+        VMSTATE_BOOL(events.eject_request, IDEState),
+    }
+};
+
 const VMStateDescription vmstate_ide_drive_pio_state = {
     .name = "ide_drive/pio_state",
     .version_id = 1,
@@ -2936,6 +2955,9 @@  const VMStateDescription vmstate_ide_drive = {
             .vmsd = &vmstate_ide_drive_pio_state,
             .needed = ide_drive_pio_state_needed,
         }, {
+            .vmsd = &vmstate_ide_atapi_gesn_state,
+            .needed = ide_atapi_gesn_needed,
+        }, {
             /* empty */
         }
     }