1di_walk_node(3DEVINFO)Device Information Library Functionsdi_walk_node(3DEVINFO)
2
3
4
6 di_walk_node - traverse libdevinfo device nodes
7
9 cc [ flag... ] file... -ldevinfo [ library... ]
10 #include <libdevinfo.h>
11
12 int di_walk_node(di_node_t root, uint_t flag, void *arg,
13 int (*node_callback)(di_node_t node, void *arg));
14
15
17 The di_walk_node() function visits all nodes in the subtree rooted at
18 root. For each node found, the caller-supplied function node_callback()
19 is invoked. The return value of node_callback() specifies subsequent
20 walking behavior.
21
23 arg Pointer to caller-specific data.
24
25
26 flag Specifies walking order, either DI_WALK_CLDFIRST (depth first)
27 or DI_WALK_SIBFIRST (breadth first). DI_WALK_CLDFIRST is the
28 default.
29
30
31 node The node being visited.
32
33
34 root The handle to the root node of the subtree to visit.
35
36
38 Upon successful completion, di_walk_node() returns 0. Otherwise, -1 is
39 returned and errno is set to indicate the error.
40
41
42 The node_callback() function can return one of the following:
43
44 DI_WALK_CONTINUE Continue walking.
45
46
47 DI_WALK_PRUNESIB Continue walking, but skip siblings and their
48 child nodes.
49
50
51 DI_WALK_PRUNECHILD Continue walking, but skip subtree rooted at cur‐
52 rent node.
53
54
55 DI_WALK_TERMINATE Terminate the walk immediately.
56
57
59 The di_walk_node() function will fail if:
60
61 EINVAL Invalid argument.
62
63
65 See attributes(5) for descriptions of the following attributes:
66
67
68
69
70 ┌─────────────────────────────┬─────────────────────────────┐
71 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
72 ├─────────────────────────────┼─────────────────────────────┤
73 │Interface Stability │Committed │
74 ├─────────────────────────────┼─────────────────────────────┤
75 │MT-Level │Safe │
76 └─────────────────────────────┴─────────────────────────────┘
77
79 di_init(3DEVINFO), libdevinfo(3LIB), attributes(5)
80
81
82 Writing Device Drivers
83
84
85
86SunOS 5.11 16 Jan 2009 di_walk_node(3DEVINFO)