xref: /titanic_51/usr/src/lib/libhotplug/common/libhotplug_impl.h (revision 269473047d747f7815af570197e4ef7322d3632c)
1*26947304SEvan Yan /*
2*26947304SEvan Yan  * CDDL HEADER START
3*26947304SEvan Yan  *
4*26947304SEvan Yan  * The contents of this file are subject to the terms of the
5*26947304SEvan Yan  * Common Development and Distribution License (the "License").
6*26947304SEvan Yan  * You may not use this file except in compliance with the License.
7*26947304SEvan Yan  *
8*26947304SEvan Yan  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*26947304SEvan Yan  * or http://www.opensolaris.org/os/licensing.
10*26947304SEvan Yan  * See the License for the specific language governing permissions
11*26947304SEvan Yan  * and limitations under the License.
12*26947304SEvan Yan  *
13*26947304SEvan Yan  * When distributing Covered Code, include this CDDL HEADER in each
14*26947304SEvan Yan  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*26947304SEvan Yan  * If applicable, add the following below this CDDL HEADER, with the
16*26947304SEvan Yan  * fields enclosed by brackets "[]" replaced with your own identifying
17*26947304SEvan Yan  * information: Portions Copyright [yyyy] [name of copyright owner]
18*26947304SEvan Yan  *
19*26947304SEvan Yan  * CDDL HEADER END
20*26947304SEvan Yan  */
21*26947304SEvan Yan 
22*26947304SEvan Yan /*
23*26947304SEvan Yan  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24*26947304SEvan Yan  * Use is subject to license terms.
25*26947304SEvan Yan  */
26*26947304SEvan Yan 
27*26947304SEvan Yan #ifndef _LIBHOTPLUG_IMPL_H
28*26947304SEvan Yan #define	_LIBHOTPLUG_IMPL_H
29*26947304SEvan Yan 
30*26947304SEvan Yan #ifdef	__cplusplus
31*26947304SEvan Yan extern "C" {
32*26947304SEvan Yan #endif
33*26947304SEvan Yan 
34*26947304SEvan Yan #include <sys/param.h>
35*26947304SEvan Yan #include <libhotplug.h>
36*26947304SEvan Yan 
37*26947304SEvan Yan /*
38*26947304SEvan Yan  * Definition of a node in a hotplug information snapshot.
39*26947304SEvan Yan  */
40*26947304SEvan Yan struct hp_node {
41*26947304SEvan Yan 	int		hp_type;
42*26947304SEvan Yan 	char		*hp_name;
43*26947304SEvan Yan 	char		*hp_usage;
44*26947304SEvan Yan 	char		*hp_description;
45*26947304SEvan Yan 	char		*hp_basepath;
46*26947304SEvan Yan 	int		hp_state;
47*26947304SEvan Yan 	time_t		hp_last_change;
48*26947304SEvan Yan 	hp_node_t	hp_parent;
49*26947304SEvan Yan 	hp_node_t	hp_child;
50*26947304SEvan Yan 	hp_node_t	hp_sibling;
51*26947304SEvan Yan };
52*26947304SEvan Yan 
53*26947304SEvan Yan /*
54*26947304SEvan Yan  * Definitions used for packing/unpacking snapshots.
55*26947304SEvan Yan  */
56*26947304SEvan Yan #define	HP_INFO_BASE	"hp_info.basepath"
57*26947304SEvan Yan #define	HP_INFO_NODE	"hp_info.node"
58*26947304SEvan Yan #define	HP_INFO_BRANCH	"hp_info.branch"
59*26947304SEvan Yan #define	HP_INFO_TYPE	"hp_info.type"
60*26947304SEvan Yan #define	HP_INFO_NAME	"hp_info.name"
61*26947304SEvan Yan #define	HP_INFO_USAGE	"hp_info.usage"
62*26947304SEvan Yan #define	HP_INFO_STATE	"hp_info.state"
63*26947304SEvan Yan #define	HP_INFO_DESC	"hp_info.description"
64*26947304SEvan Yan #define	HP_INFO_TIME	"hp_info.last_change"
65*26947304SEvan Yan 
66*26947304SEvan Yan /*
67*26947304SEvan Yan  * Definitions for the door interface to hotplugd(1m).
68*26947304SEvan Yan  */
69*26947304SEvan Yan #define	HOTPLUGD_PID	"/var/run/hotplugd.pid"
70*26947304SEvan Yan #define	HOTPLUGD_DOOR	"/var/run/hotplugd_door"
71*26947304SEvan Yan 
72*26947304SEvan Yan typedef enum {
73*26947304SEvan Yan 	HP_CMD_NONE = 0,
74*26947304SEvan Yan 	HP_CMD_GETINFO,
75*26947304SEvan Yan 	HP_CMD_CHANGESTATE,
76*26947304SEvan Yan 	HP_CMD_SETPRIVATE,
77*26947304SEvan Yan 	HP_CMD_GETPRIVATE
78*26947304SEvan Yan } hp_cmd_t;
79*26947304SEvan Yan 
80*26947304SEvan Yan #define	HPD_CMD		"hp_door.cmd"
81*26947304SEvan Yan #define	HPD_PATH	"hp_door.path"
82*26947304SEvan Yan #define	HPD_CONNECTION	"hp_door.connection"
83*26947304SEvan Yan #define	HPD_FLAGS	"hp_door.flags"
84*26947304SEvan Yan #define	HPD_STATE	"hp_door.state"
85*26947304SEvan Yan #define	HPD_OPTIONS	"hp_door.options"
86*26947304SEvan Yan #define	HPD_INFO	"hp_door.info"
87*26947304SEvan Yan #define	HPD_STATUS	"hp_door.status"
88*26947304SEvan Yan #define	HPD_SEQNUM	"hp_door.seqnum"
89*26947304SEvan Yan 
90*26947304SEvan Yan /*
91*26947304SEvan Yan  * Definition of macros to validate flags.
92*26947304SEvan Yan  */
93*26947304SEvan Yan #define	HP_INIT_FLAGS_VALID(f)		((f & ~(HPINFOUSAGE)) == 0)
94*26947304SEvan Yan #define	HP_SET_STATE_FLAGS_VALID(f)	((f & ~(HPFORCE | HPQUERY)) == 0)
95*26947304SEvan Yan 
96*26947304SEvan Yan /*
97*26947304SEvan Yan  * Definition of global flag to enable debug.
98*26947304SEvan Yan  */
99*26947304SEvan Yan extern int	libhotplug_debug;
100*26947304SEvan Yan 
101*26947304SEvan Yan #ifdef	__cplusplus
102*26947304SEvan Yan }
103*26947304SEvan Yan #endif
104*26947304SEvan Yan 
105*26947304SEvan Yan #endif	/* _LIBHOTPLUG_IMPL_H */
106