[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 02/32] vmstate: port adb_mouse
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 02/32] vmstate: port adb_mouse |
Date: |
Thu, 10 Mar 2011 12:47:38 +0100 |
Signed-off-by: Juan Quintela <address@hidden>
---
hw/adb.c | 43 +++++++++++++++----------------------------
1 files changed, 15 insertions(+), 28 deletions(-)
diff --git a/hw/adb.c b/hw/adb.c
index fbf5080..7499cdc 100644
--- a/hw/adb.c
+++ b/hw/adb.c
@@ -427,32 +427,20 @@ static int adb_mouse_reset(ADBDevice *d)
return 0;
}
-static void adb_mouse_save(QEMUFile *f, void *opaque)
-{
- MouseState *s = (MouseState *)opaque;
-
- qemu_put_sbe32s(f, &s->buttons_state);
- qemu_put_sbe32s(f, &s->last_buttons_state);
- qemu_put_sbe32s(f, &s->dx);
- qemu_put_sbe32s(f, &s->dy);
- qemu_put_sbe32s(f, &s->dz);
-}
-
-static int adb_mouse_load(QEMUFile *f, void *opaque, int version_id)
-{
- MouseState *s = (MouseState *)opaque;
-
- if (version_id != 1)
- return -EINVAL;
-
- qemu_get_sbe32s(f, &s->buttons_state);
- qemu_get_sbe32s(f, &s->last_buttons_state);
- qemu_get_sbe32s(f, &s->dx);
- qemu_get_sbe32s(f, &s->dy);
- qemu_get_sbe32s(f, &s->dz);
-
- return 0;
-}
+static const VMStateDescription vmstate_adb_mouse = {
+ .name = "adb_mouse",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .minimum_version_id_old = 1,
+ .fields = (VMStateField[]) {
+ VMSTATE_INT32(buttons_state, MouseState),
+ VMSTATE_INT32(last_buttons_state, MouseState),
+ VMSTATE_INT32(dx, MouseState),
+ VMSTATE_INT32(dy, MouseState),
+ VMSTATE_INT32(dz, MouseState),
+ VMSTATE_END_OF_LIST()
+ }
+};
void adb_mouse_init(ADBBusState *bus)
{
@@ -463,6 +451,5 @@ void adb_mouse_init(ADBBusState *bus)
d = adb_register_device(bus, ADB_MOUSE, adb_mouse_request,
adb_mouse_reset, s);
qemu_add_mouse_event_handler(adb_mouse_event, d, 0, "QEMU ADB Mouse");
- register_savevm(NULL, "adb_mouse", -1, 1, adb_mouse_save,
- adb_mouse_load, s);
+ vmstate_register(NULL, -1, &vmstate_adb_mouse, s);
}
--
1.7.4
- [Qemu-devel] [PATCH 00/32] VMState port of misc devices, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 01/32] vmstate: port adb_kbd, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 02/32] vmstate: port adb_mouse,
Juan Quintela <=
- [Qemu-devel] [PATCH 03/32] vmstate: port ads7846, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 04/32] vmstate: port m48t59, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 06/32] vmstate: port arm sp804, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 05/32] vmstate: port mipsnet, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 07/32] vmstate: port arm_timer, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 09/32] vmstate: port pmtimer, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 10/32] vmstate: port syborg_rtc, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 08/32] vmstate: port sysborg_timer, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 13/32] vmstate: port armv7m nvic, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 12/32] vmstate: port pl011, Juan Quintela, 2011/03/10