aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2009-08-20 19:42:26 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-08-27 20:30:21 -0500
commitdde0463b4e5e78ab636a298ae28b9a0ba77bc595 (patch)
tree265ba7bf6360a9e42ba177b6bd414f651b647128 /hw
parent9ed7d6ae0fe7abb444c65caaadb5ef307df82c60 (diff)
Add VMState support for pointers
This patch adds support for saving pointers to values Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/hw.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/hw/hw.h b/hw/hw.h
index 659a3d619e..9a1ba18a86 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -281,6 +281,7 @@ struct VMStateInfo {
enum VMStateFlags {
VMS_SINGLE = 0x001,
+ VMS_POINTER = 0x002,
};
typedef struct {
@@ -311,6 +312,8 @@ extern const VMStateInfo vmstate_info_uint16;
extern const VMStateInfo vmstate_info_uint32;
extern const VMStateInfo vmstate_info_uint64;
+extern const VMStateInfo vmstate_info_timer;
+
#define VMSTATE_SINGLE(_field, _state, _version, _info, _type) { \
.name = (stringify(_field)), \
.version_id = (_version), \
@@ -321,6 +324,16 @@ extern const VMStateInfo vmstate_info_uint64;
+ type_check(_type,typeof_field(_state, _field)) \
}
+#define VMSTATE_POINTER(_field, _state, _version, _info, _type) { \
+ .name = (stringify(_field)), \
+ .version_id = (_version), \
+ .info = &(_info), \
+ .size = sizeof(_type), \
+ .flags = VMS_SINGLE|VMS_POINTER, \
+ .offset = offsetof(_state, _field) \
+ + type_check(_type,typeof_field(_state, _field)) \
+}
+
/* _f : field name
_s : struct state name
_v : version
@@ -362,6 +375,12 @@ extern const VMStateInfo vmstate_info_uint64;
#define VMSTATE_UINT64(_f, _s) \
VMSTATE_UINT64_V(_f, _s, 0)
+#define VMSTATE_TIMER_V(_f, _s, _v) \
+ VMSTATE_POINTER(_f, _s, _v, vmstate_info_timer, QEMUTimer *)
+
+#define VMSTATE_TIMER(_f, _s) \
+ VMSTATE_TIMER_V(_f, _s, 0)
+
#define VMSTATE_END_OF_LIST() \
{}