From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55302) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPJzA-00006P-31 for qemu-devel@nongnu.org; Tue, 01 May 2012 16:47:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SPJz8-0008Qf-9K for qemu-devel@nongnu.org; Tue, 01 May 2012 16:47:47 -0400 Received: from e38.co.us.ibm.com ([32.97.110.159]:34660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPJz8-0008QT-2K for qemu-devel@nongnu.org; Tue, 01 May 2012 16:47:46 -0400 Received: from /spool/local by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 1 May 2012 14:47:38 -0600 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 980271FF0050 for ; Tue, 1 May 2012 14:46:34 -0600 (MDT) Received: from d03av06.boulder.ibm.com (d03av06.boulder.ibm.com [9.17.195.245]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q41KkPLM131590 for ; Tue, 1 May 2012 14:46:25 -0600 Received: from d03av06.boulder.ibm.com (loopback [127.0.0.1]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q41Kkp7Y020299 for ; Tue, 1 May 2012 14:46:51 -0600 Message-ID: <4FA04B92.3080200@us.ibm.com> Date: Tue, 01 May 2012 15:46:10 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1335896294-9530-1-git-send-email-aliguori@us.ibm.com> <1335896294-9530-5-git-send-email-aliguori@us.ibm.com> <4FA04974.30503@redhat.com> In-Reply-To: <4FA04974.30503@redhat.com> Content-Type: multipart/mixed; boundary="------------000509080301030905080506" Subject: Re: [Qemu-devel] [PATCH 04/14] qdev: don't allow globals to be set by bus name List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Wanpeng Li , Peter Maydell , qemu-devel@nongnu.org, Andreas Faerber This is a multi-part message in MIME format. --------------000509080301030905080506 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit On 05/01/2012 03:37 PM, Paolo Bonzini wrote: > Il 01/05/2012 20:18, Anthony Liguori ha scritto: >> This is technically a compatibility breaker. However: >> >> 1) libvirt does not rely on this (it always uses the driver name) >> >> 2) This behavior isn't actually documented anywhere (the docs just say driver). >> >> 3) I suspect there are less than three people on earth that even know this is >> possible (minus the people reading this message). >> >> So I think we can safely break it :-) > > Does this work with compat properties set on a bus? No :-( This is pretty easy to fix though. The attached should do the trick, I'll update and send out. Even if it does, > perhaps it's better to avoid the cleverness and wait for my series that > moves bus properties to the appropriate abstract superclass. This series does that FWIW (patch 6/14). Regards, Anthony Liguori > > Paolo > --------------000509080301030905080506 Content-Type: text/plain; charset=UTF-8; name="foo" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="foo" diff --git a/hw/pc_piix.c b/hw/pc_piix.c index 6a75718..be809db 100644 --- a/hw/pc_piix.c +++ b/hw/pc_piix.c @@ -378,7 +378,7 @@ static QEMUMachine pc_machine_v1_1 = { .property = "vapic",\ .value = "off",\ },{\ - .driver = "USB",\ + .driver = TYPE_USB_DEVICE,\ .property = "full-path",\ .value = "no",\ } @@ -451,7 +451,7 @@ static QEMUMachine pc_machine_v0_14 = { #define PC_COMPAT_0_13 \ PC_COMPAT_0_14,\ {\ - .driver = "PCI",\ + .driver = TYPE_PCI_DEVICE,\ .property = "command_serr_enable",\ .value = "off",\ },{\ diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index 0c6dade..ddd7b25 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -1158,10 +1158,14 @@ void qdev_prop_set_globals(DeviceState *dev) GlobalProperty *prop; QTAILQ_FOREACH(prop, &global_props, next) { - if (strcmp(object_get_typename(OBJECT(dev)), prop->driver) != 0) { + Object *obj; + + obj = object_dynamic_cast(OBJECT(dev), prop->driver); + if (obj == NULL) { continue; } - if (qdev_prop_parse(dev, prop->property, prop->value) != 0) { + + if (qdev_prop_parse(DEVICE(obj), prop->property, prop->value) != 0) { exit(1); } } --------------000509080301030905080506--