On Thu, Jan 13, 2011 at 5:15 PM, Yoshiaki Tamura <tamura.yoshiaki@xxxxxxxxxxxxx> wrote: > Introduce qemu_savevm_state_{begin,commit} to send the memory and > device info together, while avoiding cancelling memory state tracking. > > Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@xxxxxxxxxxxxx> > --- > Âsavevm.c | Â 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > Âsysemu.h | Â Â2 + > Â2 files changed, 90 insertions(+), 0 deletions(-) > > diff --git a/savevm.c b/savevm.c > index ebb3ef8..9d20c37 100644 > --- a/savevm.c > +++ b/savevm.c > @@ -1722,6 +1722,94 @@ int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f) > Â Â return 0; > Â} > > +int qemu_savevm_trans_begin(Monitor *mon, QEMUFile *f, int init) > +{ > + Â ÂSaveStateEntry *se; > + Â Âint skipped = 0; > + > + Â ÂQTAILQ_FOREACH(se, &savevm_handlers, entry) { > + Â Â Â Âint len, stage, ret; > + > + Â Â Â Âif (se->save_live_state == NULL) > + Â Â Â Â Â Âcontinue; Missing braces. > + > + Â Â Â Â/* Section type */ > + Â Â Â Âqemu_put_byte(f, QEMU_VM_SECTION_START); > + Â Â Â Âqemu_put_be32(f, se->section_id); > + > + Â Â Â Â/* ID string */ > + Â Â Â Âlen = strlen(se->idstr); > + Â Â Â Âqemu_put_byte(f, len); > + Â Â Â Âqemu_put_buffer(f, (uint8_t *)se->idstr, len); > + > + Â Â Â Âqemu_put_be32(f, se->instance_id); > + Â Â Â Âqemu_put_be32(f, se->version_id); > + > + Â Â Â Âstage = init ? QEMU_VM_SECTION_START : QEMU_VM_SECTION_PART; > + Â Â Â Âret = se->save_live_state(mon, f, stage, se->opaque); > + Â Â Â Âif (!ret) { > + Â Â Â Â Â Âskipped++; > + Â Â Â Â} > + Â Â} > + > + Â Âif (qemu_file_has_error(f)) > + Â Â Â Âreturn -EIO; Also here > + > + Â Âreturn skipped; > +} > + > +int qemu_savevm_trans_complete(Monitor *mon, QEMUFile *f) > +{ > + Â ÂSaveStateEntry *se; > + > + Â Âcpu_synchronize_all_states(); > + > + Â ÂQTAILQ_FOREACH(se, &savevm_handlers, entry) { > + Â Â Â Âint ret; > + > + Â Â Â Âif (se->save_live_state == NULL) > + Â Â Â Â Â Âcontinue; here > + > + Â Â Â Â/* Section type */ > + Â Â Â Âqemu_put_byte(f, QEMU_VM_SECTION_PART); > + Â Â Â Âqemu_put_be32(f, se->section_id); > + > + Â Â Â Âret = se->save_live_state(mon, f, QEMU_VM_SECTION_PART, se->opaque); > + Â Â Â Âif (!ret) { > + Â Â Â Â Â Â/* do not proceed to the next vmstate. */ > + Â Â Â Â Â Âreturn 1; > + Â Â Â Â} > + Â Â} > + > + Â ÂQTAILQ_FOREACH(se, &savevm_handlers, entry) { > + Â Â Â Âint len; > + > + Â Â Â Âif (se->save_state == NULL && se->vmsd == NULL) > + Â Â Â Â Â Âcontinue; here > + > + Â Â Â Â/* Section type */ > + Â Â Â Âqemu_put_byte(f, QEMU_VM_SECTION_FULL); > + Â Â Â Âqemu_put_be32(f, se->section_id); > + > + Â Â Â Â/* ID string */ > + Â Â Â Âlen = strlen(se->idstr); > + Â Â Â Âqemu_put_byte(f, len); > + Â Â Â Âqemu_put_buffer(f, (uint8_t *)se->idstr, len); > + > + Â Â Â Âqemu_put_be32(f, se->instance_id); > + Â Â Â Âqemu_put_be32(f, se->version_id); > + > + Â Â Â Âvmstate_save(f, se); > + Â Â} > + > + Â Âqemu_put_byte(f, QEMU_VM_EOF); > + > + Â Âif (qemu_file_has_error(f)) > + Â Â Â Âreturn -EIO; and here. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html