From patchwork Tue Sep 29 20:48:20 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 34451 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 4CF74B7C15 for ; Wed, 30 Sep 2009 06:52:39 +1000 (EST) Received: from localhost ([127.0.0.1]:39990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MsjgZ-0006Rv-Uu for incoming@patchwork.ozlabs.org; Tue, 29 Sep 2009 16:52:35 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MsjdX-0004ua-9l for qemu-devel@nongnu.org; Tue, 29 Sep 2009 16:49:27 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MsjdS-0004sD-Ry for qemu-devel@nongnu.org; Tue, 29 Sep 2009 16:49:26 -0400 Received: from [199.232.76.173] (port=55200 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MsjdS-0004s9-L5 for qemu-devel@nongnu.org; Tue, 29 Sep 2009 16:49:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7228) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MsjdR-0002I9-Uo for qemu-devel@nongnu.org; Tue, 29 Sep 2009 16:49:22 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8TKnKTY026412 for ; Tue, 29 Sep 2009 16:49:20 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8TKnHXa006885; Tue, 29 Sep 2009 16:49:19 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Tue, 29 Sep 2009 22:48:20 +0200 Message-Id: <4304d0c6f6a088284c948dd0e42f7fc323beb95e.1254255997.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 01/49] vmstate: remove const for put operations 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 In a later patch, we introduce pre_save() and post_save() functions. The whole point of that operation is to change things in the state. Without this patch, we have to remove the const qualifier in each use with a cast Signed-off-by: Juan Quintela --- hw/hw.h | 4 ++-- hw/pci.c | 2 +- hw/ptimer.c | 4 ++-- savevm.c | 46 +++++++++++++++++++++++----------------------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/hw/hw.h b/hw/hw.h index cf266b3..e407815 100644 --- a/hw/hw.h +++ b/hw/hw.h @@ -276,7 +276,7 @@ typedef struct VMStateDescription VMStateDescription; struct VMStateInfo { const char *name; int (*get)(QEMUFile *f, void *pv, size_t size); - void (*put)(QEMUFile *f, const void *pv, size_t size); + void (*put)(QEMUFile *f, void *pv, size_t size); }; enum VMStateFlags { @@ -534,7 +534,7 @@ extern const VMStateDescription vmstate_pci_device; extern int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, void *opaque, int version_id); extern void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, - const void *opaque); + void *opaque); extern int vmstate_register(int instance_id, const VMStateDescription *vmsd, void *base); void vmstate_unregister(const VMStateDescription *vmsd, void *opaque); diff --git a/hw/pci.c b/hw/pci.c index 64d70ed..c46410a 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -156,7 +156,7 @@ static int get_pci_config_device(QEMUFile *f, void *pv, size_t size) } /* just put buffer */ -static void put_pci_config_device(QEMUFile *f, const void *pv, size_t size) +static void put_pci_config_device(QEMUFile *f, void *pv, size_t size) { const uint8_t *v = pv; qemu_put_buffer(f, v, size); diff --git a/hw/ptimer.c b/hw/ptimer.c index a4343b6..4ddbc59 100644 --- a/hw/ptimer.c +++ b/hw/ptimer.c @@ -220,9 +220,9 @@ static int get_ptimer(QEMUFile *f, void *pv, size_t size) return 0; } -static void put_ptimer(QEMUFile *f, const void *pv, size_t size) +static void put_ptimer(QEMUFile *f, void *pv, size_t size) { - ptimer_state *v = (void *)pv; + ptimer_state *v = pv; qemu_put_ptimer(f, v); } diff --git a/savevm.c b/savevm.c index fd767be..b36c657 100644 --- a/savevm.c +++ b/savevm.c @@ -649,9 +649,9 @@ static int get_int8(QEMUFile *f, void *pv, size_t size) return 0; } -static void put_int8(QEMUFile *f, const void *pv, size_t size) +static void put_int8(QEMUFile *f, void *pv, size_t size) { - const int8_t *v = pv; + int8_t *v = pv; qemu_put_s8s(f, v); } @@ -670,9 +670,9 @@ static int get_int16(QEMUFile *f, void *pv, size_t size) return 0; } -static void put_int16(QEMUFile *f, const void *pv, size_t size) +static void put_int16(QEMUFile *f, void *pv, size_t size) { - const int16_t *v = pv; + int16_t *v = pv; qemu_put_sbe16s(f, v); } @@ -691,9 +691,9 @@ static int get_int32(QEMUFile *f, void *pv, size_t size) return 0; } -static void put_int32(QEMUFile *f, const void *pv, size_t size) +static void put_int32(QEMUFile *f, void *pv, size_t size) { - const int32_t *v = pv; + int32_t *v = pv; qemu_put_sbe32s(f, v); } @@ -752,9 +752,9 @@ static int get_int64(QEMUFile *f, void *pv, size_t size) return 0; } -static void put_int64(QEMUFile *f, const void *pv, size_t size) +static void put_int64(QEMUFile *f, void *pv, size_t size) { - const int64_t *v = pv; + int64_t *v = pv; qemu_put_sbe64s(f, v); } @@ -773,9 +773,9 @@ static int get_uint8(QEMUFile *f, void *pv, size_t size) return 0; } -static void put_uint8(QEMUFile *f, const void *pv, size_t size) +static void put_uint8(QEMUFile *f, void *pv, size_t size) { - const uint8_t *v = pv; + uint8_t *v = pv; qemu_put_8s(f, v); } @@ -794,9 +794,9 @@ static int get_uint16(QEMUFile *f, void *pv, size_t size) return 0; } -static void put_uint16(QEMUFile *f, const void *pv, size_t size) +static void put_uint16(QEMUFile *f, void *pv, size_t size) { - const uint16_t *v = pv; + uint16_t *v = pv; qemu_put_be16s(f, v); } @@ -815,9 +815,9 @@ static int get_uint32(QEMUFile *f, void *pv, size_t size) return 0; } -static void put_uint32(QEMUFile *f, const void *pv, size_t size) +static void put_uint32(QEMUFile *f, void *pv, size_t size) { - const uint32_t *v = pv; + uint32_t *v = pv; qemu_put_be32s(f, v); } @@ -836,9 +836,9 @@ static int get_uint64(QEMUFile *f, void *pv, size_t size) return 0; } -static void put_uint64(QEMUFile *f, const void *pv, size_t size) +static void put_uint64(QEMUFile *f, void *pv, size_t size) { - const uint64_t *v = pv; + uint64_t *v = pv; qemu_put_be64s(f, v); } @@ -877,9 +877,9 @@ static int get_timer(QEMUFile *f, void *pv, size_t size) return 0; } -static void put_timer(QEMUFile *f, const void *pv, size_t size) +static void put_timer(QEMUFile *f, void *pv, size_t size) { - QEMUTimer *v = (void *)pv; + QEMUTimer *v = pv; qemu_put_timer(f, v); } @@ -898,9 +898,9 @@ static int get_buffer(QEMUFile *f, void *pv, size_t size) return 0; } -static void put_buffer(QEMUFile *f, const void *pv, size_t size) +static void put_buffer(QEMUFile *f, void *pv, size_t size) { - uint8_t *v = (void *)pv; + uint8_t *v = pv; qemu_put_buffer(f, v, size); } @@ -1090,7 +1090,7 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, } void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, - const void *opaque) + void *opaque) { VMStateField *field = vmsd->fields; @@ -1098,7 +1098,7 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, vmsd->pre_save(opaque); } while(field->name) { - const void *base_addr = opaque + field->offset; + void *base_addr = opaque + field->offset; int i, n_elems = 1; if (field->flags & VMS_ARRAY) { @@ -1110,7 +1110,7 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, base_addr = *(void **)base_addr; } for (i = 0; i < n_elems; i++) { - const void *addr = base_addr + field->size * i; + void *addr = base_addr + field->size * i; if (field->flags & VMS_STRUCT) { vmstate_save_state(f, field->vmsd, addr);