vmstate: Introduce VMSTATE_VARRAY_MULTPLY

This allows to send a partial array where the size is another
structure field multiplied by a constant.

Signed-off-by: Juan Quintela <quintela@redhat.com>
[PMM: updated to current master]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
This commit is contained in:
Juan Quintela
2016-01-11 12:40:22 +00:00
committed by Mark Cave-Ayland
parent 551747491d
commit b47d3af755
2 changed files with 15 additions and 0 deletions

View File

@@ -28,6 +28,10 @@ static int vmstate_n_elems(void *opaque, VMStateField *field)
n_elems = *(uint8_t *)(opaque+field->num_offset);
}
if (field->flags & VMS_MULTIPLY_ELEMENTS) {
n_elems *= field->num;
}
return n_elems;
}