diff options
author | Peter Xu <peterx@redhat.com> | 2016-02-18 13:16:50 +0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-02-22 18:40:28 +0100 |
commit | ca1fc8c97e9f26690b1ddbbbced5bafb3d65f6b5 (patch) | |
tree | b37898d529036bdad488efdcfebe8f2d3241102e /dump.c | |
parent | 65d64f362326a57b590b8b76e3422030a2aa5c44 (diff) | |
download | qemu-ca1fc8c97e9f26690b1ddbbbced5bafb3d65f6b5.tar.gz qemu-ca1fc8c97e9f26690b1ddbbbced5bafb3d65f6b5.tar.bz2 qemu-ca1fc8c97e9f26690b1ddbbbced5bafb3d65f6b5.zip |
dump-guest-memory: introduce dump_process() helper function.
No functional change. Cleanup only.
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-Id: <1455772616-8668-6-git-send-email-peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'dump.c')
-rw-r--r-- | dump.c | 31 |
1 files changed, 21 insertions, 10 deletions
@@ -1465,6 +1465,9 @@ static void dump_init(DumpState *s, int fd, bool has_format, Error *err = NULL; int ret; + s->has_format = has_format; + s->format = format; + /* kdump-compressed is conflict with paging and filter */ if (has_format && format != DUMP_GUEST_MEMORY_FORMAT_ELF) { assert(!paging && !has_filter); @@ -1623,6 +1626,23 @@ cleanup: dump_cleanup(s); } +/* this operation might be time consuming. */ +static void dump_process(DumpState *s, Error **errp) +{ + Error *local_err = NULL; + + if (s->has_format && s->format != DUMP_GUEST_MEMORY_FORMAT_ELF) { + create_kdump_vmcore(s, &local_err); + } else { + create_vmcore(s, &local_err); + } + + s->status = (local_err ? DUMP_STATUS_FAILED : DUMP_STATUS_COMPLETED); + error_propagate(errp, local_err); + + dump_cleanup(s); +} + void qmp_dump_guest_memory(bool paging, const char *file, bool has_detach, bool detach, bool has_begin, int64_t begin, bool has_length, @@ -1708,16 +1728,7 @@ void qmp_dump_guest_memory(bool paging, const char *file, return; } - if (has_format && format != DUMP_GUEST_MEMORY_FORMAT_ELF) { - create_kdump_vmcore(s, &local_err); - } else { - create_vmcore(s, &local_err); - } - - s->status = (local_err ? DUMP_STATUS_FAILED : DUMP_STATUS_COMPLETED); - error_propagate(errp, local_err); - - dump_cleanup(s); + dump_process(s, errp); } DumpGuestMemoryCapability *qmp_query_dump_guest_memory_capability(Error **errp) |