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_MINOR 3DEVINFO "Jan 14, 2009"
8 di_walk_minor \- traverse libdevinfo minor nodes
12 \fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-ldevinfo\fR [ \fIlibrary\fR... ]
13 #include <libdevinfo.h>
15 \fBint\fR \fBdi_walk_minor\fR(\fBdi_node_t\fR \fIroot\fR, \fBconst char *\fR\fIminor_nodetype\fR,
16 \fBuint_t\fR \fIflag\fR, \fBvoid *\fR\fIarg\fR, \fBint\fR (\fI*minor_callback\fR)(di_node_t \fInode\fR,
17 di_minor_t \fIminor\fR, void *\fIarg\fR));
27 Pointer to caller- specific user data.
36 Specify 0. Reserved for future use.
45 The minor node visited.
51 \fB\fIminor_nodetype\fR\fR
54 A character string specifying the minor data type, which may be one of the
55 types defined by the Solaris DDI framework, for example, \fBDDI_NT_BLOCK\fR.
56 \fBNULL\fR matches all \fIminor_node\fR types. See
57 \fBddi_create_minor_node\fR(9F).
66 The device node with which to the minor node is associated.
75 Root of subtree to visit.
81 The \fBdi_walk_minor()\fR function visits all minor nodes attached to device
82 nodes in a subtree rooted at \fIroot\fR. For each minor node that matches
83 \fIminor_nodetype\fR, the caller-supplied function \fIminor_callback\fR() is
84 invoked. The walk terminates immediately when \fIminor_callback\fR() returns
85 \fBDI_WALK_TERMINATE\fR.
89 Upon successful completion, \fBdi_walk_minor()\fR returns 0. Otherwise, -1 is
90 returned and errno is set to indicate the error.
93 The \fBminor_callback()\fR function returns one of the following:
97 \fB\fBDI_WALK_CONTINUE\fR\fR
100 Continue to visit subsequent minor data nodes.
106 \fB\fBDI_WALK_TERMINATE\fR\fR
109 Terminate the walk immediately.
115 The \fBdi_walk_minor()\fR function will fail if:
128 See \fBattributes\fR(5) for descriptions of the following attributes:
136 ATTRIBUTE TYPE ATTRIBUTE VALUE
138 Interface Stability Committed
146 \fBdladm\fR(1M), \fBdi_minor_nodetype\fR(3DEVINFO), dlpi_walk(3DLPI),
147 \fBlibdevinfo\fR(3LIB), \fBattributes\fR(5), \fBfilesystem\fR(5),
148 \fBddi_create_minor_node\fR(9F)
151 \fIWriting Device Drivers\fR
155 The \fBdi_walk_minor()\fR function is no longer an accurate method for walking
156 network datalink interfaces on the system. Applications should use
157 \fBdlpi_walk\fR(3DLPI) instead. It has been common for applications to use
158 \fBdi_walk_minor()\fR to walk networking devices by passing in a
159 \fBminor_nodetype\fR of \fBDDI_NT_NET\fR, in most cases to discover the set of
160 DLPI devices on the system. Solaris now makes a layering distinction between
161 networking devices (the objects displayed in the \fBDEVICE\fR field by
162 \fBdladm\fR \fBshow-phys\fR) and network datalink interfaces (the objects
163 displayed by \fBdladm\fR \fBshow-link\fR). Datalink interfaces are represented
164 as the set of DLPI device nodes that applications can open by using
165 \fBdlpi_open\fR(3DLPI) or by opening DLPI nodes out of the \fB/dev/net\fR
166 filesystem (see \fBfilesystem\fR(5)). The \fBdlpi_walk\fR(3DLPI) function is
167 the proper function to walk these nodes.