thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
0a122b
From 80522ccccfe378cb1b9ff1d6fb468f275aa69c86 Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <80522ccccfe378cb1b9ff1d6fb468f275aa69c86.1387298827.git.minovotn@redhat.com>
0a122b
In-Reply-To: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
0a122b
References: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
0a122b
From: "Michael S. Tsirkin" <mst@redhat.com>
0a122b
Date: Tue, 17 Dec 2013 15:19:21 +0100
0a122b
Subject: [PATCH 53/56] acpi-build: fix build on glib < 2.14
0a122b
0a122b
RH-Author: Michael S. Tsirkin <mst@redhat.com>
0a122b
Message-id: <1387293161-4085-54-git-send-email-mst@redhat.com>
0a122b
Patchwork-id: 56359
0a122b
O-Subject: [PATCH qemu-kvm RHEL7.0 v2 53/57] acpi-build: fix build on glib < 2.14
0a122b
Bugzilla: 1034876
0a122b
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
0a122b
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
0a122b
g_array_get_element_size was only added in glib 2.14.
0a122b
Fortunately we don't use it for any arrays where
0a122b
element size is > 1, so just add an assert.
0a122b
0a122b
Reported-by: Richard Henderson <rth@redhat.com>
0a122b
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
0a122b
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
Message-id: 1385036128-8753-2-git-send-email-mst@redhat.com
0a122b
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
0a122b
(cherry picked from commit b15654c21acef4d2bc17e6ac528c6c93abbb7e1e)
0a122b
---
0a122b
 hw/i386/acpi-build.c         | 5 ++++-
0a122b
 hw/i386/bios-linker-loader.c | 8 ++++----
0a122b
 2 files changed, 8 insertions(+), 5 deletions(-)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 hw/i386/acpi-build.c         | 5 ++++-
0a122b
 hw/i386/bios-linker-loader.c | 8 ++++----
0a122b
 2 files changed, 8 insertions(+), 5 deletions(-)
0a122b
0a122b
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
0a122b
index 4e2d709..4074350 100644
0a122b
--- a/hw/i386/acpi-build.c
0a122b
+++ b/hw/i386/acpi-build.c
0a122b
@@ -425,7 +425,10 @@ static inline void *acpi_data_push(GArray *table_data, unsigned size)
0a122b
 
0a122b
 static unsigned acpi_data_len(GArray *table)
0a122b
 {
0a122b
-    return table->len * g_array_get_element_size(table);
0a122b
+#if GLIB_CHECK_VERSION(2, 14, 0)
0a122b
+    assert(g_array_get_element_size(table) == 1);
0a122b
+#endif
0a122b
+    return table->len;
0a122b
 }
0a122b
 
0a122b
 static void acpi_align_size(GArray *blob, unsigned align)
0a122b
diff --git a/hw/i386/bios-linker-loader.c b/hw/i386/bios-linker-loader.c
0a122b
index 0833853..fd23611 100644
0a122b
--- a/hw/i386/bios-linker-loader.c
0a122b
+++ b/hw/i386/bios-linker-loader.c
0a122b
@@ -90,7 +90,7 @@ enum {
0a122b
 
0a122b
 GArray *bios_linker_loader_init(void)
0a122b
 {
0a122b
-    return g_array_new(false, true /* clear */, sizeof(BiosLinkerLoaderEntry));
0a122b
+    return g_array_new(false, true /* clear */, 1);
0a122b
 }
0a122b
 
0a122b
 /* Free linker wrapper and return the linker array. */
0a122b
@@ -115,7 +115,7 @@ void bios_linker_loader_alloc(GArray *linker,
0a122b
                                     BIOS_LINKER_LOADER_ALLOC_ZONE_HIGH);
0a122b
 
0a122b
     /* Alloc entries must come first, so prepend them */
0a122b
-    g_array_prepend_val(linker, entry);
0a122b
+    g_array_prepend_vals(linker, &entry, sizeof entry);
0a122b
 }
0a122b
 
0a122b
 void bios_linker_loader_add_checksum(GArray *linker, const char *file,
0a122b
@@ -132,7 +132,7 @@ void bios_linker_loader_add_checksum(GArray *linker, const char *file,
0a122b
     entry.cksum.start = cpu_to_le32((uint8_t *)start - (uint8_t *)table);
0a122b
     entry.cksum.length = cpu_to_le32(size);
0a122b
 
0a122b
-    g_array_append_val(linker, entry);
0a122b
+    g_array_append_vals(linker, &entry, sizeof entry);
0a122b
 }
0a122b
 
0a122b
 void bios_linker_loader_add_pointer(GArray *linker,
0a122b
@@ -154,5 +154,5 @@ void bios_linker_loader_add_pointer(GArray *linker,
0a122b
     assert(pointer_size == 1 || pointer_size == 2 ||
0a122b
            pointer_size == 4 || pointer_size == 8);
0a122b
 
0a122b
-    g_array_append_val(linker, entry);
0a122b
+    g_array_append_vals(linker, &entry, sizeof entry);
0a122b
 }
0a122b
-- 
0a122b
1.7.11.7
0a122b