From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54696) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9lX5-0002kp-Pf for qemu-devel@nongnu.org; Mon, 19 Mar 2012 18:58:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S9lWw-0000u9-LY for qemu-devel@nongnu.org; Mon, 19 Mar 2012 18:58:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9lWw-0000tW-Db for qemu-devel@nongnu.org; Mon, 19 Mar 2012 18:58:22 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2JMwKwj024715 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 19 Mar 2012 18:58:21 -0400 From: Juan Quintela Date: Mon, 19 Mar 2012 23:57:40 +0100 Message-Id: <151cfef4f7da885965089931c444ce912c2d6261.1332197811.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [PATCH 12/36] vmstate: Introduce VMSTATE_STRUCT_VARRAY_INT32_TEST List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 --- 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, \ -- 1.7.7.6