[PATCH 13/35] qemu: monitor: Make qemuMonitorSetBalloon operate on unsinged long long

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 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 45414cf..e9c57f1 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 76380a0..d30b514 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 2287398..e6da804 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 43adc90..05c9b29 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 ad36dd0..1b6bc02 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 40edc9a..6f9a215 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,
-- 
2.4.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]