diff options
author | Luiz Capitulino <lcapitulino@redhat.com> | 2010-02-10 23:49:59 -0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-02-19 15:18:17 -0600 |
commit | fe38a32acc6d1fb62ed74c351c1cc1d992aa8c50 (patch) | |
tree | 6c4f9e100f444cae94560e18004012f9196abea7 | |
parent | 9869622ee8d613d5d3cbb2a7d47a6192ecfe2e2b (diff) | |
download | qemu-fe38a32acc6d1fb62ed74c351c1cc1d992aa8c50.tar.gz qemu-fe38a32acc6d1fb62ed74c351c1cc1d992aa8c50.tar.bz2 qemu-fe38a32acc6d1fb62ed74c351c1cc1d992aa8c50.zip |
Monitor: Convert do_physical_memory_save() to cmd_new_ret()
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r-- | monitor.c | 9 | ||||
-rw-r--r-- | qemu-monitor.hx | 2 |
2 files changed, 8 insertions, 3 deletions
@@ -1466,7 +1466,7 @@ exit: return ret; } -static void do_physical_memory_save(Monitor *mon, const QDict *qdict, +static int do_physical_memory_save(Monitor *mon, const QDict *qdict, QObject **ret_data) { FILE *f; @@ -1475,11 +1475,12 @@ static void do_physical_memory_save(Monitor *mon, const QDict *qdict, uint32_t size = qdict_get_int(qdict, "size"); const char *filename = qdict_get_str(qdict, "filename"); target_phys_addr_t addr = qdict_get_int(qdict, "val"); + int ret = -1; f = fopen(filename, "wb"); if (!f) { qemu_error_new(QERR_OPEN_FILE_FAILED, filename); - return; + return -1; } while (size != 0) { l = sizeof(buf); @@ -1494,8 +1495,12 @@ static void do_physical_memory_save(Monitor *mon, const QDict *qdict, addr += l; size -= l; } + + ret = 0; + exit: fclose(f); + return ret; } static void do_sum(Monitor *mon, const QDict *qdict) diff --git a/qemu-monitor.hx b/qemu-monitor.hx index 5995cefac0..5ae1969c78 100644 --- a/qemu-monitor.hx +++ b/qemu-monitor.hx @@ -720,7 +720,7 @@ ETEXI .params = "addr size file", .help = "save to disk physical memory dump starting at 'addr' of size 'size'", .user_print = monitor_user_noop, - .mhandler.cmd_new = do_physical_memory_save, + .cmd_new_ret = do_physical_memory_save, }, STEXI |