@@ -642,11 +642,8 @@ extern const VMStateInfo vmstate_info_bitmap;
#define VMSTATE_UINT8_2DARRAY(_f, _s, _n1, _n2) \
VMSTATE_2DARRAY(_f, _s, _n1, _n2, 0, vmstate_info_uint8, uint8_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_2DARRAY(_f, _s, _n1, _n2) \
- VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, 0)
+ VMSTATE_2DARRAY(_f, _s, _n1, _n2, 0, vmstate_info_uint16, uint16_t)
#define VMSTATE_UINT8_SUB_ARRAY(_f, _s, _start, _num) \
VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint8, uint8_t)
@@ -526,6 +526,7 @@ typedef struct TestArray {
int64_t i64_1[VMSTATE_ARRAY_SIZE];
float64 f64_1[VMSTATE_ARRAY_SIZE];
uint8_t u8_1d[VMSTATE_2D_SIZE][VMSTATE_2D_SIZE];
+ uint16_t u16_1d[VMSTATE_2D_SIZE][VMSTATE_2D_SIZE];
} TestArray;
TestArray obj_array = {
@@ -548,6 +549,9 @@ TestArray obj_array = {
.u8_1d = { {71, 72, 73},
{74, 75, 76},
{77, 78, 79} },
+ .u16_1d = { {81, 82, 83},
+ {84, 85, 86},
+ {87, 88, 89} },
};
static const VMStateDescription vmstate_array_primitive = {
@@ -568,6 +572,8 @@ static const VMStateDescription vmstate_array_primitive = {
VMSTATE_FLOAT64_ARRAY(f64_1, TestArray, VMSTATE_ARRAY_SIZE),
VMSTATE_UINT8_2DARRAY(u8_1d, TestArray, VMSTATE_2D_SIZE,
VMSTATE_2D_SIZE),
+ VMSTATE_UINT16_2DARRAY(u16_1d, TestArray, VMSTATE_2D_SIZE,
+ VMSTATE_2D_SIZE),
VMSTATE_END_OF_LIST()
}
};
@@ -602,6 +608,9 @@ uint8_t wire_array_primitive[] = {
/* u8_1d */ 0x47, 0x48, 0x49,
0x4a, 0x4b, 0x4c,
0x4d, 0x4e, 0x4f,
+ /* u16_1d */0x00, 0x51, 0x00, 0x52, 0x00, 0x53,
+ 0x00, 0x54, 0x00, 0x55, 0x00, 0x56,
+ 0x00, 0x57, 0x00, 0x58, 0x00, 0x59,
QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
};
@@ -633,6 +642,7 @@ static void obj_array_copy(void *arg1, void *arg2)
for (i = 0; i < VMSTATE_2D_SIZE; i++) {
for (j = 0; j < VMSTATE_2D_SIZE; j++) {
target->u8_1d[i][j] = source->u8_1d[i][j];
+ target->u16_1d[i][j] = source->u16_1d[i][j];
}
}
}
@@ -677,6 +687,7 @@ static void test_array_primitive(void)
for (i = 0; i < VMSTATE_2D_SIZE; i++) {
for (j = 0; j < VMSTATE_2D_SIZE; j++) {
ELEM_EQUAL_2D(u8_1d, i, j);
+ ELEM_EQUAL_2D(u16_1d, i, j);
}
}
}
Remove unused _V version. Signed-off-by: Juan Quintela <quintela@redhat.com> --- include/migration/vmstate.h | 5 +---- tests/test-vmstate.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-)