yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
eb5a2f
From 1886b0146de0847ff5f81e5d89ba3893bbab63fc Mon Sep 17 00:00:00 2001
eb5a2f
From: Michael S. Tsirkin <mst@redhat.com>
eb5a2f
Date: Wed, 14 May 2014 08:24:33 +0200
eb5a2f
Subject: [PATCH 11/30] vmstate: add VMSTATE_VALIDATE
eb5a2f
eb5a2f
RH-Author: Michael S. Tsirkin <mst@redhat.com>
eb5a2f
Message-id: <1400055633-6261-3-git-send-email-mst@redhat.com>
eb5a2f
Patchwork-id: 58850
eb5a2f
O-Subject: [PATCH qemu-kvm RHEL7.0.z 3/5] vmstate: add VMSTATE_VALIDATE
eb5a2f
Bugzilla: 1095706
eb5a2f
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
eb5a2f
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
eb5a2f
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
eb5a2f
RH-Acked-by: Juan Quintela <quintela@redhat.com>
eb5a2f
eb5a2f
Validate state using VMS_ARRAY with num = 0 and VMS_MUST_EXIST
eb5a2f
eb5a2f
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
eb5a2f
Signed-off-by: Juan Quintela <quintela@redhat.com>
eb5a2f
(cherry picked from commit 4082f0889ba04678fc14816c53e1b9251ea9207e)
eb5a2f
---
eb5a2f
 include/migration/vmstate.h | 8 ++++++++
eb5a2f
 1 file changed, 8 insertions(+)
eb5a2f
eb5a2f
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
eb5a2f
---
eb5a2f
 include/migration/vmstate.h |    8 ++++++++
eb5a2f
 1 files changed, 8 insertions(+), 0 deletions(-)
eb5a2f
eb5a2f
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
eb5a2f
index 95d1ce6..f2652e6 100644
eb5a2f
--- a/include/migration/vmstate.h
eb5a2f
+++ b/include/migration/vmstate.h
eb5a2f
@@ -202,6 +202,14 @@ extern const VMStateInfo vmstate_info_bitmap;
eb5a2f
     .offset       = vmstate_offset_value(_state, _field, _type),     \
eb5a2f
 }
eb5a2f
 
eb5a2f
+/* Validate state using a boolean predicate. */
eb5a2f
+#define VMSTATE_VALIDATE(_name, _test) { \
eb5a2f
+    .name         = (_name),                                         \
eb5a2f
+    .field_exists = (_test),                                         \
eb5a2f
+    .flags        = VMS_ARRAY | VMS_MUST_EXIST,                      \
eb5a2f
+    .num          = 0, /* 0 elements: no data, only run _test */     \
eb5a2f
+}
eb5a2f
+
eb5a2f
 #define VMSTATE_POINTER(_field, _state, _version, _info, _type) {    \
eb5a2f
     .name       = (stringify(_field)),                               \
eb5a2f
     .version_id = (_version),                                        \
eb5a2f
-- 
eb5a2f
1.7.1
eb5a2f