From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54456) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YHUH4-0001pv-TZ for qemu-devel@nongnu.org; Sat, 31 Jan 2015 04:23:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YHUH1-0002vt-Kp for qemu-devel@nongnu.org; Sat, 31 Jan 2015 04:23:30 -0500 Received: from mout.web.de ([212.227.15.14]:62353) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YHUH1-0002vQ-B2 for qemu-devel@nongnu.org; Sat, 31 Jan 2015 04:23:27 -0500 Message-ID: <54CC9F01.60305@web.de> Date: Sat, 31 Jan 2015 10:23:13 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <1420456961-19631-1-git-send-email-stefanha@redhat.com> <54AA7791.9060705@siemens.com> In-Reply-To: <54AA7791.9060705@siemens.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="o2TbJA2C78Q29jQQ6o8xt9CvoHQXuaE8m" Subject: Re: [Qemu-devel] [PATCH] vl.c: fix -usb option assertion failure in qemu_opt_get_bool_helper() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , qemu-devel@nongnu.org, Marcel Apfelbaum Cc: Peter Maydell , Tiejun Chen , plucinski.mariusz@gmail.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --o2TbJA2C78Q29jQQ6o8xt9CvoHQXuaE8m Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 2015-01-05 12:37, Jan Kiszka wrote: > On 2015-01-05 12:22, Stefan Hajnoczi wrote: >> Commit 49d2e648e8087d154d8bf8b91f27c8e05e79d5a6 ("machine: remove >> qemu_machine_opts global list") removed option descriptions from the >> -machine QemuOptsList to avoid repeating MachineState's QOM properties= =2E >> >> This change broke vl.c:usb_enabled() because qemu_opt_get_bool() canno= t >> be used on QemuOptsList without option descriptions since QemuOpts >> doesn't know the type and therefore left an unparsed string value. >> >> This patch avoids calling qemu_opt_get_bool() to fix the assertion >> failure: >> >> $ qemu-system-x86_64 -usb >> qemu_opt_get_bool_helper: Assertion `opt->desc && opt->desc->type =3D= =3D QEMU_OPT_BOOL' failed. >> >> Test the presence of -usb using qemu_opt_find() but use the >> MachineState->usb field instead of qemu_opt_get_bool(). >> >> Cc: Marcel Apfelbaum >> Cc: Tiejun Chen >> Signed-off-by: Stefan Hajnoczi >> --- >> vl.c | 7 +++++-- >> 1 file changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/vl.c b/vl.c >> index bea9656..6e8889c 100644 >> --- a/vl.c >> +++ b/vl.c >> @@ -999,8 +999,11 @@ static int parse_name(QemuOpts *opts, void *opaqu= e) >> =20 >> bool usb_enabled(bool default_usb) >> { >> - return qemu_opt_get_bool(qemu_get_machine_opts(), "usb", >> - has_defaults && default_usb); >> + if (qemu_opt_find(qemu_get_machine_opts(), "usb")) { >> + return current_machine->usb; >> + } else { >> + return has_defaults && default_usb; >> + } >> } >> =20 >> #ifndef _WIN32 >> >=20 > That still leaves the other boolean machine options broken. A generic > fix would be good. Or revert the original commit until we have one. Just pulled current master, and at least the iommu machine option is still triggering an abort. What is the status of fixing these fallouts? Was anything else addressed by now, just this one forgotten? Jan --o2TbJA2C78Q29jQQ6o8xt9CvoHQXuaE8m Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlTMnwEACgkQitSsb3rl5xRmFgCfdN/5jW920XfkRFfF7y5mnQIo JOwAn2aO3sxM1KyQ8D6bO8Id28uN0x+C =WxD0 -----END PGP SIGNATURE----- --o2TbJA2C78Q29jQQ6o8xt9CvoHQXuaE8m--