From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 1/4] vmstate: remove const for put operations
Date: Tue, 15 Sep 2009 01:08:35 +0200 [thread overview]
Message-ID: <2f5be21c74a512a3a9c33a2eeb73fca546b4e412.1252969608.git.quintela@redhat.com> (raw)
In-Reply-To: <cover.1252969608.git.quintela@redhat.com>
In-Reply-To: <cover.1252969608.git.quintela@redhat.com>
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 <quintela@redhat.com>
---
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 c12b0be..7d7d619 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);
--
1.6.2.5
next prev parent reply other threads:[~2009-09-14 23:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-14 23:08 [Qemu-devel] [PATCH v2 0/4] Fix VMState design flaws Juan Quintela
2009-09-14 23:08 ` Juan Quintela [this message]
2009-09-14 23:08 ` [Qemu-devel] [PATCH 2/4] vmstate: add version_id argument to post_load Juan Quintela
2009-09-14 23:08 ` [Qemu-devel] [PATCH 3/4] vmstate: remove ps2_kbd_load_old() Juan Quintela
2009-09-14 23:08 ` [Qemu-devel] [PATCH 4/4] vmstate: Add support for sending partial arrays Juan Quintela
-- strict thread matches above, loose matches on Subject: below --
2009-09-14 20:15 [Qemu-devel] [PATCH 0/4] Fix VMState design flaws Juan Quintela
2009-09-14 20:15 ` [Qemu-devel] [PATCH 1/4] vmstate: remove const for put operations Juan Quintela
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2f5be21c74a512a3a9c33a2eeb73fca546b4e412.1252969608.git.quintela@redhat.com \
--to=quintela@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).