From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MsYgu-0000i6-7A for qemu-devel@nongnu.org; Tue, 29 Sep 2009 05:08:12 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MsYgp-0000hn-A0 for qemu-devel@nongnu.org; Tue, 29 Sep 2009 05:08:11 -0400 Received: from [199.232.76.173] (port=60136 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MsYgo-0000hk-Tk for qemu-devel@nongnu.org; Tue, 29 Sep 2009 05:08:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9532) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MsYgo-00013l-29 for qemu-devel@nongnu.org; Tue, 29 Sep 2009 05:08:06 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8T985f3001580 for ; Tue, 29 Sep 2009 05:08:05 -0400 Message-ID: <4AC1CE72.5090601@redhat.com> Date: Tue, 29 Sep 2009 11:08:02 +0200 From: Gerd Hoffmann MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 16/24] qdev hotplug: infrastructure and monitor commands. References: <1253907769-1067-1-git-send-email-kraxel@redhat.com> <1253907769-1067-17-git-send-email-kraxel@redhat.com> <87r5tqdd4c.fsf@pike.pond.sub.org> In-Reply-To: <87r5tqdd4c.fsf@pike.pond.sub.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org >> /* This is a nasty hack to allow passing a NULL bus to qdev_create. */ >> +static int qdev_hotplug = 0; >> + > > I see the "nasty hack" part, but I don't see how qdev_create() accepts a > null bus now: > >> static BusState *main_system_bus; The (existing) "nasty hack" comment belongs to the main_system_bus variable and should stay there of course to avoid confusion ... >> /* create device, set properties */ >> qdev = qdev_create(bus, driver); > [...] > > As far as I can see, all qdev_hotplug does is telling qdev_device_add() > and qdev_create() that this is a hotplug. Yes. > What about something like: > > DeviceState *qdev_device_add(QemuOpts *opts, int hotplug) > { > [...] > if (hotplug&& !bus->allow_hotplug) { > qemu_error("Bus %s does not support hotplugging\n", > bus->name); > return NULL; > } > > /* create device, set properties */ > qdev = qdev_create(bus, driver); > if (hotplug) { > dev->hotplugged = 1; I started that way. Doesn't fly. Not every device creation goes through qdev_device_add(). Thus you'll have to do this in qdev_create(), which in turn means that you would have to add a hotplug parameter to tons of functions just to pass it down to qdev_create ... cheers, Gerd