Current File : //usr/man/man3devinfo/di_walk_lnode.3devinfo
'\" te
.\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
.TH di_walk_lnode 3DEVINFO "22 Mar 2004" "SunOS 5.11" "Device Information Library Functions"
.SH NAME
di_walk_lnode \- traverse libdevinfo lnodes
.SH SYNOPSIS
.LP
.nf
cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-ldevinfo\fR [ \fIlibrary\fR\&.\|.\|. ] 
#include <libdevinfo.h>

\fBint\fR \fBdi_walk_lnode\fR(\fBdi_node_t\fR \fIroot\fR, \fBuint_t\fR \fIflag\fR, \fBvoid *\fR\fIarg\fR,
     \fBint (*\fR\fIlnode_callback\fR)(di_lnode_t \fIlink\fR, void *\fIarg\fR));
.fi

.SH PARAMETERS
.sp
.ne 2
.mk
.na
\fB\fIroot\fR\fR
.ad
.RS 18n
.rt  
The handle to the root node of the subtree to visit.
.RE

.sp
.ne 2
.mk
.na
\fB\fIflag\fR\fR
.ad
.RS 18n
.rt  
Specify 0. Reserved for future use.
.RE

.sp
.ne 2
.mk
.na
\fB\fIarg\fR\fR
.ad
.RS 18n
.rt  
A pointer to caller-specific data.
.RE

.sp
.ne 2
.mk
.na
\fB\fIlnode_callback\fR\fR
.ad
.RS 18n
.rt  
The caller-supplied callback function.
.RE

.SH DESCRIPTION
.sp
.LP
The \fBdi_walk_lnode()\fR function visits all nodes in the subtree rooted at \fIroot\fR.  For each node found, the caller-supplied function \fIlnode_callback\fR() is invoked for each lnode associated with that node.  The return value of \fIlnode_callback\fR() specifies subsequent walking behavior where that node is the specified \fIendpoint\fR of the link.
.SH RETURN VALUES
.sp
.LP
Upon successful completion, \fBdi_walk_lnode()\fR returns 0.  Otherwise, -1 is returned and \fBerrno\fR is set to indicate the error.
.sp
.LP
The callback function \fIlnode_callback\fR() can return one of the following:
.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 \fBdi_walk_lnode()\fR function will fail if:
.sp
.ne 2
.mk
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
.rt  
An argument is invalid.
.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_init\fR(3DEVINFO), \fBlibdevinfo\fR(3LIB), \fBattributes\fR(5)