summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2014-04-03 19:50:35 +0300
committerMichael Roth <mdroth@linux.vnet.ibm.com>2014-06-26 13:55:15 -0500
commit29e2bbef19a9593eb20fd2286f38f1a90c0fdefd (patch)
tree7463d3e73f818b47f6e98a9307fe1ee30e088f7e /include
parenta075a3a27e97c1f1f7cf924f6d48827644229581 (diff)
downloadqemu-29e2bbef19a9593eb20fd2286f38f1a90c0fdefd.tar.gz
vmstate: add VMSTATE_VALIDATE
Validate state using VMS_ARRAY with num = 0 and VMS_MUST_EXIST Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> (cherry picked from commit 4082f0889ba04678fc14816c53e1b9251ea9207e) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'include')
-rw-r--r--include/migration/vmstate.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 13fb78d9b9..3007d89842 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -204,6 +204,14 @@ extern const VMStateInfo vmstate_info_bitmap;
.offset = vmstate_offset_value(_state, _field, _type), \
}
+/* Validate state using a boolean predicate. */
+#define VMSTATE_VALIDATE(_name, _test) { \
+ .name = (_name), \
+ .field_exists = (_test), \
+ .flags = VMS_ARRAY | VMS_MUST_EXIST, \
+ .num = 0, /* 0 elements: no data, only run _test */ \
+}
+
#define VMSTATE_POINTER(_field, _state, _version, _info, _type) { \
.name = (stringify(_field)), \
.version_id = (_version), \