From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MlY5z-0004Q7-63 for qemu-devel@nongnu.org; Wed, 09 Sep 2009 21:05:07 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MlY5t-0004Lg-MH for qemu-devel@nongnu.org; Wed, 09 Sep 2009 21:05:05 -0400 Received: from [199.232.76.173] (port=48254 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MlY5t-0004LV-If for qemu-devel@nongnu.org; Wed, 09 Sep 2009 21:05:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20455) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MlY5t-0002lP-01 for qemu-devel@nongnu.org; Wed, 09 Sep 2009 21:05:01 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8A1500W021162 for ; Wed, 9 Sep 2009 21:05:00 -0400 From: Juan Quintela Date: Thu, 10 Sep 2009 03:04:28 +0200 Message-Id: <1ce1b639ff961a5a32cea6cbb27341d95b3e395e.1252543872.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [PATCH 07/26] timers: move them to VMState List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Signed-off-by: Juan Quintela --- vl.c | 34 ++++++++++++---------------------- 1 files changed, 12 insertions(+), 22 deletions(-) diff --git a/vl.c b/vl.c index 19129ad..3828eb4 100644 --- a/vl.c +++ b/vl.c @@ -1074,28 +1074,18 @@ void qemu_get_timer(QEMUFile *f, QEMUTimer *ts) } } -static void timer_save(QEMUFile *f, void *opaque) -{ - struct TimersState *s = opaque; - - qemu_put_be64(f, s->cpu_ticks_offset); - qemu_put_be64(f, s->ticks_per_sec); - qemu_put_be64(f, s->cpu_clock_offset); -} - -static int timer_load(QEMUFile *f, void *opaque, int version_id) -{ - struct TimersState *s = opaque; - - if (version_id != 1 && version_id != 2) - return -EINVAL; - s->cpu_ticks_offset = qemu_get_be64(f); - s->ticks_per_sec = qemu_get_be64(f); - if (version_id == 2) { - s->cpu_clock_offset = qemu_get_be64(f); +static const VMStateDescription vmstate_timers = { + .name = "timer", + .version_id = 2, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .fields = (VMStateField []) { + VMSTATE_INT64(cpu_ticks_offset, TimersState), + VMSTATE_INT64(ticks_per_sec, TimersState), + VMSTATE_INT64_V(cpu_clock_offset, TimersState, 2), + VMSTATE_END_OF_LIST() } - return 0; -} +}; static void qemu_event_increment(void); @@ -5621,7 +5611,7 @@ int main(int argc, char **argv, char **envp) if (qemu_opts_foreach(&qemu_drive_opts, drive_init_func, machine, 1) != 0) exit(1); - register_savevm("timer", 0, 2, timer_save, timer_load, &timers_state); + vmstate_register(0, &vmstate_timers ,&timers_state); register_savevm_live("ram", 0, 3, ram_save_live, NULL, ram_load, NULL); /* Maintain compatibility with multiple stdio monitors */ -- 1.6.2.5