Patchwork [4/4] vmstate: Add support for sending partial arrays

login
register
mail settings
Submitter Juan Quintela
Date Sept. 14, 2009, 8:15 p.m.
Message ID <951c82c161d4fde5586f8a830e543df0f0b1f4be.1252959221.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/33607/
State Superseded
Headers show

Comments

Juan Quintela - Sept. 14, 2009, 8:15 p.m.
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>
---
 hw/hw.h |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/hw.h b/hw/hw.h
index 6f60493..823c132 100644
--- 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),                                        \