aboutsummaryrefslogtreecommitdiff
path: root/hw/hw.h
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2009-08-20 19:42:29 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-08-27 20:30:21 -0500
commitec245e2111ec59cd04e2510a183e43dee3fb85ce (patch)
tree7ee9a56dd6f0d3a80b480ecfd07750fd0236d741 /hw/hw.h
parent695dcf71eb463c93c9b3418cffdf3be437dee14a (diff)
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>
Diffstat (limited to 'hw/hw.h')
-rw-r--r--hw/hw.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/hw/hw.h b/hw/hw.h
index a8534fa1e8..2ee307e7fb 100644
--- a/hw/hw.h
+++ b/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