]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
vmstate: add VMSTATE_VALIDATE
authorMichael S. Tsirkin <mst@redhat.com>
Thu, 3 Apr 2014 16:50:35 +0000 (19:50 +0300)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 26 Jun 2014 18:55:15 +0000 (13:55 -0500)
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>
include/migration/vmstate.h

index 13fb78d9b9137979994fec1735ecb8f65ca4836d..3007d89842042789b76b8cb1c34dc49f1574689c 100644 (file)
@@ -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),                                        \