Received: from eggs.gnu.org ([2001:4830:134:3::10]:46757) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VQZ9Z-0002cI-MB for qemu-devel@nongnu.org; Mon, 30 Sep 2013 04:48:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VQZ9T-0004CQ-5G for qemu-devel@nongnu.org; Mon, 30 Sep 2013 04:48:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61136) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VQZ9S-0004CK-Tg for qemu-devel@nongnu.org; Mon, 30 Sep 2013 04:48:23 -0400 From: Markus Armbruster References: <1376659114-6630-1-git-send-email-armbru@redhat.com> <1376659114-6630-3-git-send-email-armbru@redhat.com> <20130928204724.GA10454@redhat.com> Date: Mon, 30 Sep 2013 10:48:18 +0200 In-Reply-To: <20130928204724.GA10454@redhat.com> (Michael S. Tsirkin's message of "Sat, 28 Sep 2013 23:47:24 +0300") Message-ID: <8738omk84t.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 2/7] smbios: Convert to QemuOpts List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: lersek@redhat.com, qemu-devel@nongnu.org, Anthony Liguori , ehabkost@redhat.com "Michael S. Tsirkin" writes: > On Fri, Aug 16, 2013 at 03:18:29PM +0200, armbru@redhat.com wrote: >> From: Markus Armbruster >>=20 >> So that it can be set in config file for -readconfig. >>=20 >> 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, ... >>=20 >> Signed-off-by: Markus Armbruster >> Reviewed-by: Eric Blake [...] >> 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; >> } >>=20=20 >> - if (get_param_value(buf, sizeof(buf), "type", t)) { >> - unsigned long type =3D strtoul(buf, NULL, 0); >> + val =3D qemu_opt_get(opts, "type"); >> + if (val) { >> + unsigned long type =3D 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 typ= e %ld", >> + error_report("Don't know how to build fields for SMBIOS typ= e %" PRIu64, >> type); >> exit(1); >> } > > This triggers a build failure: > > /scm/qemu/hw/i386/smbios.c: In function =E2=80=98smbios_entry_add=E2=80= =99: > /scm/qemu/hw/i386/smbios.c:382:26: error: format =E2=80=98%llu=E2=80=99 e= xpects argument > of type =E2=80=98long long unsigned int=E2=80=99, but argument 2 has type= =E2=80=98long unsigned > int=E2=80=99 [-Werror=3Dformat=3D] > 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 :( [...]