vmstate: Add support for sending partial arrays
authorJuan Quintela <quintela@redhat.com>
Tue, 29 Sep 2009 20:48:24 +0000 (22:48 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 5 Oct 2009 14:32:37 +0000 (09:32 -0500)
This one is needed for changees happening on fdc.  It allows you to send
arrays of structs whose size we want to send it is another field with type
uint8_t.  (If you have been able to read the whole sentence without
stoping for breathing, you can use it.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/hw.h

diff --git a/hw/hw.h b/hw/hw.h
index b9ae33a127cb8a156d1ca3d965d83c80769c0a11..9afe50a350f28a19c7d2db77bbd76fd9b374db05 100644 (file)
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -398,6 +398,18 @@ extern const VMStateInfo vmstate_info_buffer;
         + type_check_array(_type,typeof_field(_state, _field),_num)  \
 }
 
+#define VMSTATE_STRUCT_ARRAY_SIZE_UINT8(_field, _state, _field__num, _version, _vmsd, _type) { \
+    .name       = (stringify(_field)),                               \
+    .num_offset = offsetof(_state, _field_num)                       \
+        + type_check(uint8_t,typeof_field(_state, _field_num)),       \
+    .version_id = (_version),                                        \
+    .vmsd       = &(_vmsd),                                          \
+    .size       = sizeof(_type),                                     \
+    .flags      = VMS_STRUCT|VMS_ARRAY,                              \
+    .offset     = offsetof(_state, _field)                           \
+        + type_check_array(_type,typeof_field(_state, _field),_num)  \
+}
+
 #define VMSTATE_STATIC_BUFFER(_field, _state, _version) {            \
     .name       = (stringify(_field)),                               \
     .version_id = (_version),                                        \