cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
958e1b
From 9d268999694b9743808fb9454a4f1ab7a941b8a6 Mon Sep 17 00:00:00 2001
eb5a2f
From: Michael S. Tsirkin <mst@redhat.com>
958e1b
Date: Wed, 14 May 2014 08:52:51 +0200
958e1b
Subject: [PATCH 22/31] vmstate: add VMSTATE_VALIDATE
eb5a2f
eb5a2f
RH-Author: Michael S. Tsirkin <mst@redhat.com>
958e1b
Message-id: <1400057538-6975-4-git-send-email-mst@redhat.com>
958e1b
Patchwork-id: 58870
958e1b
O-Subject: [PATCH qemu-kvm RHEL7.1 3/5] vmstate: add VMSTATE_VALIDATE
958e1b
Bugzilla: 1095716
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