2 .\" Copyright (c) 2008, 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_DEVLINK_WALK 3DEVINFO "May 15, 2008"
8 di_devlink_walk \- walk through links in a devlink snapshot
12 \fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-ldevinfo\fR [ \fIlibrary\fR... ]
13 #include <libdevinfo.h>
15 \fBint\fR \fBdi_devlink_walk\fR(\fBdi_devlink_handle_t\fR \fIhdl\fR,\fBconst char *\fR\fIre\fR,
16 \fBconst char *\fR\fImpath\fR, \fBuint_t\fR \fIflags\fR, \fBvoid *\fR\fIarg\fR,
17 \fBint\fR (*\fIdevlink_callback\fR)(\fBdi_devlink_t\fR \fIdevlink\fR, \fBvoid *\fR\fIarg\fR));
27 A handle to a snapshot of devlinks in "\fB/dev\fR".
36 An extended regular expression as specified in \fBregex\fR(5) describing the
37 paths of devlinks to visit. A null value matches all devlinks. The expression
38 should not involve the "\fB/dev\fR" prefix. For example, the "^\fBdsk/\fR" will
39 invoke \fIdevlink_callback\fR() for all "\fB/dev/dsk/\fR" links.
48 A path to a minor node below "\fB/devices\fR" for which "\fB/dev\fR" links are
49 to be looked up. A null value selects all devlinks. This path should not have
50 a "\fB/devices\fR" prefix.
59 Specify the type of devlinks to be selected. If \fBDI_PRIMARY_LINK\fR is used,
60 only primary links (for instance, links which point only to "\fB/devices\fR"
61 entries) are selected. If \fBDI_SECONDARY_LINK\fR is specified, only secondary
62 links (for instance, devlinks which point to other devlinks) are selected. If
63 neither flag is specified, all devlinks are selected.
72 A pointer to caller private data.
81 The devlink being visited.
87 The \fBdi_devlink_walk()\fR function visits every link in the snapshot that
88 meets the criteria specified by the caller. For each such devlink, the
89 caller-supplied function \fIdevlink_callback\fR() is invoked. The return value
90 of \fIdevlink_callback\fR() determines subsequent walk behavior.
94 Upon success, the \fBdi_devlink_walk()\fR function returns 0. Otherwise, -1 is
95 returned and \fBerrno\fR is set to indicate the error.
98 The \fIdevlink_callback\fR() function can return the following values:
102 \fB\fBDI_WALK_CONTINUE\fR\fR
111 \fB\fBDI_WALK_TERMINATE\fR\fR
114 Terminate the walk immediately.
120 The \fBdevlink_callback()\fR function will fail if:
127 One or more arguments is invalid.
136 Insufficient memory is available.
142 See \fBattributes\fR(5) for descriptions of the following attributes:
150 ATTRIBUTE TYPE ATTRIBUTE VALUE
152 Interface Stability Committed
160 \fBdi_devlink_init\fR(3DEVINFO), \fBdi_devlink_path\fR(3DEVINFO),
161 \fBlibdevinfo\fR(3LIB), \fBmalloc\fR(3C), \fBattributes\fR(5), \fBregex\fR(5)