2 * Hotplug handler interface.
4 * Copyright (c) 2014 Red Hat Inc.
7 * Igor Mammedov <imammedo@redhat.com>,
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
12 #include "qemu/osdep.h"
13 #include "hw/hotplug.h"
14 #include "qemu/module.h"
16 void hotplug_handler_pre_plug(HotplugHandler
*plug_handler
,
17 DeviceState
*plugged_dev
,
20 HotplugHandlerClass
*hdc
= HOTPLUG_HANDLER_GET_CLASS(plug_handler
);
23 hdc
->pre_plug(plug_handler
, plugged_dev
, errp
);
27 void hotplug_handler_plug(HotplugHandler
*plug_handler
,
28 DeviceState
*plugged_dev
,
31 HotplugHandlerClass
*hdc
= HOTPLUG_HANDLER_GET_CLASS(plug_handler
);
34 hdc
->plug(plug_handler
, plugged_dev
, errp
);
38 void hotplug_handler_post_plug(HotplugHandler
*plug_handler
,
39 DeviceState
*plugged_dev
,
42 HotplugHandlerClass
*hdc
= HOTPLUG_HANDLER_GET_CLASS(plug_handler
);
45 hdc
->post_plug(plug_handler
, plugged_dev
, errp
);
49 void hotplug_handler_unplug_request(HotplugHandler
*plug_handler
,
50 DeviceState
*plugged_dev
,
53 HotplugHandlerClass
*hdc
= HOTPLUG_HANDLER_GET_CLASS(plug_handler
);
55 if (hdc
->unplug_request
) {
56 hdc
->unplug_request(plug_handler
, plugged_dev
, errp
);
60 void hotplug_handler_unplug(HotplugHandler
*plug_handler
,
61 DeviceState
*plugged_dev
,
64 HotplugHandlerClass
*hdc
= HOTPLUG_HANDLER_GET_CLASS(plug_handler
);
67 hdc
->unplug(plug_handler
, plugged_dev
, errp
);
71 static const TypeInfo hotplug_handler_info
= {
72 .name
= TYPE_HOTPLUG_HANDLER
,
73 .parent
= TYPE_INTERFACE
,
74 .class_size
= sizeof(HotplugHandlerClass
),
77 static void hotplug_handler_register_types(void)
79 type_register_static(&hotplug_handler_info
);
82 type_init(hotplug_handler_register_types
)