[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 04/11] acpi_table_add(): introduce 'qemu_len' variab
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PATCH 04/11] acpi_table_add(): introduce 'qemu_len' variable |
Date: |
Wed, 27 Jun 2012 17:23:00 -0300 |
To make the length calculation clearer, introduce a 'qemu_len' variable,
for the length of all data being added to acpi_tables (including the
QEMU-specific prefix).
No behavior change, just make the length calculation clearer.
Signed-off-by: Eduardo Habkost <address@hidden>
---
hw/acpi.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/hw/acpi.c b/hw/acpi.c
index abc959e..b5f0531 100644
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -86,7 +86,8 @@ int acpi_table_add(const char *t)
{
char buf[1024], *p, *f;
unsigned long val;
- size_t acpi_len, start, allen;
+ size_t start, allen;
+ size_t qemu_len, acpi_len;
bool has_header;
int changed;
int r;
@@ -150,13 +151,17 @@ int acpi_table_add(const char *t)
/* now fill in the header fields */
f = acpi_tables + start; /* start of the table */
+
+ /* length of the whole table, including our prefix */
+ qemu_len = allen - start;
+
changed = 0;
/* copy the header to temp place to align the fields */
memcpy(&hdr, has_header ? f : dfl_hdr, ACPI_TABLE_HDR_SIZE);
/* length of the table minus our prefix */
- acpi_len = allen - start - ACPI_TABLE_PFX_SIZE;
+ acpi_len = qemu_len - ACPI_TABLE_PFX_SIZE;
hdr._length = cpu_to_le16(acpi_len);
--
1.7.10.4
- [Qemu-devel] [PATCH 00/11] acpi_table_add() code cleanup, Eduardo Habkost, 2012/06/27
- [Qemu-devel] [PATCH 03/11] acpi_table_add(): rename 'len' to 'acpi_len', Eduardo Habkost, 2012/06/27
- [Qemu-devel] [PATCH 04/11] acpi_table_add(): introduce 'qemu_len' variable,
Eduardo Habkost <=
- [Qemu-devel] [PATCH 09/11] acpi_table_add(): extract acpi_tables reallocation code to a separate function, Eduardo Habkost, 2012/06/27
- [Qemu-devel] [PATCH 05/11] acpi_table_add(): extract ACPI header creation to separate function, Eduardo Habkost, 2012/06/27
- [Qemu-devel] [PATCH 10/11] acpi_table_add(): use acpi_newtable_resize() return value, Eduardo Habkost, 2012/06/27
- [Qemu-devel] [PATCH 01/11] acpi_table_add(): simplify acpi_tables on-demand initialization, Eduardo Habkost, 2012/06/27
- [Qemu-devel] [PATCH 06/11] acpi_table_add(): rename 'qemu_len' to 'newlen', Eduardo Habkost, 2012/06/27
- [Qemu-devel] [PATCH 02/11] acpi_table_add(): extract acpi_tables init to separate function, Eduardo Habkost, 2012/06/27
- [Qemu-devel] [PATCH 07/11] acpi_table_add(): eliminate 'allen' variable, Eduardo Habkost, 2012/06/27
- [Qemu-devel] [PATCH 08/11] acpi_table_add(): eliminate 'start' variable, Eduardo Habkost, 2012/06/27
- [Qemu-devel] [PATCH 11/11] acpi_table_add(): extract acpi_tables count update code to separate function, Eduardo Habkost, 2012/06/27