aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJianjun Duan <duanj@linux.vnet.ibm.com>2017-01-19 11:00:50 -0800
committerDr. David Alan Gilbert <dgilbert@redhat.com>2017-01-24 17:54:47 +0000
commit2c21ee769e4674348560480cecc7b20f3750ee84 (patch)
tree250ee21fc200f8901ee437569e153e952e6c1342 /include
parentd7fc72ceb52ad77f5f29befc04d5215096b8caa8 (diff)
migration: extend VMStateInfo
Current migration code cannot handle some data structures such as QTAILQ in qemu/queue.h. Here we extend the signatures of put/get in VMStateInfo so that customized handling is supported. put now will return int type. Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Jianjun Duan <duanj@linux.vnet.ibm.com> Message-Id: <1484852453-12728-2-git-send-email-duanj@linux.vnet.ibm.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/migration/vmstate.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 2125829a16..7e61b1e1da 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -81,11 +81,20 @@ void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque);
typedef struct VMStateInfo VMStateInfo;
typedef struct VMStateDescription VMStateDescription;
-
+typedef struct VMStateField VMStateField;
+
+/* VMStateInfo allows customized migration of objects that don't fit in
+ * any category in VMStateFlags. Additional information is always passed
+ * into get and put in terms of field and vmdesc parameters. However
+ * these two parameters should only be used in cases when customized
+ * handling is needed, such as QTAILQ. For primitive data types such as
+ * integer, field and vmdesc parameters should be ignored inside get/put.
+ */
struct VMStateInfo {
const char *name;
- int (*get)(QEMUFile *f, void *pv, size_t size);
- void (*put)(QEMUFile *f, void *pv, size_t size);
+ int (*get)(QEMUFile *f, void *pv, size_t size, VMStateField *field);
+ int (*put)(QEMUFile *f, void *pv, size_t size, VMStateField *field,
+ QJSON *vmdesc);
};
enum VMStateFlags {
@@ -192,7 +201,7 @@ typedef enum {
MIG_PRI_MAX,
} MigrationPriority;
-typedef struct {
+struct VMStateField {
const char *name;
size_t offset;
size_t size;
@@ -205,7 +214,7 @@ typedef struct {
const VMStateDescription *vmsd;
int version_id;
bool (*field_exists)(void *opaque, int version_id);
-} VMStateField;
+};
struct VMStateDescription {
const char *name;