From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33650) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDcGR-0004pp-OM for qemu-devel@nongnu.org; Tue, 20 Jan 2015 12:06:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YDcGN-00016y-Fa for qemu-devel@nongnu.org; Tue, 20 Jan 2015 12:06:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57569) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDcGN-00016s-84 for qemu-devel@nongnu.org; Tue, 20 Jan 2015 12:06:47 -0500 Message-ID: <54BE8A24.10906@redhat.com> Date: Tue, 20 Jan 2015 10:02:28 -0700 From: Eric Blake MIME-Version: 1.0 References: <1421744647-26844-1-git-send-email-armbru@redhat.com> In-Reply-To: <1421744647-26844-1-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6vfbj3pr1Wng3sPLiv7dgvE4jtdmKe1St" Subject: Re: [Qemu-devel] [PATCH] qdev: Don't exit when running into bad -global List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: imammedo@redhat.com, mst@redhat.com, afaerber@suse.de, ehabkost@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --6vfbj3pr1Wng3sPLiv7dgvE4jtdmKe1St Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 01/20/2015 02:04 AM, Markus Armbruster wrote: > -global lets you set a nice booby-trap for yourself: >=20 > $ qemu-system-x86_64 -nodefaults -S -display none -usb -monitor std= io -global usb-mouse.usb_version=3Dl > QEMU 2.1.94 monitor - type 'help' for more information > (qemu) device_add usb-mouse > Parameter 'usb_version' expects an int64 value or range > $ echo $? > 1 >=20 > Not nice. Until commit 3196270 we even abort()ed. >=20 > This is consistent with how we handle similarly unusable -global in > qdev_prop_check_globals(). >=20 > You could argue that the error should make device_add fail. Would be > harder, because we're running within TypeInfo's instance_post_init() > method device_post_init(), which can't fail. I agree that outputting a warning up front then ignoring the bogus value, is as good as we can do given we are under "can't fail" constraints, and much better than confusingly failing down the road. >=20 > Signed-off-by: Markus Armbruster > --- > hw/core/qdev-properties.c | 21 +++++++++------------ > hw/core/qdev.c | 8 +------- > include/hw/qdev-properties.h | 4 +--- > 3 files changed, 11 insertions(+), 22 deletions(-) > =20 > -void qdev_prop_set_globals_for_type(DeviceState *dev, const char *type= name, > - Error **errp) > +static void qdev_prop_set_globals_for_type(DeviceState *dev, > + const char *typename) Is the indentation off here? But that's minor, so: Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --6vfbj3pr1Wng3sPLiv7dgvE4jtdmKe1St Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJUvookAAoJEKeha0olJ0NqpcQH/1pS4y1qKPfZ3I/XHNGm4acg QVJ8WCGLCwj+iWyQvoFQf+c0x1z4ZlgZKC72bZcCqv9YGCRJ5rFWp+5obgYtEiin xk+OBArJGhtT/pzfPTEHLxce4X2RR53FsWOIXbSSBUSDMz4yYD/XECnZ5/hONetV BAC6xg3cTKYA2uqs1+FIEH5M+/uoMIkG5WTftvi4+uS+ehGypNpyeA/A6yqHl9nK 1lWM6SlZpIU4RdGb/c4LdK1ZoOFnW9YHZSyGY+OaznUn/mPk3W2mscmtnpczEgcc rDlkc3O7eCmMonyAAN3BXaKOXiWuYy8+mLuZqERtWeSRqXp2+6E8LdYjuDspDuw= =2VZ8 -----END PGP SIGNATURE----- --6vfbj3pr1Wng3sPLiv7dgvE4jtdmKe1St--