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