qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 07/97] vmstate: create test functions for versions u


From: Juan Quintela
Subject: [Qemu-devel] [PATCH 07/97] vmstate: create test functions for versions until 15
Date: Mon, 7 Apr 2014 05:20:25 +0200

Using macros, just to avoid repeating code.

Signed-off-by: Juan Quintela <address@hidden>
---
 include/migration/vmstate.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index e7e1705..001ff76 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -769,4 +769,26 @@ void vmstate_register_ram(struct MemoryRegion *memory, 
DeviceState *dev);
 void vmstate_unregister_ram(struct MemoryRegion *memory, DeviceState *dev);
 void vmstate_register_ram_global(struct MemoryRegion *memory);

+/* version is X or bigger */
+#define VMSTATE_X_PLUS(X)\
+static inline bool vmstate_##X##_plus(void *opaque, int version_id)\
+{\
+    return version_id >= X;\
+}
+
+VMSTATE_X_PLUS(2)
+VMSTATE_X_PLUS(3)
+VMSTATE_X_PLUS(4)
+VMSTATE_X_PLUS(5)
+VMSTATE_X_PLUS(6)
+VMSTATE_X_PLUS(7)
+VMSTATE_X_PLUS(8)
+VMSTATE_X_PLUS(9)
+VMSTATE_X_PLUS(10)
+VMSTATE_X_PLUS(11)
+VMSTATE_X_PLUS(12)
+VMSTATE_X_PLUS(13)
+VMSTATE_X_PLUS(14)
+VMSTATE_X_PLUS(15)
+
 #endif
-- 
1.9.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]