From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVfJN-0001Sr-UE for qemu-devel@nongnu.org; Fri, 26 Apr 2013 05:51:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVfJK-0005C8-RC for qemu-devel@nongnu.org; Fri, 26 Apr 2013 05:51:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4885) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVfJK-0005Bs-Ha for qemu-devel@nongnu.org; Fri, 26 Apr 2013 05:51:22 -0400 Message-ID: <517A4E9E.8000207@redhat.com> Date: Fri, 26 Apr 2013 11:53:34 +0200 From: Laszlo Ersek MIME-Version: 1.0 References: <1366316544-1428-1-git-send-email-lersek@redhat.com> <1366316544-1428-5-git-send-email-lersek@redhat.com> <87wqrqjvhw.fsf@codemonkey.ws> In-Reply-To: <87wqrqjvhw.fsf@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 4/7] hw/acpi: export default ACPI headers using the type just introduced List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org, mst@redhat.com On 04/25/13 20:49, Anthony Liguori wrote: > Laszlo Ersek writes: > >> This enables reuse when preparing per-table fw_cfg blobs later. >> >> Signed-off-by: Laszlo Ersek >> Acked-by: Michael S. Tsirkin >> --- >> include/hw/acpi/acpi.h | 2 ++ >> hw/acpi/core.c | 39 ++++++++++++++++++++++++--------------- >> 2 files changed, 26 insertions(+), 15 deletions(-) >> >> diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h >> index 0e26f63..bc7e107 100644 >> --- a/include/hw/acpi/acpi.h >> +++ b/include/hw/acpi/acpi.h >> @@ -178,4 +178,6 @@ typedef struct acpi_table_std_header { >> char asl_compiler_id[4]; /* ASL compiler vendor ID */ >> uint32_t asl_compiler_revision; /* ASL compiler revision number */ >> } QEMU_PACKED AcpiTableStdHdr; >> + >> +extern const AcpiTableStdHdr acpi_dfl_hdr; > > Can we do this without using a global variable? I assume this gets > memcpy()'d or referenced as a pointer later on or something like that? > Can we make a function that does that? The data itself is reused between acpi_table_install() -- ie. the -acpitable switch -- and acpi_table_fill_hdr(), to be added in 7/7. The latter uses it in a structure assignment. I can make a function ("acpi_table_fill_dfl_hdr()") that takes a target buffer and a size, checks the size, and if it fits, copies the default header into it. Thanks Laszlo