qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] Add VMSTATE_STRUCT_VARRAY_KNOWN
@ 2016-01-06 12:23 Dr. David Alan Gilbert (git)
  2016-01-06 12:23 ` [Qemu-devel] [PATCH 2/2] migration/virtio: Remove simple .get/.put use Dr. David Alan Gilbert (git)
  2016-01-08 12:12 ` [Qemu-devel] [PATCH 1/2] Add VMSTATE_STRUCT_VARRAY_KNOWN Amit Shah
  0 siblings, 2 replies; 26+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2016-01-06 12:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: amit.shah, mst, quintela

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

At the moment we have VMSTATE_STRUCT_ARRAY that requires
the field is declared as an array of fixed size.
We also have VMSTATE_STRUCT_VARRAY_UINT* that allows
a field declared as a pointer, but requires that the length
is a field member in the structure being loaded/saved.

VMSTATE_STRUCT_VARRAY_KNOWN is for arrays defined as pointers
yet we somehow know the length of.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 include/migration/vmstate.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 7267e38..97d44d3 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -374,6 +374,19 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset       = vmstate_offset_array(_state, _field, _type, _num),\
 }
 
+/* a variable length array (i.e. _type *_field) but we know the
+ * length
+ */
+#define VMSTATE_STRUCT_VARRAY_KNOWN(_field, _state, _num, _version, _vmsd, _type) { \
+    .name       = (stringify(_field)),                               \
+    .num          = (_num),                                          \
+    .version_id = (_version),                                        \
+    .vmsd       = &(_vmsd),                                          \
+    .size       = sizeof(_type),                                     \
+    .flags      = VMS_STRUCT|VMS_ARRAY,                              \
+    .offset     = offsetof(_state, _field),                          \
+}
+
 #define VMSTATE_STRUCT_VARRAY_UINT8(_field, _state, _field_num, _version, _vmsd, _type) { \
     .name       = (stringify(_field)),                               \
     .num_offset = vmstate_offset_value(_state, _field_num, uint8_t), \
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2016-02-26  8:19 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-06 12:23 [Qemu-devel] [PATCH 1/2] Add VMSTATE_STRUCT_VARRAY_KNOWN Dr. David Alan Gilbert (git)
2016-01-06 12:23 ` [Qemu-devel] [PATCH 2/2] migration/virtio: Remove simple .get/.put use Dr. David Alan Gilbert (git)
2016-01-07 11:35   ` Michael S. Tsirkin
2016-01-08 12:12   ` Amit Shah
2016-01-14 21:16   ` Sascha Silbe
2016-01-15  9:24     ` Dr. David Alan Gilbert
2016-01-15 12:01       ` Dr. David Alan Gilbert
2016-01-18  7:52         ` Cornelia Huck
2016-01-18 16:40         ` Sascha Silbe
2016-01-19 12:08           ` Dr. David Alan Gilbert
2016-01-21 20:56             ` Sascha Silbe
2016-01-29 12:53               ` Cornelia Huck
2016-01-29 13:14                 ` Dr. David Alan Gilbert
2016-01-18 19:41         ` Sascha Silbe
2016-01-19 10:36           ` Dr. David Alan Gilbert
2016-01-21 20:39       ` [Qemu-devel] [PATCH qemu] migration/vmstate: document VMStateFlags Sascha Silbe
2016-02-03 12:38         ` Amit Shah
2016-02-23 10:39         ` Amit Shah
2016-02-23 12:32         ` Juan Quintela
2016-02-25  5:05         ` Amit Shah
2016-02-25 20:25           ` Sascha Silbe
2016-02-25 20:45             ` Sascha Silbe
2016-02-26  5:27               ` Amit Shah
2016-02-26  8:18                 ` [Qemu-devel] [PATCH v2] " Sascha Silbe
2016-02-26  8:19                 ` [Qemu-devel] [PATCH qemu] " Sascha Silbe
2016-01-08 12:12 ` [Qemu-devel] [PATCH 1/2] Add VMSTATE_STRUCT_VARRAY_KNOWN Amit Shah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).