diff options
author | Juan Quintela <quintela@redhat.com> | 2014-10-15 09:39:14 +0200 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2015-07-07 14:54:52 +0200 |
commit | df8961522a3d6bc7bb60c2830ef59e7c6c67a928 (patch) | |
tree | c92c35029082d110bfef52e2e33d7cd089f000a9 /migration/vmstate.c | |
parent | 13d16814d2058f10461e6987c8216950389c1310 (diff) |
vmstate: Create optional sections
To make sections optional, we need to do it at the beggining of the code.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'migration/vmstate.c')
-rw-r--r-- | migration/vmstate.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/migration/vmstate.c b/migration/vmstate.c index 6138d1acb7..e8ccf22f67 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -276,6 +276,17 @@ static void vmsd_desc_field_end(const VMStateDescription *vmsd, QJSON *vmdesc, json_end_object(vmdesc); } + +bool vmstate_save_needed(const VMStateDescription *vmsd, void *opaque) +{ + if (vmsd->needed && !vmsd->needed(opaque)) { + /* optional section not needed */ + return false; + } + return true; +} + + void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, void *opaque, QJSON *vmdesc) { |