xref: /illumos-gate/usr/src/cmd/hal/hald/solaris/hotplug.h (revision 1a2d662a91cee3bf82f41cd47c7ae6f3825d9db2)
1 /***************************************************************************
2  *
3  * hotplug.h : definitions for HAL-internal hotplug events
4  *
5  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
6  * Use is subject to license terms.
7  *
8  * Licensed under the Academic Free License version 2.1
9  *
10  **************************************************************************/
11 
12 #ifndef HOTPLUG_H
13 #define HOTPLUG_H
14 
15 #include <glib.h>
16 
17 #include "../device.h"
18 #include "../util.h"
19 
20 #include "devinfo.h"
21 
22 typedef enum {
23 	HOTPLUG_ACTION_ADD,
24 	HOTPLUG_ACTION_REMOVE,
25 } HotplugActionType;
26 
27 typedef enum {
28 	HOTPLUG_EVENT_DEVFS       = 0,
29 } HotplugEventType;
30 
31 /** Data structure representing a hotplug event; also used for
32  *  coldplugging.
33  */
34 typedef struct
35 {
36 	HotplugActionType action;               /**< Whether the event is add or remove */
37 	HotplugEventType type;                  /**< Type of hotplug event */
38 
39 	HalDevice *d;
40 
41 	union {
42 		struct {
43 			char devfs_path[HAL_PATH_MAX];
44 			DevinfoDevHandler *handler;
45 		} devfs;
46 	} un;
47 
48 } HotplugEvent;
49 
50 void hotplug_event_enqueue (HotplugEvent *event, int front);
51 
52 void hotplug_event_process_queue (void);
53 
54 void hotplug_event_end (void *end_token);
55 
56 void hotplug_queue_now_empty (void);
57 
58 #endif /* HOTPLUG_H */
59