vmstate: Add support for multiplying size for a constant
When the size that we want to transmit is in another field, but in an
unit different that bytes
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
diff --git a/savevm.c b/savevm.c
index 1125ef2..17a6c97 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1147,6 +1147,9 @@
if (field->flags & VMS_VBUFFER) {
size = *(int32_t *)(opaque+field->size_offset);
+ if (field->flags & VMS_MULTIPLY) {
+ size *= field->size;
+ }
}
if (field->flags & VMS_ARRAY) {
n_elems = field->num;
@@ -1200,6 +1203,9 @@
if (field->flags & VMS_VBUFFER) {
size = *(int32_t *)(opaque+field->size_offset);
+ if (field->flags & VMS_MULTIPLY) {
+ size *= field->size;
+ }
}
if (field->flags & VMS_ARRAY) {
n_elems = field->num;