[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 02/11] change element type from "char" to "unsig
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 02/11] change element type from "char" to "unsigned char" in ACPI table data |
Date: |
Wed, 20 Mar 2013 17:40:10 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 |
On 03/20/2013 05:23 PM, Laszlo Ersek wrote:
> The data is binary, not textual.
>
> Also, acpi_table_add() abuses the "char *f" pointer -- which normally
> points to file names to load -- to poke into the table. Introduce "char
> unsigned *table_start" for that purpose.
>
> Signed-off-by: Laszlo Ersek <address@hidden>
> ---
> @@ -112,7 +113,7 @@ int acpi_table_add(const char *t)
> }
>
> for (;;) {
> - char data[8192];
> + char unsigned data[8192];
Although this spelling of the type is valid C, it is not typical
convention prior to your patch:
$ git grep 'unsigned char' | wc
508 3130 34115
$ git grep 'char unsigned' | wc
0 0 0
> @@ -225,11 +226,11 @@ int acpi_table_add(const char *t)
> hdr.checksum = 0; /* for checksum calculation */
>
> /* put header back */
> - memcpy(f, &hdr, sizeof(hdr));
> + memcpy(table_start, &hdr, sizeof(hdr));
>
> if (changed || !has_header || 1) {
> - ((struct acpi_table_header *)f)->checksum =
> - acpi_checksum((uint8_t *)f + ACPI_TABLE_PFX_SIZE, len);
> + ((struct acpi_table_header *)table_start)->checksum =
> + acpi_checksum((uint8_t *)table_start + ACPI_TABLE_PFX_SIZE, len);
Now that table_start is an unsigned char *, do you still need the cast
to uint8_t*?
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH 00/11] build ACPI MADT for fw_cfg clients, Laszlo Ersek, 2013/03/20
- [Qemu-devel] [PATCH 01/11] strip some whitespace, Laszlo Ersek, 2013/03/20
- [Qemu-devel] [PATCH 02/11] change element type from "char" to "unsigned char" in ACPI table data, Laszlo Ersek, 2013/03/20
- Re: [Qemu-devel] [PATCH 02/11] change element type from "char" to "unsigned char" in ACPI table data,
Eric Blake <=
- [Qemu-devel] [PATCH 03/11] acpi_table_add(): report fatal errors through an internal Error object, Laszlo Ersek, 2013/03/20
- [Qemu-devel] [PATCH 04/11] qapi schema: add AcpiTableOptions, Laszlo Ersek, 2013/03/20
- Re: [Qemu-devel] [PATCH 04/11] qapi schema: add AcpiTableOptions, Eric Blake, 2013/03/20
- Re: [Qemu-devel] [PATCH 04/11] qapi schema: add AcpiTableOptions, Laszlo Ersek, 2013/03/20
- Re: [Qemu-devel] [PATCH 04/11] qapi schema: add AcpiTableOptions, Laszlo Ersek, 2013/03/21
- Re: [Qemu-devel] [PATCH 04/11] qapi schema: add AcpiTableOptions, Paolo Bonzini, 2013/03/21
- Re: [Qemu-devel] [PATCH 04/11] qapi schema: add AcpiTableOptions, Michael S. Tsirkin, 2013/03/21
- Re: [Qemu-devel] [PATCH 04/11] qapi schema: add AcpiTableOptions, Laszlo Ersek, 2013/03/21
- Re: [Qemu-devel] [PATCH 04/11] qapi schema: add AcpiTableOptions, Paolo Bonzini, 2013/03/21