render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
9119d9
From 2236118c82469a2a65df37194a0fbc681d7bb366 Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <2236118c82469a2a65df37194a0fbc681d7bb366@dist-git>
9119d9
From: Martin Kletzander <mkletzan@redhat.com>
9119d9
Date: Sat, 4 Oct 2014 10:53:20 +0200
9119d9
Subject: [PATCH] minor shmem clean-ups
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1126991
9119d9
9119d9
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9119d9
(cherry picked from commit 34f514778ba55a0031ea21d6b3006317c1f607b5)
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 docs/formatdomain.html.in | 2 +-
9119d9
 src/conf/domain_conf.c    | 5 ++---
9119d9
 src/qemu/qemu_command.c   | 5 ++---
9119d9
 3 files changed, 5 insertions(+), 7 deletions(-)
9119d9
9119d9
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
9119d9
index dac81ab..e00fe47 100644
9119d9
--- a/docs/formatdomain.html.in
9119d9
+++ b/docs/formatdomain.html.in
9119d9
@@ -5587,7 +5587,7 @@ qemu-kvm -net nic,model=? /dev/null
9119d9
     

9119d9
       A shared memory device allows to share a memory region between
9119d9
       different virtual machines and the host.
9119d9
-      Since 1.2.9, QEMU and KVM only
9119d9
+      Since 1.2.10, QEMU and KVM only
9119d9
     

9119d9
 
9119d9
 
9119d9
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
9119d9
index d61358b..b109330 100644
9119d9
--- a/src/conf/domain_conf.c
9119d9
+++ b/src/conf/domain_conf.c
9119d9
@@ -17552,7 +17552,7 @@ virDomainShmemDefFormat(virBufferPtr buf,
9119d9
                         virDomainShmemDefPtr def,
9119d9
                         unsigned int flags)
9119d9
 {
9119d9
-    virBufferAsprintf(buf, "<shmem name='%s'", def->name);
9119d9
+    virBufferEscapeString(buf, "<shmem name='%s'", def->name);
9119d9
 
9119d9
     if (!def->size &&
9119d9
         !def->server.enabled &&
9119d9
@@ -17567,8 +17567,7 @@ virDomainShmemDefFormat(virBufferPtr buf,
9119d9
     virBufferAdjustIndent(buf, 2);
9119d9
 
9119d9
     if (def->size)
9119d9
-        virBufferAsprintf(buf, "<size unit='M'>%llu</size>\n",
9119d9
-                          VIR_DIV_UP(def->size, 1024 * 1024));
9119d9
+        virBufferAsprintf(buf, "<size unit='M'>%llu</size>\n", def->size >> 20);
9119d9
 
9119d9
     if (def->server.enabled) {
9119d9
         virBufferAddLit(buf, "
9119d9
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
9119d9
index 3adf19e..e4962ee 100644
9119d9
--- a/src/qemu/qemu_command.c
9119d9
+++ b/src/qemu/qemu_command.c
9119d9
@@ -7518,7 +7518,7 @@ qemuBuildShmemDevCmd(virCommandPtr cmd,
9119d9
         /*
9119d9
          * Thanks to our parsing code, we have a guarantee that the
9119d9
          * size is power of two and is at least a mebibyte in size.
9119d9
-         * But because it may change inthe future, the checks are
9119d9
+         * But because it may change in the future, the checks are
9119d9
          * doubled in here.
9119d9
          */
9119d9
         if (shmem->size & (shmem->size - 1)) {
9119d9
@@ -7531,8 +7531,7 @@ qemuBuildShmemDevCmd(virCommandPtr cmd,
9119d9
                            _("shmem size must be at least 1 MiB"));
9119d9
             goto error;
9119d9
         }
9119d9
-        virBufferAsprintf(&buf, ",size=%llum",
9119d9
-                          VIR_DIV_UP(shmem->size, 1024 * 1024));
9119d9
+        virBufferAsprintf(&buf, ",size=%llum", shmem->size >> 20);
9119d9
     }
9119d9
 
9119d9
     if (!shmem->server.enabled) {
9119d9
-- 
9119d9
2.1.2
9119d9