From patchwork Mon Oct 19 18:42:55 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 36401 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 E01D8B7B72 for ; Tue, 20 Oct 2009 06:01:39 +1100 (EST) Received: from localhost ([127.0.0.1]:34567 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MzxU8-0005E6-3Q for incoming@patchwork.ozlabs.org; Mon, 19 Oct 2009 15:01:36 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MzxD5-00068k-Vz for qemu-devel@nongnu.org; Mon, 19 Oct 2009 14:44:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MzxD0-00064n-KN for qemu-devel@nongnu.org; Mon, 19 Oct 2009 14:43:58 -0400 Received: from [199.232.76.173] (port=49043 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MzxCz-00064Z-N6 for qemu-devel@nongnu.org; Mon, 19 Oct 2009 14:43:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29680) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MzxCz-0006Jf-6z for qemu-devel@nongnu.org; Mon, 19 Oct 2009 14:43:53 -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 n9JIhqCW006297 for ; Mon, 19 Oct 2009 14:43:52 -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 n9JIhcC3012656; Mon, 19 Oct 2009 14:43:51 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 19 Oct 2009 20:42:55 +0200 Message-Id: <22ce40bec5b21956f332db80e1108d2bd86af199.1255976538.git.quintela@redhat.com> 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 10/25] vmstate: factor vmstate_offset_buffer 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 | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/hw.h b/hw/hw.h index d669755..aea50a6 100644 --- a/hw/hw.h +++ b/hw/hw.h @@ -350,6 +350,10 @@ extern const VMStateInfo vmstate_info_buffer; (offsetof(_state, _field) + \ type_check_array(_type, typeof_field(_state, _field), _num)) +#define vmstate_offset_buffer(_state, _field) \ + vmstate_offset_array(_state, _field, uint8_t, \ + sizeof(typeof_field(_state, _field))) + #define VMSTATE_SINGLE(_field, _state, _version, _info, _type) { \ .name = (stringify(_field)), \ .version_id = (_version), \ @@ -460,8 +464,7 @@ extern const VMStateInfo vmstate_info_buffer; .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))) \ + .offset = vmstate_offset_buffer(_state, _field), \ } #define VMSTATE_PARTIAL_BUFFER(_field, _state, _size) { \ @@ -469,8 +472,7 @@ extern const VMStateInfo vmstate_info_buffer; .size = (_size), \ .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))) \ + .offset = vmstate_offset_buffer(_state, _field), \ } #define VMSTATE_BUFFER_START_MIDDLE(_field, _state, start) { \ @@ -478,8 +480,7 @@ extern const VMStateInfo vmstate_info_buffer; .size = sizeof(typeof_field(_state,_field)) - start, \ .info = &vmstate_info_buffer, \ .flags = VMS_BUFFER, \ - .offset = offsetof(_state, _field) + start \ - + type_check_array(uint8_t,typeof_field(_state, _field),sizeof(typeof_field(_state,_field))) \ + .offset = vmstate_offset_buffer(_state, _field) + start, \ } extern const VMStateDescription vmstate_pci_device;