Lines Matching refs:node
126 hp_node_t node; in hp_fini() local
140 for (node = root; node != NULL; node = node->hp_sibling) in hp_fini()
141 node->hp_basepath = NULL; in hp_fini()
146 node = root; in hp_fini()
147 while (node) { in hp_fini()
148 sibling = node->hp_sibling; in hp_fini()
149 if (node->hp_child) in hp_fini()
150 hp_fini(node->hp_child); in hp_fini()
151 if (node->hp_name) in hp_fini()
152 free(node->hp_name); in hp_fini()
153 if (node->hp_usage) in hp_fini()
154 free(node->hp_usage); in hp_fini()
155 if (node->hp_description) in hp_fini()
156 free(node->hp_description); in hp_fini()
157 free(node); in hp_fini()
158 node = sibling; in hp_fini()
171 hp_node_t node; in hp_traverse() local
183 for (node = root; node; node = node->hp_sibling) { in hp_traverse()
184 rv = hp_callback(node, arg); in hp_traverse()
191 if (node->hp_child && (rv != HP_WALK_PRUNECHILD)) in hp_traverse()
192 if (hp_traverse(node->hp_child, arg, hp_callback) == in hp_traverse()
211 hp_type(hp_node_t node) in hp_type() argument
213 i_hp_dprintf("hp_type: node=%p\n", (void *)node); in hp_type()
215 if (node == NULL) { in hp_type()
221 return (node->hp_type); in hp_type()
230 hp_name(hp_node_t node) in hp_name() argument
232 i_hp_dprintf("hp_name: node=%p\n", (void *)node); in hp_name()
234 if (node == NULL) { in hp_name()
240 if (node->hp_name == NULL) { in hp_name()
245 return (node->hp_name); in hp_name()
254 hp_state(hp_node_t node) in hp_state() argument
256 i_hp_dprintf("hp_state: node=%p\n", (void *)node); in hp_state()
258 if (node == NULL) { in hp_state()
264 if ((node->hp_type != HP_NODE_CONNECTOR) && in hp_state()
265 (node->hp_type != HP_NODE_PORT)) { in hp_state()
271 return (node->hp_state); in hp_state()
280 hp_usage(hp_node_t node) in hp_usage() argument
282 i_hp_dprintf("hp_usage: node=%p\n", (void *)node); in hp_usage()
284 if (node == NULL) { in hp_usage()
290 if (node->hp_type != HP_NODE_USAGE) { in hp_usage()
296 if (node->hp_usage == NULL) { in hp_usage()
301 return (node->hp_usage); in hp_usage()
310 hp_description(hp_node_t node) in hp_description() argument
312 i_hp_dprintf("hp_description: node=%p\n", (void *)node); in hp_description()
314 if (node == NULL) { in hp_description()
320 if ((node->hp_type != HP_NODE_CONNECTOR) && in hp_description()
321 (node->hp_type != HP_NODE_PORT)) { in hp_description()
327 if (node->hp_description == NULL) { in hp_description()
332 return (node->hp_description); in hp_description()
341 hp_last_change(hp_node_t node) in hp_last_change() argument
343 i_hp_dprintf("hp_last_change: node=%p\n", (void *)node); in hp_last_change()
345 if (node == NULL) { in hp_last_change()
351 if ((node->hp_type != HP_NODE_CONNECTOR) && in hp_last_change()
352 (node->hp_type != HP_NODE_PORT)) { in hp_last_change()
358 return (node->hp_last_change); in hp_last_change()
367 hp_parent(hp_node_t node) in hp_parent() argument
369 i_hp_dprintf("hp_parent: node=%p\n", (void *)node); in hp_parent()
371 if (node == NULL) { in hp_parent()
377 if (node->hp_parent == NULL) { in hp_parent()
382 return (node->hp_parent); in hp_parent()
391 hp_child(hp_node_t node) in hp_child() argument
393 i_hp_dprintf("hp_child: node=%p\n", (void *)node); in hp_child()
395 if (node == NULL) { in hp_child()
401 if (node->hp_child == NULL) { in hp_child()
406 return (node->hp_child); in hp_child()
415 hp_sibling(hp_node_t node) in hp_sibling() argument
417 i_hp_dprintf("hp_sibling: node=%p\n", (void *)node); in hp_sibling()
419 if (node == NULL) { in hp_sibling()
425 if (node->hp_sibling == NULL) { in hp_sibling()
430 return (node->hp_sibling); in hp_sibling()
440 hp_path(hp_node_t node, char *path, char *connection) in hp_path() argument
448 i_hp_dprintf("hp_path: node=%p, path=%p, connection=%p\n", (void *)node, in hp_path()
451 if ((node == NULL) || (path == NULL) || (connection == NULL)) { in hp_path()
461 if ((node->hp_type == HP_NODE_CONNECTOR) || in hp_path()
462 (node->hp_type == HP_NODE_PORT)) in hp_path()
463 (void) strlcpy(connection, node->hp_name, MAXPATHLEN); in hp_path()
466 for (parent = node; parent != NULL; parent = parent->hp_parent) { in hp_path()
507 hp_set_state(hp_node_t node, uint_t flags, int state, hp_node_t *resultsp) in hp_set_state() argument
517 "resultsp=%p\n", (void *)node, flags, state, (void *)resultsp); in hp_set_state()
520 if ((node == NULL) || (resultsp == NULL) || in hp_set_state()
527 if ((node->hp_type != HP_NODE_CONNECTOR) && in hp_set_state()
528 (node->hp_type != HP_NODE_PORT)) { in hp_set_state()
538 if (node->hp_type != HP_NODE_CONNECTOR) { in hp_set_state()
546 if (node->hp_type != HP_NODE_PORT) { in hp_set_state()
557 if ((rv = hp_path(node, path, connection)) != 0) in hp_set_state()
589 hp_set_private(hp_node_t node, const char *options, char **resultsp) in hp_set_private() argument
599 (void *)node, (void *)options, (void *)resultsp); in hp_set_private()
602 if ((node == NULL) || (options == NULL) || (resultsp == NULL)) { in hp_set_private()
608 if (node->hp_type != HP_NODE_CONNECTOR) { in hp_set_private()
617 if ((rv = hp_path(node, path, connection)) != 0) in hp_set_private()
649 hp_get_private(hp_node_t node, const char *options, char **resultsp) in hp_get_private() argument
659 (void *)node, (void *)options, (void *)resultsp); in hp_get_private()
662 if ((node == NULL) || (options == NULL) || (resultsp == NULL)) { in hp_get_private()
668 if (node->hp_type != HP_NODE_CONNECTOR) { in hp_get_private()
677 if ((rv = hp_path(node, path, connection)) != 0) in hp_get_private()
712 hp_node_t node; in hp_pack() local
743 for (node = root; node != NULL; node = node->hp_sibling) { in hp_pack()
744 if ((rv = i_hp_pack_branch(node, &buf, &len)) == 0) { in hp_pack()
936 i_hp_pack_node(hp_node_t node, char **bufp, size_t *lenp) in i_hp_pack_node() argument
947 (uint32_t)node->hp_type)) != 0) in i_hp_pack_node()
950 if ((node->hp_name) && in i_hp_pack_node()
951 ((rv = nvlist_add_string(nvl, HP_INFO_NAME, node->hp_name)) != 0)) in i_hp_pack_node()
954 if ((node->hp_usage) && in i_hp_pack_node()
955 ((rv = nvlist_add_string(nvl, HP_INFO_USAGE, node->hp_usage)) != 0)) in i_hp_pack_node()
958 if ((node->hp_description) && in i_hp_pack_node()
960 node->hp_description)) != 0)) in i_hp_pack_node()
963 if ((rv = nvlist_add_uint32(nvl, HP_INFO_STATE, node->hp_state)) != 0) in i_hp_pack_node()
966 if ((node->hp_last_change != 0) && in i_hp_pack_node()
968 node->hp_last_change)) != 0)) in i_hp_pack_node()
995 hp_node_t node = NULL; in i_hp_unpack_branch() local
1024 if (node != NULL) { in i_hp_unpack_branch()
1025 hp_fini(node); in i_hp_unpack_branch()
1032 rv = i_hp_unpack_node(buf, len, parent, &node); in i_hp_unpack_branch()
1043 rv = i_hp_unpack_branch(buf, len, node, &child); in i_hp_unpack_branch()
1046 hp_fini(node); in i_hp_unpack_branch()
1054 node->hp_child = child; in i_hp_unpack_branch()
1061 *retp = node; in i_hp_unpack_branch()
1073 hp_node_t node; in i_hp_unpack_node() local
1088 if ((node = (hp_node_t)calloc(1, sizeof (struct hp_node))) == NULL) { in i_hp_unpack_node()
1100 node->hp_type = val_uint32; in i_hp_unpack_node()
1106 if ((node->hp_name = strdup(val_string)) == NULL) { in i_hp_unpack_node()
1115 node->hp_state = val_uint32; in i_hp_unpack_node()
1121 if ((node->hp_usage = strdup(val_string)) == NULL) { in i_hp_unpack_node()
1130 if ((node->hp_description = strdup(val_string)) in i_hp_unpack_node()
1140 node->hp_last_change = (time_t)val_uint32; in i_hp_unpack_node()
1153 hp_fini(node); in i_hp_unpack_node()
1158 node->hp_parent = parent; in i_hp_unpack_node()
1159 *retp = node; in i_hp_unpack_node()