From 987b70777ae4b9e4b97fe01885721545f36496f2 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 27 May 2015 14:03:17 +0200 Subject: [PATCH] qemu: monitor: Make qemuMonitorSetBalloon operate on unsinged long long --- src/qemu/qemu_monitor.c | 8 ++++++-- src/qemu/qemu_monitor.h | 2 +- src/qemu/qemu_monitor_json.c | 12 +++++------- src/qemu/qemu_monitor_json.h | 2 +- src/qemu/qemu_monitor_text.c | 12 +++++------- src/qemu/qemu_monitor_text.h | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 45414cfee7..e9c57f1897 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2022,11 +2022,15 @@ qemuMonitorExpirePassword(qemuMonitorPtr mon, } +/* + * Returns: 0 if balloon not supported, +1 if balloon adjust worked + * or -1 on failure + */ int qemuMonitorSetBalloon(qemuMonitorPtr mon, - unsigned long newmem) + unsigned long long newmem) { - VIR_DEBUG("newmem=%lu", newmem); + VIR_DEBUG("newmem=%llu", newmem); QEMU_CHECK_MONITOR(mon); diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 76380a05bf..d30b514e85 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -401,7 +401,7 @@ int qemuMonitorExpirePassword(qemuMonitorPtr mon, int type, const char *expire_time); int qemuMonitorSetBalloon(qemuMonitorPtr mon, - unsigned long newmem); + unsigned long long newmem); int qemuMonitorSetCPU(qemuMonitorPtr mon, int cpu, bool online); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 2287398586..e6da804aeb 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2175,16 +2175,14 @@ int qemuMonitorJSONExpirePassword(qemuMonitorPtr mon, return ret; } -/* - * Returns: 0 if balloon not supported, +1 if balloon adjust worked - * or -1 on failure - */ -int qemuMonitorJSONSetBalloon(qemuMonitorPtr mon, - unsigned long newmem) + +int +qemuMonitorJSONSetBalloon(qemuMonitorPtr mon, + unsigned long long newmem) { int ret; virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("balloon", - "U:value", ((unsigned long long)newmem)*1024, + "U:value", newmem * 1024, NULL); virJSONValuePtr reply = NULL; if (!cmd) diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 43adc906cb..05c9b29f58 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -94,7 +94,7 @@ int qemuMonitorJSONExpirePassword(qemuMonitorPtr mon, const char *protocol, const char *expire_time); int qemuMonitorJSONSetBalloon(qemuMonitorPtr mon, - unsigned long newmem); + unsigned long long newmem); int qemuMonitorJSONSetCPU(qemuMonitorPtr mon, int cpu, bool online); int qemuMonitorJSONEjectMedia(qemuMonitorPtr mon, diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index ad36dd0933..1b6bc02d9f 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -1110,12 +1110,10 @@ int qemuMonitorTextExpirePassword(qemuMonitorPtr mon, return ret; } -/* - * Returns: 0 if balloon not supported, +1 if balloon adjust worked - * or -1 on failure - */ -int qemuMonitorTextSetBalloon(qemuMonitorPtr mon, - unsigned long newmem) + +int +qemuMonitorTextSetBalloon(qemuMonitorPtr mon, + unsigned long long newmem) { char *cmd; char *reply = NULL; @@ -1125,7 +1123,7 @@ int qemuMonitorTextSetBalloon(qemuMonitorPtr mon, * 'newmem' is in KB, QEMU monitor works in MB, and we all wish * we just worked in bytes with unsigned long long everywhere. */ - if (virAsprintf(&cmd, "balloon %lu", VIR_DIV_UP(newmem, 1024)) < 0) + if (virAsprintf(&cmd, "balloon %llu", VIR_DIV_UP(newmem, 1024)) < 0) return -1; if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { diff --git a/src/qemu/qemu_monitor_text.h b/src/qemu/qemu_monitor_text.h index 40edc9a258..6f9a215d0d 100644 --- a/src/qemu/qemu_monitor_text.h +++ b/src/qemu/qemu_monitor_text.h @@ -79,7 +79,7 @@ int qemuMonitorTextExpirePassword(qemuMonitorPtr mon, const char *protocol, const char *expire_time); int qemuMonitorTextSetBalloon(qemuMonitorPtr mon, - unsigned long newmem); + unsigned long long newmem); int qemuMonitorTextSetCPU(qemuMonitorPtr mon, int cpu, bool online); int qemuMonitorTextEjectMedia(qemuMonitorPtr mon, -- GitLab