From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MlY64-0004V0-Uu for qemu-devel@nongnu.org; Wed, 09 Sep 2009 21:05:13 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MlY5z-0004QH-9C for qemu-devel@nongnu.org; Wed, 09 Sep 2009 21:05:12 -0400 Received: from [199.232.76.173] (port=48259 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MlY5y-0004Py-NT for qemu-devel@nongnu.org; Wed, 09 Sep 2009 21:05:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19505) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MlY5x-0002mH-Um for qemu-devel@nongnu.org; Wed, 09 Sep 2009 21:05:06 -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 n8A155v1017696 for ; Wed, 9 Sep 2009 21:05:05 -0400 From: Juan Quintela Date: Thu, 10 Sep 2009 03:04:32 +0200 Message-Id: <5f9a9744cee3768aba000eec4a721ab6f015584c.1252543872.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [PATCH 11/26] vmstate: Add pre/post_save() hooks 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 --- hw/hw.h | 2 ++ savevm.c | 6 ++++++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/hw/hw.h b/hw/hw.h index 8e75a04..d64a0e8 100644 --- a/hw/hw.h +++ b/hw/hw.h @@ -308,6 +308,8 @@ struct VMStateDescription { LoadStateHandler *load_state_old; int (*pre_load)(void *opaque); int (*post_load)(void *opaque); + void (*pre_save)(const void *opaque); + void (*post_save)(const void *opaque); VMStateField *fields; }; diff --git a/savevm.c b/savevm.c index 8ae8d16..c4bee37 100644 --- a/savevm.c +++ b/savevm.c @@ -1073,6 +1073,9 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, { VMStateField *field = vmsd->fields; + if (vmsd->pre_save) { + vmsd->pre_save(opaque); + } while(field->name) { const void *base_addr = opaque + field->offset; int i, n_elems = 1; @@ -1096,6 +1099,9 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, } field++; } + if (vmsd->post_save) { + vmsd->post_save(opaque); + } } static int vmstate_load(QEMUFile *f, SaveStateEntry *se, int version_id) -- 1.6.2.5