diff mbox

[RFC,v2,4/5] vmstate: add VMSTATE_TEST

Message ID 1395671853-2685-5-git-send-email-mst@redhat.com
State New
Headers show

Commit Message

Michael S. Tsirkin March 24, 2014, 2:38 p.m. UTC
Can validate state using VMS_NONE and VMS_MUST_EXIST

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/migration/vmstate.h | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox

Patch

diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index eb90cef..e220f09 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -205,6 +205,12 @@  extern const VMStateInfo vmstate_info_bitmap;
     .offset       = vmstate_offset_value(_state, _field, _type),     \
 }
 
+#define VMSTATE_TEST(_name, _test) { \
+    .name         = (_name),                                         \
+    .field_exists = (_test),                                         \
+    .flags        = VMS_NONE | VMS_MUST_EXIST,                       \
+}
+
 #define VMSTATE_POINTER(_field, _state, _version, _info, _type) {    \
     .name       = (stringify(_field)),                               \
     .version_id = (_version),                                        \