qdev: Prepare realize/unrealize hooks for BusState

Add a "realized" property calling realize/unrealize hooks as for devices.

Signed-off-by: Bandan Das <bsd@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
Bandan Das 2013-11-25 17:48:40 -05:00 committed by Andreas Färber
parent 04e9a20b49
commit 02e7f85dac
2 changed files with 47 additions and 0 deletions

View file

@ -36,6 +36,8 @@ typedef int (*qdev_event)(DeviceState *dev);
typedef void (*qdev_resetfn)(DeviceState *dev);
typedef void (*DeviceRealize)(DeviceState *dev, Error **errp);
typedef void (*DeviceUnrealize)(DeviceState *dev, Error **errp);
typedef void (*BusRealize)(BusState *bus, Error **errp);
typedef void (*BusUnrealize)(BusState *bus, Error **errp);
struct VMStateDescription;
@ -174,6 +176,9 @@ struct BusClass {
*/
char *(*get_fw_dev_path)(DeviceState *dev);
void (*reset)(BusState *bus);
BusRealize realize;
BusUnrealize unrealize;
/* maximum devices allowed on the bus, 0: no limit. */
int max_dev;
/* number of automatically allocated bus ids (e.g. ide.0) */
@ -199,6 +204,7 @@ struct BusState {
int allow_hotplug;
HotplugHandler *hotplug_handler;
int max_index;
bool realized;
QTAILQ_HEAD(ChildrenHead, BusChild) children;
QLIST_ENTRY(BusState) sibling;
};