Signed-off-by: Juan Quintela <quint...@redhat.com> --- hw/fdc.c | 2 +- hw/hw.h | 8 ++++---- savevm.c | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/hw/fdc.c b/hw/fdc.c index a21e05f..df0532a 100644 --- a/hw/fdc.c +++ b/hw/fdc.c @@ -679,7 +679,7 @@ static const VMStateDescription vmstate_fdc = { VMSTATE_UINT8(status1, fdctrl_t), VMSTATE_UINT8(status2, fdctrl_t), /* Command FIFO */ - VMSTATE_VARRAY(fifo, fdctrl_t, fifo_size, 0, vmstate_info_uint8, uint8), + VMSTATE_VARRAY_INT32(fifo, fdctrl_t, fifo_size, 0, vmstate_info_uint8, uint8), VMSTATE_UINT32(data_pos, fdctrl_t), VMSTATE_UINT32(data_len, fdctrl_t), VMSTATE_UINT8(data_state, fdctrl_t), diff --git a/hw/hw.h b/hw/hw.h index 9a40b43..89c138d 100644 --- a/hw/hw.h +++ b/hw/hw.h @@ -285,7 +285,7 @@ enum VMStateFlags { VMS_POINTER = 0x002, VMS_ARRAY = 0x004, VMS_STRUCT = 0x008, - VMS_VARRAY = 0x010, /* Array with size in another field */ + VMS_VARRAY_INT32 = 0x010, /* Array with size in another field */ VMS_BUFFER = 0x020, /* static sized buffer */ VMS_ARRAY_OF_POINTER = 0x040, }; @@ -390,14 +390,14 @@ extern const VMStateInfo vmstate_info_buffer; + type_check_array(_type,typeof_field(_state, _field),_num) \ } -#define VMSTATE_VARRAY(_field, _state, _field_num, _version, _info, _type) {\ +#define VMSTATE_VARRAY_INT32(_field, _state, _field_num, _version, _info, _type) {\ .name = (stringify(_field)), \ .version_id = (_version), \ .num_offset = offsetof(_state, _field_num) \ + type_check(int32_t,typeof_field(_state, _field_num)), \ .info = &(_info), \ .size = sizeof(_type), \ - .flags = VMS_VARRAY|VMS_POINTER, \ + .flags = VMS_VARRAY_INT32|VMS_POINTER, \ .offset = offsetof(_state, _field) \ + type_check_pointer(_type,typeof_field(_state, _field)) \ } @@ -618,7 +618,7 @@ extern const VMStateDescription vmstate_i2c_slave; VMSTATE_INT32_ARRAY_V(_f, _s, _n, 0) #define VMSTATE_INT32_VARRAY_V(_f, _s, _f_n, _v) \ - VMSTATE_VARRAY(_f, _s, _f_n, _v, vmstate_info_int32, int32_t) + VMSTATE_VARRAY_INT32(_f, _s, _f_n, _v, vmstate_info_int32, int32_t) #define VMSTATE_INT32_VARRAY(_f, _s, _f_n) \ VMSTATE_INT32_VARRAY_V(_f, _s, _f_n, 0) diff --git a/savevm.c b/savevm.c index 6a10bc7..ccbbae8 100644 --- a/savevm.c +++ b/savevm.c @@ -1084,8 +1084,8 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, if (field->flags & VMS_ARRAY) { n_elems = field->num; - } else if (field->flags & VMS_VARRAY) { - n_elems = *(size_t *)(opaque+field->num_offset); + } else if (field->flags & VMS_VARRAY_INT32) { + n_elems = *(int32_t *)(opaque+field->num_offset); } if (field->flags & VMS_POINTER) { base_addr = *(void **)base_addr; @@ -1131,8 +1131,8 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, if (field->flags & VMS_ARRAY) { n_elems = field->num; - } else if (field->flags & VMS_VARRAY) { - n_elems = *(size_t *)(opaque+field->num_offset); + } else if (field->flags & VMS_VARRAY_INT32) { + n_elems = *(int32_t *)(opaque+field->num_offset); } if (field->flags & VMS_POINTER) { base_addr = *(void **)base_addr; -- 1.6.2.5