@samitouri / QOSamiQemu / commits / d4ee084359

vmstate: Pass in struct itself for VMSTATE_ARRAY_OF_POINTER

Passing in a pointer almost never helps. Convert it to pass in struct for further refactoring on VMS_ARRAY_OF_POINTER. Reviewed-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@futurfusion.io> Reviewed-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Peter Xu <peterx@redhat.com> Reviewed-by: Juraj Marcin <jmarcin@redhat.com> Link: https://lore.kernel.org/qemu-devel/20260401202844.673494-2-peterx@redhat.com [delete spurious hunk touching roms/seabios] Signed-off-by: Fabiano Rosas <farosas@suse.de>

Peter Xu committed Apr 1, 2026 at 16:28 UTC d4ee0843593ddb2a364a4ab8c065fc70cd9e7b32
2 files changed +4 -4
include/migration/vmstate.h
+3 -3
@@ -547,9 +547,9 @@ extern const VMStateInfo vmstate_info_qlist;
547 .version_id = (_version), \
548 .num = (_num), \
549 .info = &(_info), \
550 - .size = sizeof(_type), \
550 + .size = sizeof(_type *), \
551 .flags = VMS_ARRAY|VMS_ARRAY_OF_POINTER, \
552 - .offset = vmstate_offset_array(_state, _field, _type, _num), \
552 + .offset = vmstate_offset_array(_state, _field, _type *, _num), \
553 }
554
555 #define VMSTATE_ARRAY_OF_POINTER_TO_STRUCT(_f, _s, _n, _v, _vmsd, _type) { \
@@ -1093,7 +1093,7 @@ extern const VMStateInfo vmstate_info_qlist;
1093 VMSTATE_TIMER_PTR_V(_f, _s, 0)
1094
1095 #define VMSTATE_TIMER_PTR_ARRAY(_f, _s, _n) \
1096 - VMSTATE_ARRAY_OF_POINTER(_f, _s, _n, 0, vmstate_info_timer, QEMUTimer *)
1096 + VMSTATE_ARRAY_OF_POINTER(_f, _s, _n, 0, vmstate_info_timer, QEMUTimer)
1097
1098 #define VMSTATE_TIMER_TEST(_f, _s, _test) \
1099 VMSTATE_SINGLE_TEST(_f, _s, _test, 0, vmstate_info_timer, QEMUTimer)
tests/unit/test-vmstate.c
+1 -1
@@ -668,7 +668,7 @@ const VMStateDescription vmsd_arpp = {
668 .minimum_version_id = 1,
669 .fields = (const VMStateField[]) {
670 VMSTATE_ARRAY_OF_POINTER(ar, TestArrayOfPtrToInt,
671 - AR_SIZE, 0, vmstate_info_int32, int32_t*),
671 + AR_SIZE, 0, vmstate_info_int32, int32_t),
672 VMSTATE_END_OF_LIST()
673 }
674 };