From patchwork Wed Oct 14 11:37:43 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 35946 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 92322B7B72 for ; Wed, 14 Oct 2009 22:43:49 +1100 (EST) Received: from localhost ([127.0.0.1]:45222 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1My2Gg-0004dF-ON for incoming@patchwork.ozlabs.org; Wed, 14 Oct 2009 07:43:46 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1My2Bb-0002Gs-KG for qemu-devel@nongnu.org; Wed, 14 Oct 2009 07:38:31 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1My2BU-0002Aw-V7 for qemu-devel@nongnu.org; Wed, 14 Oct 2009 07:38:29 -0400 Received: from [199.232.76.173] (port=41237 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1My2BU-0002Ak-Pj for qemu-devel@nongnu.org; Wed, 14 Oct 2009 07:38:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42826) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1My2BU-0006C2-7o for qemu-devel@nongnu.org; Wed, 14 Oct 2009 07:38:24 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9EBcNPb016073 for ; Wed, 14 Oct 2009 07:38:23 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9EBcIEs006321; Wed, 14 Oct 2009 07:38:22 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 14 Oct 2009 13:37:43 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 03/13] vmstate: add VMSTATE_BUFFER_TEST X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Juan Quintela --- hw/hw.h | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/hw/hw.h b/hw/hw.h index 8c223f8..c379000 100644 --- a/hw/hw.h +++ b/hw/hw.h @@ -464,6 +464,15 @@ extern const VMStateInfo vmstate_info_buffer; + type_check_array(uint8_t,typeof_field(_state, _field),sizeof(typeof_field(_state,_field))) \ } +#define VMSTATE_STATIC_BUFFER_TEST(_field, _state, _test) { \ + .name = (stringify(_field)), \ + .field_exists = (_test), \ + .size = sizeof(typeof_field(_state,_field)), \ + .info = &vmstate_info_buffer, \ + .flags = VMS_BUFFER, \ + .offset = offsetof(_state, _field) \ + + type_check_array(uint8_t,typeof_field(_state, _field),sizeof(typeof_field(_state,_field))) \ +} #define VMSTATE_BUFFER_START_MIDDLE(_field, _state, start) { \ .name = (stringify(_field)), \ .size = sizeof(typeof_field(_state,_field)) - start, \ @@ -613,6 +622,9 @@ extern const VMStateDescription vmstate_i2c_slave; #define VMSTATE_BUFFER(_f, _s) \ VMSTATE_STATIC_BUFFER(_f, _s, 0) +#define VMSTATE_BUFFER_TEST(_f, _s, _t) \ + VMSTATE_STATIC_BUFFER_TEST(_f, _s, _t) + #ifdef NEED_CPU_H #if TARGET_LONG_BITS == 64 #define VMSTATE_UINTTL_V(_f, _s, _v) \