'\" te .\" Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. .TH di_devlink_walk 3DEVINFO "15 May 2008" "SunOS 5.11" "Device Information Library Functions" .SH NAME di_devlink_walk \- walk through links in a devlink snapshot .SH SYNOPSIS .LP .nf \fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-ldevinfo\fR [ \fIlibrary\fR... ] #include \fBint\fR \fBdi_devlink_walk\fR(\fBdi_devlink_handle_t\fR \fIhdl\fR, \fBconst char *\fR\fIre\fR, \fBconst char *\fR\fImpath\fR, \fBuint_t\fR \fIflags\fR, \fBvoid *\fR\fIarg\fR, \fBint\fR (*\fIdevlink_callback\fR)(\fBdi_devlink_t\fR \fIdevlink\fR, \fBvoid *\fR\fIarg\fR)); .fi .SH PARAMETERS .sp .ne 2 .mk .na \fB\fIhdl\fR\fR .ad .RS 11n .rt A handle to a snapshot of devlinks in "\fB/dev\fR". .RE .sp .ne 2 .mk .na \fB\fIre\fR\fR .ad .RS 11n .rt An extended regular expression as specified in \fBregex\fR(5) describing the paths of devlinks to visit. A null value matches all devlinks. The expression should not involve the "\fB/dev\fR" prefix. For example, the "^\fBdsk/\fR" will invoke \fIdevlink_callback\fR() for all "\fB/dev/dsk/\fR" links. .RE .sp .ne 2 .mk .na \fB\fImpath\fR\fR .ad .RS 11n .rt A path to a minor node below "\fB/devices\fR" for which "\fB/dev\fR" links are to be looked up. A null value selects all devlinks. This path should not have a "\fB/devices\fR" prefix. .RE .sp .ne 2 .mk .na \fB\fIarg\fR\fR .ad .RS 11n .rt A pointer to caller private data. .RE .sp .ne 2 .mk .na \fB\fIdevlink\fR\fR .ad .RS 11n .rt The devlink being visited. .RE .SH DESCRIPTION .sp .LP The \fBdi_devlink_walk()\fR function visits every link in the snapshot that meets the criteria specified by the caller. For each such devlink, the caller-supplied function \fIdevlink_callback\fR() is invoked. The return value of \fIdevlink_callback\fR() determines subsequent walk behavior. .SH RETURN VALUES .sp .LP Upon success, the \fBdi_devlink_walk()\fR function returns 0. Otherwise, -1 is returned and \fBerrno\fR is set to indicate the error. .sp .LP The \fIdevlink_callback\fR() function can return the following values: .sp .ne 2 .mk .na \fB\fBDI_WALK_CONTINUE\fR\fR .ad .RS 21n .rt Continue walking. .RE .sp .ne 2 .mk .na \fB\fBDI_WALK_TERMINATE\fR\fR .ad .RS 21n .rt Terminate the walk immediately. .RE .SH ERRORS .sp .LP The \fBdevlink_callback()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 10n .rt One or more arguments is invalid. .RE .sp .ne 2 .mk .na \fB\fBENOMEM\fR\fR .ad .RS 10n .rt Insufficient memory is available. .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelSafe .TE .SH SEE ALSO .sp .LP \fBdi_devlink_init\fR(3DEVINFO), \fBdi_devlink_path\fR(3DEVINFO), \fBlibdevinfo\fR(3LIB), \fBmalloc\fR(3C), \fBattributes\fR(5), \fBregex\fR(5)