mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
Add VMState support for structs
This patch adds support for saving one VMStateDescription from other VMStateDescription. Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
695dcf71eb
commit
ec245e2111
2 changed files with 25 additions and 2 deletions
12
hw/hw.h
12
hw/hw.h
|
@ -283,6 +283,7 @@ enum VMStateFlags {
|
|||
VMS_SINGLE = 0x001,
|
||||
VMS_POINTER = 0x002,
|
||||
VMS_ARRAY = 0x004,
|
||||
VMS_STRUCT = 0x008,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
@ -292,6 +293,7 @@ typedef struct {
|
|||
int num;
|
||||
const VMStateInfo *info;
|
||||
enum VMStateFlags flags;
|
||||
const VMStateDescription *vmsd;
|
||||
int version_id;
|
||||
} VMStateField;
|
||||
|
||||
|
@ -349,6 +351,16 @@ extern const VMStateInfo vmstate_info_timer;
|
|||
+ type_check_array(_type,typeof_field(_state, _field),_num) \
|
||||
}
|
||||
|
||||
#define VMSTATE_STRUCT(_field, _state, _version, _vmsd, _type) { \
|
||||
.name = (stringify(_field)), \
|
||||
.version_id = (_version), \
|
||||
.vmsd = &(_vmsd), \
|
||||
.size = sizeof(_type), \
|
||||
.flags = VMS_STRUCT, \
|
||||
.offset = offsetof(_state, _field) \
|
||||
+ type_check(_type,typeof_field(_state, _field)) \
|
||||
}
|
||||
|
||||
/* _f : field name
|
||||
_n : num of elements
|
||||
_s : struct state name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue