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