Received: from eggs.gnu.org ([2001:4830:134:3::10]:37197) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMU6s-0004Jw-Rt for qemu-devel@nongnu.org; Sat, 08 Mar 2014 22:09:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WMU6n-0007Vn-7i for qemu-devel@nongnu.org; Sat, 08 Mar 2014 22:09:06 -0500 Received: from mail-qg0-x22d.google.com ([2607:f8b0:400d:c04::22d]:32812) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMU6n-0007Vg-2E for qemu-devel@nongnu.org; Sat, 08 Mar 2014 22:09:01 -0500 Received: by mail-qg0-f45.google.com with SMTP id j5so16546576qga.4 for ; Sat, 08 Mar 2014 19:09:00 -0800 (PST) Date: Sat, 8 Mar 2014 22:05:59 -0500 From: "Gabriel L. Somlo" Message-ID: <20140309030559.GE17184@ERROL.INI.CMU.EDU> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5318AAA0.1090301@redhat.com> Subject: [Qemu-devel] [PATCH 7/7] SMBIOS: Remove unused code for passing individual fields to bios List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kevin@koconnor.net, lersek@redhat.com, kraxel@redhat.com, agraf@suse.de This patch removes smbios_add_field() and the old code to insert individual fields for types 0 and 1 into fw_cfg. Signed-off-by: Gabriel Somlo --- hw/i386/smbios.c | 80 -------------------------------------------------------- 1 file changed, 80 deletions(-) diff --git a/hw/i386/smbios.c b/hw/i386/smbios.c index e7df372..54ad3e7 100644 --- a/hw/i386/smbios.c +++ b/hw/i386/smbios.c @@ -29,13 +29,6 @@ struct smbios_header { uint8_t type; } QEMU_PACKED; -struct smbios_field { - struct smbios_header header; - uint8_t type; - uint16_t offset; - uint8_t data[]; -} QEMU_PACKED; - struct smbios_table { struct smbios_header header; uint8_t data[]; @@ -283,75 +276,6 @@ static bool smbios_skip_table(uint8_t type, bool required_table) *(uint16_t *)smbios_entries += 1; \ } while (0) -static void smbios_add_field(int type, int offset, const void *data, size_t len) -{ - struct smbios_field *field; - - if (!smbios_entries) { - smbios_entries_len = sizeof(uint16_t); - smbios_entries = g_malloc0(smbios_entries_len); - } - smbios_entries = g_realloc(smbios_entries, smbios_entries_len + - sizeof(*field) + len); - field = (struct smbios_field *)(smbios_entries + smbios_entries_len); - field->header.type = SMBIOS_FIELD_ENTRY; - field->header.length = cpu_to_le16(sizeof(*field) + len); - - field->type = type; - field->offset = cpu_to_le16(offset); - memcpy(field->data, data, len); - - smbios_entries_len += sizeof(*field) + len; - (*(uint16_t *)smbios_entries) = - cpu_to_le16(le16_to_cpu(*(uint16_t *)smbios_entries) + 1); -} - -static void smbios_maybe_add_str(int type, int offset, const char *data) -{ - if (data) { - smbios_add_field(type, offset, data, strlen(data) + 1); - } -} - -static void smbios_build_type_0_fields(void) -{ - smbios_maybe_add_str(0, offsetof(struct smbios_type_0, vendor_str), - type0.vendor); - smbios_maybe_add_str(0, offsetof(struct smbios_type_0, bios_version_str), - type0.version); - smbios_maybe_add_str(0, offsetof(struct smbios_type_0, - bios_release_date_str), - type0.date); - if (type0.have_major_minor) { - smbios_add_field(0, offsetof(struct smbios_type_0, - system_bios_major_release), - &type0.major, 1); - smbios_add_field(0, offsetof(struct smbios_type_0, - system_bios_minor_release), - &type0.minor, 1); - } -} - -static void smbios_build_type_1_fields(void) -{ - smbios_maybe_add_str(1, offsetof(struct smbios_type_1, manufacturer_str), - type1.manufacturer); - smbios_maybe_add_str(1, offsetof(struct smbios_type_1, product_name_str), - type1.product); - smbios_maybe_add_str(1, offsetof(struct smbios_type_1, version_str), - type1.version); - smbios_maybe_add_str(1, offsetof(struct smbios_type_1, serial_number_str), - type1.serial); - smbios_maybe_add_str(1, offsetof(struct smbios_type_1, sku_number_str), - type1.sku); - smbios_maybe_add_str(1, offsetof(struct smbios_type_1, family_str), - type1.family); - if (qemu_uuid_set) { - smbios_add_field(1, offsetof(struct smbios_type_1, uuid), - qemu_uuid, 16); - } -} - static void smbios_build_type_0_table(void) { SMBIOS_BUILD_TABLE_PRE(0, 0x000, true); /* required */ @@ -452,10 +376,6 @@ uint8_t *smbios_get_table(size_t *length) smbios_build_type_0_table(); smbios_build_type_1_table(); smbios_build_type_2_table(); -if (false) { /* shut up gcc until we remove deprecated code */ - smbios_build_type_0_fields(); - smbios_build_type_1_fields(); -} smbios_validate_table(); smbios_immutable = true; } -- 1.8.1.4