From patchwork Wed Dec 2 11:36:40 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [06/12] vmstate: Introduce VMSTATE_STRUCT_POINTER_TEST Date: Wed, 02 Dec 2009 01:36:40 -0000 From: Juan Quintela X-Patchwork-Id: 39999 Message-Id: <50a90db19a7f4e6fcb66017eb000550a4e31069c.1259753146.git.quintela@redhat.com> To: qemu-devel@nongnu.org Signed-off-by: Juan Quintela --- hw/hw.h | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/hw/hw.h b/hw/hw.h index 0f4442a..0a5acd4 100644 --- a/hw/hw.h +++ b/hw/hw.h @@ -446,12 +446,13 @@ extern const VMStateInfo vmstate_info_unused_buffer; .offset = vmstate_offset_value(_state, _field, _type), \ } -#define VMSTATE_STRUCT_POINTER(_field, _state, _vmsd, _type) { \ - .name = (stringify(_field)), \ - .vmsd = &(_vmsd), \ - .size = sizeof(_type), \ - .flags = VMS_STRUCT|VMS_POINTER, \ - .offset = vmstate_offset_value(_state, _field, _type), \ +#define VMSTATE_STRUCT_POINTER_TEST(_field, _state, _test, _vmsd, _type) { \ + .name = (stringify(_field)), \ + .field_exists = (_test), \ + .vmsd = &(_vmsd), \ + .size = sizeof(_type), \ + .flags = VMS_STRUCT|VMS_POINTER, \ + .offset = vmstate_offset_value(_state, _field, _type), \ } #define VMSTATE_ARRAY_OF_POINTER(_field, _state, _num, _version, _info, _type) {\ @@ -578,6 +579,9 @@ extern const VMStateDescription vmstate_i2c_slave; #define VMSTATE_STRUCT(_field, _state, _version, _vmsd, _type) \ VMSTATE_STRUCT_TEST(_field, _state, NULL, _version, _vmsd, _type) +#define VMSTATE_STRUCT_POINTER(_field, _state, _vmsd, _type) \ + VMSTATE_STRUCT_POINTER_TEST(_field, _state, NULL, _vmsd, _type) + #define VMSTATE_INT8_V(_f, _s, _v) \ VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int8, int8_t) #define VMSTATE_INT16_V(_f, _s, _v) \