diff options
author | Jianjun Duan | 2017-01-19 20:00:50 +0100 |
---|---|---|
committer | Dr. David Alan Gilbert | 2017-01-24 18:54:47 +0100 |
commit | 2c21ee769e4674348560480cecc7b20f3750ee84 (patch) | |
tree | 250ee21fc200f8901ee437569e153e952e6c1342 /include/migration/vmstate.h | |
parent | MAINTAINERS: Add myself as a migration submaintainer (diff) | |
download | qemu-2c21ee769e4674348560480cecc7b20f3750ee84.tar.gz qemu-2c21ee769e4674348560480cecc7b20f3750ee84.tar.xz qemu-2c21ee769e4674348560480cecc7b20f3750ee84.zip |
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/migration/vmstate.h')
-rw-r--r-- | include/migration/vmstate.h | 19 |
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; |