9ae3a8
From 6fa0fc12221718bb405d01683acf635a24c34daf Mon Sep 17 00:00:00 2001
9ae3a8
Message-Id: <6fa0fc12221718bb405d01683acf635a24c34daf.1387298827.git.minovotn@redhat.com>
9ae3a8
In-Reply-To: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
9ae3a8
References: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
9ae3a8
From: "Michael S. Tsirkin" <mst@redhat.com>
9ae3a8
Date: Tue, 17 Dec 2013 15:19:24 +0100
9ae3a8
Subject: [PATCH 54/56] acpi-build: fix support for glib < 2.22
9ae3a8
9ae3a8
RH-Author: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
Message-id: <1387293161-4085-55-git-send-email-mst@redhat.com>
9ae3a8
Patchwork-id: 56360
9ae3a8
O-Subject: [PATCH qemu-kvm RHEL7.0 v2 54/57] acpi-build: fix support for glib < 2.22
9ae3a8
Bugzilla: 1034876
9ae3a8
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
9ae3a8
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
9ae3a8
glib < 2.22 does not have g_array_get_element_size,
9ae3a8
limit it's use (to check all elements are 1 byte
9ae3a8
in size) to newer glib.
9ae3a8
9ae3a8
This fixes build on RHEL 5.3.
9ae3a8
9ae3a8
Reported-by: Richard Henderson <rth@redhat.com>
9ae3a8
Reported-by: Erik Rull <erik.rull@rdsoftware.de>
9ae3a8
Tested-by: Richard Henderson <rth@redhat.com>
9ae3a8
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
Message-id: 20131125220039.GA16386@redhat.com
9ae3a8
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
9ae3a8
(cherry picked from commit 134d42d614768b2803e551621f6654dab1fdc2d2)
9ae3a8
---
9ae3a8
 hw/i386/acpi-build.c | 6 ++----
9ae3a8
 1 file changed, 2 insertions(+), 4 deletions(-)
9ae3a8
9ae3a8
Signed-off-by: Michal Novotny <minovotn@redhat.com>
9ae3a8
---
9ae3a8
 hw/i386/acpi-build.c | 6 ++----
9ae3a8
 1 file changed, 2 insertions(+), 4 deletions(-)
9ae3a8
9ae3a8
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
9ae3a8
index 4074350..316d6d3 100644
9ae3a8
--- a/hw/i386/acpi-build.c
9ae3a8
+++ b/hw/i386/acpi-build.c
9ae3a8
@@ -425,7 +425,7 @@ static inline void *acpi_data_push(GArray *table_data, unsigned size)
9ae3a8
 
9ae3a8
 static unsigned acpi_data_len(GArray *table)
9ae3a8
 {
9ae3a8
-#if GLIB_CHECK_VERSION(2, 14, 0)
9ae3a8
+#if GLIB_CHECK_VERSION(2, 22, 0)
9ae3a8
     assert(g_array_get_element_size(table) == 1);
9ae3a8
 #endif
9ae3a8
     return table->len;
9ae3a8
@@ -436,9 +436,7 @@ static void acpi_align_size(GArray *blob, unsigned align)
9ae3a8
     /* Align size to multiple of given size. This reduces the chance
9ae3a8
      * we need to change size in the future (breaking cross version migration).
9ae3a8
      */
9ae3a8
-    g_array_set_size(blob, (ROUND_UP(acpi_data_len(blob), align) +
9ae3a8
-                            g_array_get_element_size(blob) - 1) /
9ae3a8
-                             g_array_get_element_size(blob));
9ae3a8
+    g_array_set_size(blob, ROUND_UP(acpi_data_len(blob), align));
9ae3a8
 }
9ae3a8
 
9ae3a8
 /* Get pointer within table in a safe manner */
9ae3a8
-- 
9ae3a8
1.7.11.7
9ae3a8