* [Qemu-devel] [PATCH] vmstate: Make VMSTATE_STRUCT_POINTER take type, not ptr-to-type
@ 2014-01-01 21:56 Peter Maydell
2014-01-14 16:35 ` Juan Quintela
0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2014-01-01 21:56 UTC (permalink / raw)
To: qemu-devel; +Cc: Juan Quintela, patches
The VMSTATE_STRUCT_POINTER macros are a bit odd in that they
must be passed an argument "FooType *" rather than just taking
the FooType. They're only used in one place, so it's easy to
tidy this up. This also lets us use the macro to replace the
hand-rolled VMSTATE_PTIMER.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Juan: would you be willing to add an entry to MAINTAINERS
for the migration code? I keep having to look your email
address up in the git history :-)
hw/arm/pxa2xx.c | 2 +-
include/hw/ptimer.h | 10 ++--------
include/migration/vmstate.h | 8 ++++----
3 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
index 02b7016..25ec549 100644
--- a/hw/arm/pxa2xx.c
+++ b/hw/arm/pxa2xx.c
@@ -1448,7 +1448,7 @@ static const VMStateDescription vmstate_pxa2xx_i2c = {
VMSTATE_UINT8(ibmr, PXA2xxI2CState),
VMSTATE_UINT8(data, PXA2xxI2CState),
VMSTATE_STRUCT_POINTER(slave, PXA2xxI2CState,
- vmstate_pxa2xx_i2c_slave, PXA2xxI2CSlaveState *),
+ vmstate_pxa2xx_i2c_slave, PXA2xxI2CSlaveState),
VMSTATE_END_OF_LIST()
}
};
diff --git a/include/hw/ptimer.h b/include/hw/ptimer.h
index a33edf4..8ebacbb 100644
--- a/include/hw/ptimer.h
+++ b/include/hw/ptimer.h
@@ -27,14 +27,8 @@ void ptimer_stop(ptimer_state *s);
extern const VMStateDescription vmstate_ptimer;
-#define VMSTATE_PTIMER(_field, _state) { \
- .name = (stringify(_field)), \
- .version_id = (1), \
- .vmsd = &vmstate_ptimer, \
- .size = sizeof(ptimer_state *), \
- .flags = VMS_STRUCT|VMS_POINTER, \
- .offset = vmstate_offset_pointer(_state, _field, ptimer_state), \
-}
+#define VMSTATE_PTIMER(_field, _state) \
+ VMSTATE_STRUCT_POINTER_V(_field, _state, 1, vmstate_ptimer, ptimer_state)
#define VMSTATE_PTIMER_ARRAY(_f, _s, _n) \
VMSTATE_ARRAY_OF_POINTER_TO_STRUCT(_f, _s, _n, 0, \
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index be193ba..fbd16a0 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -314,9 +314,9 @@ extern const VMStateInfo vmstate_info_bitmap;
.name = (stringify(_field)), \
.version_id = (_version), \
.vmsd = &(_vmsd), \
- .size = sizeof(_type), \
+ .size = sizeof(_type *), \
.flags = VMS_STRUCT|VMS_POINTER, \
- .offset = vmstate_offset_value(_state, _field, _type), \
+ .offset = vmstate_offset_pointer(_state, _field, _type), \
}
#define VMSTATE_STRUCT_POINTER_TEST_V(_field, _state, _test, _version, _vmsd, _type) { \
@@ -324,9 +324,9 @@ extern const VMStateInfo vmstate_info_bitmap;
.version_id = (_version), \
.field_exists = (_test), \
.vmsd = &(_vmsd), \
- .size = sizeof(_type), \
+ .size = sizeof(_type *), \
.flags = VMS_STRUCT|VMS_POINTER, \
- .offset = vmstate_offset_value(_state, _field, _type), \
+ .offset = vmstate_offset_pointer(_state, _field, _type), \
}
#define VMSTATE_ARRAY_OF_POINTER(_field, _state, _num, _version, _info, _type) {\
--
1.8.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] vmstate: Make VMSTATE_STRUCT_POINTER take type, not ptr-to-type
2014-01-01 21:56 [Qemu-devel] [PATCH] vmstate: Make VMSTATE_STRUCT_POINTER take type, not ptr-to-type Peter Maydell
@ 2014-01-14 16:35 ` Juan Quintela
0 siblings, 0 replies; 2+ messages in thread
From: Juan Quintela @ 2014-01-14 16:35 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel, patches
Peter Maydell <peter.maydell@linaro.org> wrote:
> The VMSTATE_STRUCT_POINTER macros are a bit odd in that they
> must be passed an argument "FooType *" rather than just taking
> the FooType. They're only used in one place, so it's easy to
> tidy this up. This also lets us use the macro to replace the
> hand-rolled VMSTATE_PTIMER.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Juan Quintela <quintela@redhat.com>
> ---
> Juan: would you be willing to add an entry to MAINTAINERS
> for the migration code? I keep having to look your email
> address up in the git history :-)
Will sent on the next pull request.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-14 16:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-01 21:56 [Qemu-devel] [PATCH] vmstate: Make VMSTATE_STRUCT_POINTER take type, not ptr-to-type Peter Maydell
2014-01-14 16:35 ` Juan Quintela
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).