@@ -609,15 +609,12 @@ extern const VMStateInfo vmstate_info_bitmap;
#define VMSTATE_UINT8_ARRAY(_f, _s, _n) \
VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_uint8, uint8_t)
-#define VMSTATE_UINT16_ARRAY_V(_f, _s, _n, _v) \
- VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint16, uint16_t)
+#define VMSTATE_UINT16_ARRAY(_f, _s, _n) \
+ VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_uint16, uint16_t)
#define VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, _v) \
VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint16, uint16_t)
-#define VMSTATE_UINT16_ARRAY(_f, _s, _n) \
- VMSTATE_UINT16_ARRAY_V(_f, _s, _n, 0)
-
#define VMSTATE_UINT16_2DARRAY(_f, _s, _n1, _n2) \
VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, 0)
@@ -514,6 +514,7 @@ typedef struct TestArray {
bool b_2[VMSTATE_ARRAY_SIZE];
uint8_t u8_1[VMSTATE_ARRAY_SIZE];
uint8_t u8_2[VMSTATE_ARRAY_SIZE];
+ uint16_t u16_1[VMSTATE_ARRAY_SIZE];
} TestArray;
TestArray obj_array = {
@@ -522,6 +523,7 @@ TestArray obj_array = {
.b_2 = { true, false, true, false, true},
.u8_1 = { 1, 2, 3, 4, 5},
.u8_2 = { 5, 4, 3, 2, 1},
+ .u16_1 = {11, 12, 13, 14, 15},
};
static const VMStateDescription vmstate_array_primitive = {
@@ -533,6 +535,7 @@ static const VMStateDescription vmstate_array_primitive = {
VMSTATE_INT32_EQUAL(size, TestArray),
VMSTATE_BOOL_ARRAY(b_1, TestArray, VMSTATE_ARRAY_SIZE),
VMSTATE_UINT8_ARRAY(u8_1, TestArray, VMSTATE_ARRAY_SIZE),
+ VMSTATE_UINT16_ARRAY(u16_1, TestArray, VMSTATE_ARRAY_SIZE),
VMSTATE_END_OF_LIST()
}
};
@@ -541,6 +544,7 @@ uint8_t wire_array_primitive[] = {
/* size */ 0x00, 0x00, 0x00, 0x05,
/* b_1 */ 0x00, 0x01, 0x00, 0x01, 0x00,
/* u8_1 */ 0x01, 0x02, 0x03, 0x04, 0x05,
+ /* u16_1 */ 0x00, 0x0b, 0x00, 0x0c, 0x00, 0x0d, 0x00, 0x0e, 0x00, 0x0f,
QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
};
@@ -557,6 +561,7 @@ static void obj_array_copy(void *arg1, void *arg2)
target->b_2[i] = source->b_2[i];
target->u8_1[i] = source->u8_1[i];
target->u8_2[i] = source->u8_2[i];
+ target->u16_1[i] = source->u16_1[i];
}
}
@@ -587,6 +592,7 @@ static void test_array_primitive(void)
ELEM_EQUAL(b_1, i);
ELEM_EQUAL(u8_1, i);
ELEM_NOT_EQUAL(u8_2, i);
+ ELEM_EQUAL(u16_1, i);
}
}
Remove unused VMSTATE_UINT16_ARRAY_V. Signed-off-by: Juan Quintela <quintela@redhat.com> --- include/migration/vmstate.h | 7 ++----- tests/test-vmstate.c | 6 ++++++ 2 files changed, 8 insertions(+), 5 deletions(-)