mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-31 22:11:53 -06:00
migration/vmstate: Introduce VMSTATE_WITH_TMP_TEST() and VMSTATE_BITMAP_TEST()
We'll make use of both next in the context of virtio-mem. Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com>S Signed-off-by: David Hildenbrand <david@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
62f42625d4
commit
508f7988fd
1 changed files with 10 additions and 2 deletions
|
@ -719,8 +719,9 @@ extern const VMStateInfo vmstate_info_qlist;
|
||||||
* '_state' type
|
* '_state' type
|
||||||
* That the pointer is right at the start of _tmp_type.
|
* That the pointer is right at the start of _tmp_type.
|
||||||
*/
|
*/
|
||||||
#define VMSTATE_WITH_TMP(_state, _tmp_type, _vmsd) { \
|
#define VMSTATE_WITH_TMP_TEST(_state, _test, _tmp_type, _vmsd) { \
|
||||||
.name = "tmp", \
|
.name = "tmp", \
|
||||||
|
.field_exists = (_test), \
|
||||||
.size = sizeof(_tmp_type) + \
|
.size = sizeof(_tmp_type) + \
|
||||||
QEMU_BUILD_BUG_ON_ZERO(offsetof(_tmp_type, parent) != 0) + \
|
QEMU_BUILD_BUG_ON_ZERO(offsetof(_tmp_type, parent) != 0) + \
|
||||||
type_check_pointer(_state, \
|
type_check_pointer(_state, \
|
||||||
|
@ -729,6 +730,9 @@ extern const VMStateInfo vmstate_info_qlist;
|
||||||
.info = &vmstate_info_tmp, \
|
.info = &vmstate_info_tmp, \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define VMSTATE_WITH_TMP(_state, _tmp_type, _vmsd) \
|
||||||
|
VMSTATE_WITH_TMP_TEST(_state, NULL, _tmp_type, _vmsd)
|
||||||
|
|
||||||
#define VMSTATE_UNUSED_BUFFER(_test, _version, _size) { \
|
#define VMSTATE_UNUSED_BUFFER(_test, _version, _size) { \
|
||||||
.name = "unused", \
|
.name = "unused", \
|
||||||
.field_exists = (_test), \
|
.field_exists = (_test), \
|
||||||
|
@ -752,8 +756,9 @@ extern const VMStateInfo vmstate_info_qlist;
|
||||||
/* _field_size should be a int32_t field in the _state struct giving the
|
/* _field_size should be a int32_t field in the _state struct giving the
|
||||||
* size of the bitmap _field in bits.
|
* size of the bitmap _field in bits.
|
||||||
*/
|
*/
|
||||||
#define VMSTATE_BITMAP(_field, _state, _version, _field_size) { \
|
#define VMSTATE_BITMAP_TEST(_field, _state, _test, _version, _field_size) { \
|
||||||
.name = (stringify(_field)), \
|
.name = (stringify(_field)), \
|
||||||
|
.field_exists = (_test), \
|
||||||
.version_id = (_version), \
|
.version_id = (_version), \
|
||||||
.size_offset = vmstate_offset_value(_state, _field_size, int32_t),\
|
.size_offset = vmstate_offset_value(_state, _field_size, int32_t),\
|
||||||
.info = &vmstate_info_bitmap, \
|
.info = &vmstate_info_bitmap, \
|
||||||
|
@ -761,6 +766,9 @@ extern const VMStateInfo vmstate_info_qlist;
|
||||||
.offset = offsetof(_state, _field), \
|
.offset = offsetof(_state, _field), \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define VMSTATE_BITMAP(_field, _state, _version, _field_size) \
|
||||||
|
VMSTATE_BITMAP_TEST(_field, _state, NULL, _version, _field_size)
|
||||||
|
|
||||||
/* For migrating a QTAILQ.
|
/* For migrating a QTAILQ.
|
||||||
* Target QTAILQ needs be properly initialized.
|
* Target QTAILQ needs be properly initialized.
|
||||||
* _type: type of QTAILQ element
|
* _type: type of QTAILQ element
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue