From b00319a9dfb4e2f03f065f98681033bcc8651ffe Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Thu, 20 Aug 2009 19:42:33 +0200 Subject: Add VMState support for variable sized arrays This patch add supports for variable sized arrays whose size is another field of the state. Signed-off-by: Juan Quintela Signed-off-by: Anthony Liguori --- savevm.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'savevm.c') diff --git a/savevm.c b/savevm.c index 9df198c..0290c2e 100644 --- a/savevm.c +++ b/savevm.c @@ -997,6 +997,8 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, if (field->flags & VMS_ARRAY) { n_elems = field->num; + } else if (field->flags & VMS_VARRAY) { + n_elems = *(size_t *)(opaque+field->num_offset); } if (field->flags & VMS_POINTER) { base_addr = *(void **)base_addr; @@ -1031,6 +1033,8 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, if (field->flags & VMS_ARRAY) { n_elems = field->num; + } else if (field->flags & VMS_VARRAY) { + n_elems = *(size_t *)(opaque+field->num_offset); } if (field->flags & VMS_POINTER) { base_addr = *(void **)base_addr; -- cgit v1.1