qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 12/36] vmstate: Introduce VMSTATE_STRUCT_VARRAY_


From: Igor Mitsyanko
Subject: Re: [Qemu-devel] [PATCH 12/36] vmstate: Introduce VMSTATE_STRUCT_VARRAY_INT32_TEST
Date: Wed, 21 Mar 2012 23:16:31 +0300
User-agent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2

On 20.03.2012 1:57 AM, Juan Quintela wrote:
We have an array of structs whose size is an int32 in the same struct that
depends on a test value to know if it is there or not.

Signed-off-by: Juan Quintela<address@hidden>
---
  vmstate.h |   10 ++++++++++
  1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/vmstate.h b/vmstate.h
index 5c56f25..b8ac2d0 100644
--- a/vmstate.h
+++ b/vmstate.h
@@ -309,6 +309,16 @@ extern const VMStateDescription vmstate_cpu;
      .offset     = offsetof(_state, _field),                          \
  }

+#define VMSTATE_STRUCT_VARRAY_INT32_TEST(_field, _state, _field_num, _test, 
_vmsd, _type) { \
+    .name       = (stringify(_field)),                               \
+    .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
+    .vmsd       =&(_vmsd),                                          \
+    .field_exists = (_test),                                         \
+    .size       = sizeof(_type),                                     \
+    .flags      = VMS_STRUCT|VMS_VARRAY_INT32,                       \
+    .offset     = offsetof(_state, _field),                          \
+}
+
  #define VMSTATE_STRUCT_VARRAY_POINTER_INT32(_field, _state, _field_num, 
_vmsd, _type) { \
      .name       = (stringify(_field)),                               \
      .version_id = 0,                                                 \

We already have VMSTATE_STRUCT_VARRAY_INT32, maybe for consistency with other macro in vmstate.h this should look like this:

#define VMSTATE_STRUCT_VARRAY_INT32_TEST_V(_field, _state, _field_num, _version, _test, _vmsd, _type) {
.name       = (stringify(_field)),
.num_offset = vmstate_offset_value(_state, _field_num, int32_t),
.version_id = (_version),
.vmsd       =&(_vmsd),
.field_exists = (_test),
.size       = sizeof(_type),
.flags      = VMS_STRUCT|VMS_VARRAY_INT32,
.offset     = offsetof(_state, _field),
}

#define VMSTATE_STRUCT_VARRAY_INT32_TEST(_field, _state, _field_num, _test, _vmsd, _type) \ VMSTATE_STRUCT_VARRAY_INT32_TEST_V(_field, _state, _field_num, 0, _test, _vmsd, _type) {

#define VMSTATE_STRUCT_VARRAY_INT32(_field, _state, _field_num, _vmsd, _type) \ VMSTATE_STRUCT_VARRAY_INT32_TEST_V(_field, _state, _field_num, 0, NULL, _vmsd, _type) {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]