summaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2010-02-10 23:49:58 -0200
committerAnthony Liguori <aliguori@us.ibm.com>2010-02-19 15:18:17 -0600
commit9869622ee8d613d5d3cbb2a7d47a6192ecfe2e2b (patch)
treeef44a94a1172bdaf2ad1a823531420e4b002fd38 /monitor.c
parentb5d17adb932b16226c8073c3411cf5c93df22cb8 (diff)
downloadqemu-9869622ee8d613d5d3cbb2a7d47a6192ecfe2e2b.tar.gz
qemu-9869622ee8d613d5d3cbb2a7d47a6192ecfe2e2b.tar.bz2
qemu-9869622ee8d613d5d3cbb2a7d47a6192ecfe2e2b.zip
Monitor: Convert do_memory_save() to cmd_new_ret()
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/monitor.c b/monitor.c
index 9338d13e83..7747449bd7 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1428,7 +1428,7 @@ static void do_print(Monitor *mon, const QDict *qdict)
monitor_printf(mon, "\n");
}
-static void do_memory_save(Monitor *mon, const QDict *qdict, QObject **ret_data)
+static int do_memory_save(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
FILE *f;
uint32_t size = qdict_get_int(qdict, "size");
@@ -1437,13 +1437,14 @@ static void do_memory_save(Monitor *mon, const QDict *qdict, QObject **ret_data)
uint32_t l;
CPUState *env;
uint8_t buf[1024];
+ int ret = -1;
env = mon_get_cpu();
f = fopen(filename, "wb");
if (!f) {
qemu_error_new(QERR_OPEN_FILE_FAILED, filename);
- return;
+ return -1;
}
while (size != 0) {
l = sizeof(buf);
@@ -1457,8 +1458,12 @@ static void do_memory_save(Monitor *mon, const QDict *qdict, QObject **ret_data)
addr += l;
size -= l;
}
+
+ ret = 0;
+
exit:
fclose(f);
+ return ret;
}
static void do_physical_memory_save(Monitor *mon, const QDict *qdict,