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