vmstate.h: introduce VMSTATE_BUFFER_POINTER_UNSAFE macro
authorIgor Mitsyanko <i.mitsyanko@gmail.com>
Fri, 5 Apr 2013 15:17:58 +0000 (16:17 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 5 Apr 2013 15:17:58 +0000 (16:17 +0100)
Macro could be used to migrate a dynamically allocated buffer of known size.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1362923278-4080-2-git-send-email-i.mitsyanko@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
include/migration/vmstate.h

index 65918a9abe52f44893dca1f99e3fa200c0912c86..8184123448274df0df6d9db255c1abc559668afd 100644 (file)
@@ -436,6 +436,15 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset     = offsetof(_state, _field),                          \
 }
 
+#define VMSTATE_BUFFER_POINTER_UNSAFE(_field, _state, _version, _size) { \
+    .name       = (stringify(_field)),                               \
+    .version_id = (_version),                                        \
+    .size       = (_size),                                           \
+    .info       = &vmstate_info_buffer,                              \
+    .flags      = VMS_BUFFER|VMS_POINTER,                            \
+    .offset     = offsetof(_state, _field),                          \
+}
+
 #define VMSTATE_UNUSED_BUFFER(_test, _version, _size) {              \
     .name         = "unused",                                        \
     .field_exists = (_test),                                         \