vmstate: add subsections code

This commit adds subsections for each device section.
Subsections is the way to handle information that don't need to be sent
to de destination of a migration because its values are not needed.  It is
the way to handle optional information.  Notice that only the source can
decide if the information is optional or not.  The destination needs to
understand all subsections that it receives to have a sucessful load.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Juan Quintela 2010-07-26 21:38:43 +02:00 committed by Anthony Liguori
parent 57338424aa
commit 811814bd28
2 changed files with 91 additions and 1 deletions

View file

@ -313,6 +313,11 @@ typedef struct {
bool (*field_exists)(void *opaque, int version_id);
} VMStateField;
typedef struct VMStateSubsection {
const VMStateDescription *vmsd;
bool (*needed)(void *opaque);
} VMStateSubsection;
struct VMStateDescription {
const char *name;
int version_id;
@ -323,6 +328,7 @@ struct VMStateDescription {
int (*post_load)(void *opaque, int version_id);
void (*pre_save)(void *opaque);
VMStateField *fields;
const VMStateSubsection *subsections;
};
extern const VMStateInfo vmstate_info_int8;