xref: /titanic_50/usr/src/cmd/hal/hald/solaris/hotplug.h (revision 4445fffbbb1ea25fd0e9ea68b9380dd7a6709025)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
13 
14 #ifndef HOTPLUG_H
15 #define HOTPLUG_H
16 
17 #include <glib.h>
18 
19 #include "../device.h"
20 #include "../util.h"
21 
22 #include "devinfo.h"
23 
24 typedef enum {
25 	HOTPLUG_ACTION_ADD,
26 	HOTPLUG_ACTION_REMOVE,
27 } HotplugActionType;
28 
29 typedef enum {
30 	HOTPLUG_EVENT_DEVFS       = 0,
31 } HotplugEventType;
32 
33 /** Data structure representing a hotplug event; also used for
34  *  coldplugging.
35  */
36 typedef struct
37 {
38 	HotplugActionType action;               /**< Whether the event is add or remove */
39 	HotplugEventType type;                  /**< Type of hotplug event */
40 
41 	HalDevice *d;
42 
43 	union {
44 		struct {
45 			char devfs_path[HAL_PATH_MAX];
46 			DevinfoDevHandler *handler;
47 		} devfs;
48 	} un;
49 
50 } HotplugEvent;
51 
52 void hotplug_event_enqueue (HotplugEvent *event, int front);
53 
54 void hotplug_event_process_queue (void);
55 
56 void hotplug_event_end (void *end_token);
57 
58 void hotplug_queue_now_empty (void);
59 
60 #endif /* HOTPLUG_H */
61