qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 2/7] smbios: Convert to QemuOpts


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v2 2/7] smbios: Convert to QemuOpts
Date: Mon, 30 Sep 2013 10:48:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

"Michael S. Tsirkin" <address@hidden> writes:

> On Fri, Aug 16, 2013 at 03:18:29PM +0200, address@hidden wrote:
>> From: Markus Armbruster <address@hidden>
>> 
>> 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, ...
>> 
>> Signed-off-by: Markus Armbruster <address@hidden>
>> Reviewed-by: Eric Blake <address@hidden>
[...]
>> diff --git a/hw/i386/smbios.c b/hw/i386/smbios.c
>> index 0608aee..a113f8b 100644
>> --- a/hw/i386/smbios.c
>> +++ b/hw/i386/smbios.c
[...]
>> @@ -225,17 +346,29 @@ void smbios_entry_add(const char *t)
>>          return;
>>      }
>>  
>> -    if (get_param_value(buf, sizeof(buf), "type", t)) {
>> -        unsigned long type = strtoul(buf, NULL, 0);
>> +    val = qemu_opt_get(opts, "type");
>> +    if (val) {
>> +        unsigned long type = strtoul(val, NULL, 0);
>> +
>>          switch (type) {
>>          case 0:
>> -            smbios_build_type_0_fields(t);
>> +            qemu_opts_validate(opts, qemu_smbios_type0_opts, &local_err);
>> +            if (local_err) {
>> +                error_report("%s", error_get_pretty(local_err));
>> +                exit(1);
>> +            }
>> +            smbios_build_type_0_fields(opts);
>>              return;
>>          case 1:
>> -            smbios_build_type_1_fields(t);
>> +            qemu_opts_validate(opts, qemu_smbios_type1_opts, &local_err);
>> +            if (local_err) {
>> +                error_report("%s", error_get_pretty(local_err));
>> +                exit(1);
>> +            }
>> +            smbios_build_type_1_fields(opts);
>>              return;
>>          default:
>> -            error_report("Don't know how to build fields for SMBIOS type 
>> %ld",
>> +            error_report("Don't know how to build fields for SMBIOS type %" 
>> PRIu64,
>>                           type);
>>              exit(1);
>>          }
>
> This triggers a build failure:
>
> /scm/qemu/hw/i386/smbios.c: In function ‘smbios_entry_add’:
> /scm/qemu/hw/i386/smbios.c:382:26: error: format ‘%llu’ expects argument
> of type ‘long long unsigned int’, but argument 2 has type ‘long unsigned
> int’ [-Werror=format=]
>                           type);
>                           ^
>
> It's a long value, why are you printing it with PRIu64?
> %ld seems right.

Yup.

> I reverted just this chunk.

Thanks for catching this.  My compiler doesn't :(

[...]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]