|
| From: | Gerd Hoffmann |
| Subject: | Re: [Qemu-devel] [PATCH 16/24] qdev hotplug: infrastructure and monitor commands. |
| Date: | Tue, 29 Sep 2009 11:08:02 +0200 |
| User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Lightning/1.0pre Thunderbird/3.0b3 |
/* 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
| [Prev in Thread] | Current Thread | [Next in Thread] |