xref: /onnv-gate/usr/src/cmd/hotplugd/hotplugd_impl.h (revision 10923:df470fd79c3c)
1*10923SEvan.Yan@Sun.COM /*
2*10923SEvan.Yan@Sun.COM  * CDDL HEADER START
3*10923SEvan.Yan@Sun.COM  *
4*10923SEvan.Yan@Sun.COM  * The contents of this file are subject to the terms of the
5*10923SEvan.Yan@Sun.COM  * Common Development and Distribution License (the "License").
6*10923SEvan.Yan@Sun.COM  * You may not use this file except in compliance with the License.
7*10923SEvan.Yan@Sun.COM  *
8*10923SEvan.Yan@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*10923SEvan.Yan@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*10923SEvan.Yan@Sun.COM  * See the License for the specific language governing permissions
11*10923SEvan.Yan@Sun.COM  * and limitations under the License.
12*10923SEvan.Yan@Sun.COM  *
13*10923SEvan.Yan@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*10923SEvan.Yan@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*10923SEvan.Yan@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*10923SEvan.Yan@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*10923SEvan.Yan@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*10923SEvan.Yan@Sun.COM  *
19*10923SEvan.Yan@Sun.COM  * CDDL HEADER END
20*10923SEvan.Yan@Sun.COM  */
21*10923SEvan.Yan@Sun.COM 
22*10923SEvan.Yan@Sun.COM /*
23*10923SEvan.Yan@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24*10923SEvan.Yan@Sun.COM  * Use is subject to license terms.
25*10923SEvan.Yan@Sun.COM  */
26*10923SEvan.Yan@Sun.COM 
27*10923SEvan.Yan@Sun.COM #ifndef	_HOTPLUGD_IMPL_H
28*10923SEvan.Yan@Sun.COM #define	_HOTPLUGD_IMPL_H
29*10923SEvan.Yan@Sun.COM 
30*10923SEvan.Yan@Sun.COM #ifdef  __cplusplus
31*10923SEvan.Yan@Sun.COM extern "C" {
32*10923SEvan.Yan@Sun.COM #endif
33*10923SEvan.Yan@Sun.COM 
34*10923SEvan.Yan@Sun.COM /*
35*10923SEvan.Yan@Sun.COM  * Define macros to test connection states.
36*10923SEvan.Yan@Sun.COM  */
37*10923SEvan.Yan@Sun.COM #define	HP_IS_ENABLED(s)	(s == DDI_HP_CN_STATE_ENABLED)
38*10923SEvan.Yan@Sun.COM 
39*10923SEvan.Yan@Sun.COM #define	HP_IS_ONLINE(s)		((s == DDI_HP_CN_STATE_ONLINE) || \
40*10923SEvan.Yan@Sun.COM 				(s == DDI_HP_CN_STATE_MAINTENANCE))
41*10923SEvan.Yan@Sun.COM 
42*10923SEvan.Yan@Sun.COM #define	HP_IS_OFFLINE(s)	((s == DDI_HP_CN_STATE_PORT_EMPTY) || \
43*10923SEvan.Yan@Sun.COM 				(s == DDI_HP_CN_STATE_PORT_PRESENT) || \
44*10923SEvan.Yan@Sun.COM 				(s == DDI_HP_CN_STATE_OFFLINE))
45*10923SEvan.Yan@Sun.COM 
46*10923SEvan.Yan@Sun.COM /*
47*10923SEvan.Yan@Sun.COM  * Define size of nvlist buffer for set/get commands.
48*10923SEvan.Yan@Sun.COM  */
49*10923SEvan.Yan@Sun.COM #define	HP_PRIVATE_BUF_SZ	4096
50*10923SEvan.Yan@Sun.COM 
51*10923SEvan.Yan@Sun.COM /*
52*10923SEvan.Yan@Sun.COM  * Define a string for parsing /devices paths.
53*10923SEvan.Yan@Sun.COM  */
54*10923SEvan.Yan@Sun.COM #define	S_DEVICES		"/devices"
55*10923SEvan.Yan@Sun.COM 
56*10923SEvan.Yan@Sun.COM /*
57*10923SEvan.Yan@Sun.COM  * Global functions.
58*10923SEvan.Yan@Sun.COM  */
59*10923SEvan.Yan@Sun.COM void		log_err(char *fmt, ...);
60*10923SEvan.Yan@Sun.COM void		log_info(char *fmt, ...);
61*10923SEvan.Yan@Sun.COM void		dprintf(char *fmt, ...);
62*10923SEvan.Yan@Sun.COM boolean_t	door_server_init(void);
63*10923SEvan.Yan@Sun.COM void		door_server_fini(void);
64*10923SEvan.Yan@Sun.COM int		getinfo(const char *path, const char *connection, uint_t flags,
65*10923SEvan.Yan@Sun.COM 		    hp_node_t *rootp);
66*10923SEvan.Yan@Sun.COM int		changestate(const char *path, const char *connection, int state,
67*10923SEvan.Yan@Sun.COM 		    uint_t flags, int *old_statep, hp_node_t *resultsp);
68*10923SEvan.Yan@Sun.COM int		private_options(const char *path, const char *connection,
69*10923SEvan.Yan@Sun.COM 		    hp_cmd_t cmd, const char *options, char **resultsp);
70*10923SEvan.Yan@Sun.COM int		copy_usage(hp_node_t root);
71*10923SEvan.Yan@Sun.COM int		rcm_resources(hp_node_t root, char ***rsrcsp);
72*10923SEvan.Yan@Sun.COM void		free_rcm_resources(char **rsrcs);
73*10923SEvan.Yan@Sun.COM int		rcm_offline(char **rsrcs, uint_t flags, hp_node_t root);
74*10923SEvan.Yan@Sun.COM void		rcm_online(char **rsrcs);
75*10923SEvan.Yan@Sun.COM void		rcm_remove(char **rsrcs);
76*10923SEvan.Yan@Sun.COM 
77*10923SEvan.Yan@Sun.COM #ifdef  __cplusplus
78*10923SEvan.Yan@Sun.COM }
79*10923SEvan.Yan@Sun.COM #endif
80*10923SEvan.Yan@Sun.COM 
81*10923SEvan.Yan@Sun.COM #endif	/* _HOTPLUGD_IMPL_H */
82