1di_child_node(3DEVINFOD)evice Information Library Functiondsi_child_node(3DEVINFO)
2
3
4
6 di_child_node, di_parent_node, di_sibling_node, di_drv_first_node,
7 di_drv_next_node - libdevinfo node traversal functions
8
10 cc [ flag... ] file... -ldevinfo [ library... ]
11 #include <libdevinfo.h>
12
13 di_node_t di_child_node(di_node_t node);
14
15
16 di_node_t di_parent_node(di_node_t node);
17
18
19 di_node_t di_sibling_node(di_node_t node);
20
21
22 di_node_t di_drv_first_node(const char *drv_name, di_node_t root);
23
24
25 di_node_t di_drv_next_node(di_node_t node);
26
27
29 drv_name The name of the driver of interest.
30
31
32 node A handle to any node in the snapshot.
33
34
35 root The handle of the root node for the snapshot returned by
36 di_init(3DEVINFO).
37
38
40 The kernel device configuration data may be viewed in two ways, either
41 as a tree of device configuration nodes or as a list of nodes associ‐
42 ated with each driver. In the tree view, each node may contain refer‐
43 ences to its parent, the next sibling in a list of siblings, and the
44 first child of a list of children. In the per-driver view, each node
45 contains a reference to the next node associated with the same driver.
46 Both views are captured in the snapshot, and the interfaces are pro‐
47 vided for node access.
48
49
50 The di_child_node() function obtains a handle to the first child of
51 node. If no child node exists in the snapshot, DI_NODE_NIL is returned
52 and errno is set to ENXIO or ENOTSUP.
53
54
55 The di_parent_node() function obtains a handle to the parent node of
56 node. If no parent node exists in the snapshot, DI_NODE_NIL is returned
57 and errno is set to ENXIO or ENOTSUP.
58
59
60 The di_sibling_node() function obtains a handle to the next sibling
61 node of node. If no next sibling node exists in the snapshot,
62 DI_NODE_NIL is returned and errno is set to ENXIO or ENOTSUP.
63
64
65 The di_drv_first_node() function obtains a handle to the first node
66 associated with the driver specified by drv_name. If there is no such
67 driver, DI_NODE_NIL is returned with errno is set to EINVAL. If the
68 driver exists but there is no node associated with this driver,
69 DI_NODE_NIL is returned and errno is set to ENXIO or ENOTSUP.
70
71
72 The di_drv_next_node() function returns a handle to the next node bound
73 to the same driver. If no more nodes exist, DI_NODE_NIL is returned.
74
76 Upon successful completion, a handle is returned. Otherwise,
77 DI_NODE_NIL is returned and errno is set to indicate the error.
78
80 These functions will fail if:
81
82 EINVAL The argument is invalid.
83
84
85 ENXIO The requested node does not exist.
86
87
88 ENOTSUP The node was not found in the snapshot, but it may exist in
89 the kernel. This error may occur if the snapshot contains a
90 partial device tree.
91
92
94 See attributes(5) for descriptions of the following attributes:
95
96
97
98
99 ┌─────────────────────────────┬─────────────────────────────┐
100 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
101 ├─────────────────────────────┼─────────────────────────────┤
102 │Interface Stability │Evolving │
103 ├─────────────────────────────┼─────────────────────────────┤
104 │MT-Level │Safe │
105 └─────────────────────────────┴─────────────────────────────┘
106
108 di_init(3DEVINFO), libdevinfo(3LIB), attributes(5)
109
110
111 Writing Device Drivers
112
113
114
115SunOS 5.11 1 Dec 1998 di_child_node(3DEVINFO)