From 351a6a73ca7a9123f0dfd6c6f85fd01e82fe3741 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 16 Aug 2013 15:18:28 +0200 Subject: smbios: Normalize smbios_entry_add()'s error handling to exit(1) It exits on all error conditions but one, where it returns -1. Normalize, and return void. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Signed-off-by: Michael S. Tsirkin --- arch_init.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'arch_init.c') diff --git a/arch_init.c b/arch_init.c index e47e1399bb..6ae8eb6340 100644 --- a/arch_init.c +++ b/arch_init.c @@ -1137,9 +1137,7 @@ void do_acpitable_option(const QemuOpts *opts) void do_smbios_option(const char *optarg) { #ifdef TARGET_I386 - if (smbios_entry_add(optarg) < 0) { - exit(1); - } + smbios_entry_add(optarg); #endif } -- cgit v1.2.1 From 4f953d2fc806f1ba6fa76f01dfd121fe7d0dc4a7 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 16 Aug 2013 15:18:29 +0200 Subject: smbios: Convert to QemuOpts So that it can be set in config file for -readconfig. This tightens parsing of -smbios, and makes it more consistent with other options: unknown parameters are rejected, numbers with trailing junk are rejected, when a parameter is given multiple times, last rather than first wins, ... MST: drop one chunk to fix build errors Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Signed-off-by: Michael S. Tsirkin --- arch_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch_init.c') diff --git a/arch_init.c b/arch_init.c index 6ae8eb6340..62f111807d 100644 --- a/arch_init.c +++ b/arch_init.c @@ -1134,10 +1134,10 @@ void do_acpitable_option(const QemuOpts *opts) #endif } -void do_smbios_option(const char *optarg) +void do_smbios_option(QemuOpts *opts) { #ifdef TARGET_I386 - smbios_entry_add(optarg); + smbios_entry_add(opts); #endif } -- cgit v1.2.1 From fc3b32958a80bca13309e2695de07b43dd788421 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 16 Aug 2013 15:18:31 +0200 Subject: smbios: Make multiple -smbios type= accumulate sanely Currently, -smbios type=T,NAME=VAL,... adds one field (T,NAME) with value VAL to fw_cfg for each unique NAME. If NAME occurs multiple times, the last one's VAL is used (before the QemuOpts conversion, the first one was used). Multiple -smbios can add multiple fields with the same (T, NAME). SeaBIOS reads all of them from fw_cfg, but uses only the first field (T, NAME). The others are ignored. "First one wins, subsequent ones get ignored silently" isn't nice. We commonly let the last option win. Useful, because it lets you -readconfig first, then selectively override with command line options. Clean up -smbios to work the common way. Accumulate the settings, with later ones overwriting earlier ones. Put the result into fw_cfg (no more useless duplicates). Bonus cleanup: qemu_uuid_parse() no longer sets SMBIOS system uuid by side effect. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Signed-off-by: Michael S. Tsirkin --- arch_init.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'arch_init.c') diff --git a/arch_init.c b/arch_init.c index 62f111807d..150647b6bb 100644 --- a/arch_init.c +++ b/arch_init.c @@ -1113,9 +1113,6 @@ int qemu_uuid_parse(const char *str, uint8_t *uuid) if (ret != 16) { return -1; } -#ifdef TARGET_I386 - smbios_add_field(1, offsetof(struct smbios_type_1, uuid), uuid, 16); -#endif return 0; } -- cgit v1.2.1