iotests: Test qemu-img convert -S 0 behavior
[qemu/ar7.git] / hw / core / hotplug.c
blob645cfca1b9b6543170970952de87e78719a5cf4c
1 /*
2 * Hotplug handler interface.
4 * Copyright (c) 2014 Red Hat Inc.
6 * Authors:
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_plug(HotplugHandler *plug_handler,
17 DeviceState *plugged_dev,
18 Error **errp)
20 HotplugHandlerClass *hdc = HOTPLUG_HANDLER_GET_CLASS(plug_handler);
22 if (hdc->plug) {
23 hdc->plug(plug_handler, plugged_dev, errp);
27 void hotplug_handler_unplug_request(HotplugHandler *plug_handler,
28 DeviceState *plugged_dev,
29 Error **errp)
31 HotplugHandlerClass *hdc = HOTPLUG_HANDLER_GET_CLASS(plug_handler);
33 if (hdc->unplug_request) {
34 hdc->unplug_request(plug_handler, plugged_dev, errp);
38 void hotplug_handler_unplug(HotplugHandler *plug_handler,
39 DeviceState *plugged_dev,
40 Error **errp)
42 HotplugHandlerClass *hdc = HOTPLUG_HANDLER_GET_CLASS(plug_handler);
44 if (hdc->unplug) {
45 hdc->unplug(plug_handler, plugged_dev, errp);
49 static const TypeInfo hotplug_handler_info = {
50 .name = TYPE_HOTPLUG_HANDLER,
51 .parent = TYPE_INTERFACE,
52 .class_size = sizeof(HotplugHandlerClass),
55 static void hotplug_handler_register_types(void)
57 type_register_static(&hotplug_handler_info);
60 type_init(hotplug_handler_register_types)