Hi,
One more respin, even more improvements.
hotplug, meet qdev.
qdev, meet hotplug.
Changes summary:
* allow embedded bus structs.
* add bus release function.
* added device destruction callback to qdev devices.
* make qdev hotplug-aware (NEW!).
* make busses use the new features.
End result is that you can use qdev_unplug() to unplug a device.
Depending on the bus this will either not work at all (ISA), ask the
guest OS to release the device (PCI+ACPI) or just zap it (USB).
Using the destruction callback everything will be released properly when
a device is zapped. qdev will walk the child bus(es) if present and zap
all connected devices too.
You can pci_del the scsi adapter and all scsi disks will be deleted too.
You can pci_del the usb controller and all usb devices connected will be
deleted too. You can unplug usb hubs, all connected devices will go away
too.