8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / libhotplug / common / libhotplug.h
blobc13fd66b51e18a3eac71428a957c74c15fd92298
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _LIBHOTPLUG_H
28 #define _LIBHOTPLUG_H
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
34 #include <sys/types.h>
37 * Define node types in hotplug snapshot.
39 #define HP_NODE_NONE 0
40 #define HP_NODE_DEVICE 1
41 #define HP_NODE_CONNECTOR 2
42 #define HP_NODE_PORT 3
43 #define HP_NODE_USAGE 4
46 * Define flags for hp_init().
48 #define HPINFOUSAGE 0x1
49 #define HPINFOSEARCH 0x2 /* private flag */
52 * Define flags for hp_set_state().
54 #define HPFORCE 0x1
55 #define HPQUERY 0x2
58 * Define private flags.
62 * Define return values for hp_traverse() callbacks.
64 #define HP_WALK_CONTINUE 0
65 #define HP_WALK_PRUNECHILD 1
66 #define HP_WALK_PRUNESIBLING 2
67 #define HP_WALK_TERMINATE 3
70 * Define opaque handle to hotplug nodes.
72 typedef struct hp_node *hp_node_t;
75 * Interface prototypes.
77 hp_node_t hp_init(const char *path, const char *connection, uint_t flags);
78 void hp_fini(hp_node_t root);
79 int hp_traverse(hp_node_t root, void *arg,
80 int (*hp_callback)(hp_node_t, void *arg));
81 int hp_type(hp_node_t node);
82 char *hp_name(hp_node_t node);
83 char *hp_usage(hp_node_t node);
84 int hp_state(hp_node_t node);
85 char *hp_description(hp_node_t node);
86 time_t hp_last_change(hp_node_t node);
87 hp_node_t hp_parent(hp_node_t node);
88 hp_node_t hp_child(hp_node_t node);
89 hp_node_t hp_sibling(hp_node_t node);
90 int hp_path(hp_node_t node, char *path, char *connection);
91 int hp_set_state(hp_node_t node, uint_t flags, int state,
92 hp_node_t *resultsp);
93 int hp_set_private(hp_node_t node, const char *options,
94 char **resultsp);
95 int hp_get_private(hp_node_t node, const char *options,
96 char **resultsp);
97 int hp_pack(hp_node_t root, char **bufp, size_t *lenp);
98 int hp_unpack(char *packed_buf, size_t packed_len, hp_node_t *retp);
100 #ifdef __cplusplus
102 #endif
104 #endif /* _LIBHOTPLUG_H */