2 .\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH DI_WALK_NODE 3DEVINFO "Jan 16, 2009"
8 di_walk_node \- traverse libdevinfo device nodes
12 \fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-ldevinfo\fR [ \fIlibrary\fR... ]
13 #include <libdevinfo.h>
15 \fBint\fR \fBdi_walk_node\fR(\fBdi_node_t\fR \fIroot\fR, \fBuint_t\fR \fIflag\fR, \fBvoid *\fR\fIarg\fR,
16 \fBint\fR \fI(*node_callback)\fR(\fBdi_node_t\fR \fInode\fR, \fBvoid *\fR\fIarg\fR));
22 The \fBdi_walk_node()\fR function visits all nodes in the subtree rooted at
23 \fIroot\fR. For each node found, the caller-supplied function
24 \fInode_callback\fR() is invoked. The return value of \fInode_callback\fR()
25 specifies subsequent walking behavior.
33 Pointer to caller-specific data.
42 Specifies walking order, either \fBDI_WALK_CLDFIRST\fR (depth first) or
43 \fBDI_WALK_SIBFIRST\fR (breadth first). \fBDI_WALK_CLDFIRST\fR is the default.
52 The node being visited.
61 The handle to the root node of the subtree to visit.
67 Upon successful completion, \fBdi_walk_node()\fR returns 0. Otherwise, \fB-1\fR
68 is returned and \fIerrno\fR is set to indicate the error.
71 The \fInode_callback\fR() function can return one of the following:
75 \fB\fBDI_WALK_CONTINUE\fR\fR
84 \fB\fBDI_WALK_PRUNESIB\fR\fR
87 Continue walking, but skip siblings and their child nodes.
93 \fB\fBDI_WALK_PRUNECHILD\fR\fR
96 Continue walking, but skip subtree rooted at current node.
102 \fB\fBDI_WALK_TERMINATE\fR\fR
105 Terminate the walk immediately.
111 The \fBdi_walk_node()\fR function will fail if:
124 See \fBattributes\fR(5) for descriptions of the following attributes:
132 ATTRIBUTE TYPE ATTRIBUTE VALUE
134 Interface Stability Committed
142 \fBdi_init\fR(3DEVINFO), \fBlibdevinfo\fR(3LIB), \fBattributes\fR(5)
145 \fIWriting Device Drivers\fR