1di_devlink_walk(3DEVINDFeOv)ice Information Library Functidoin_sdevlink_walk(3DEVINFO)
2
3
4
6 di_devlink_walk - walk through links in a devlink snapshot
7
9 cc [ flag... ] file... -ldevinfo [ library... ]
10 #include <libdevinfo.h>
11
12 int di_devlink_walk(di_devlink_handle_t hdl,const char *re,
13 const char *mpath, uint_t flags, void *arg,
14 int (*devlink_callback)(di_devlink_t devlink, void *arg));
15
16
18 hdl A handle to a snapshot of devlinks in "/dev".
19
20
21 re An extended regular expression as specified in regex(5)
22 describing the paths of devlinks to visit. A null value
23 matches all devlinks. The expression should not involve the
24 "/dev" prefix. For example, the "^dsk/" will invoke
25 devlink_callback() for all "/dev/dsk/" links.
26
27
28 mpath A path to a minor node below "/devices" for which "/dev"
29 links are to be looked up. A null value selects all
30 devlinks. This path should not have a "/devices" prefix.
31
32
33 flags Specify the type of devlinks to be selected. If DI_PRI‐
34 MARY_LINK is used, only primary links (for instance, links
35 which point only to "/devices" entries) are selected. If
36 DI_SECONDARY_LINK is specified, only secondary links (for
37 instance, devlinks which point to other devlinks) are
38 selected. If neither flag is specified, all devlinks are
39 selected.
40
41
42 arg A pointer to caller private data.
43
44
45 devlink The devlink being visited.
46
47
49 The di_devlink_walk() function visits every link in the snapshot that
50 meets the criteria specified by the caller. For each such devlink, the
51 caller-supplied function devlink_callback() is invoked. The return
52 value of devlink_callback() determines subsequent walk behavior.
53
55 Upon success, the di_devlink_walk() function returns 0. Otherwise, -1
56 is returned and errno is set to indicate the error.
57
58
59 The devlink_callback() function can return the following values:
60
61 DI_WALK_CONTINUE Continue walking.
62
63
64 DI_WALK_TERMINATE Terminate the walk immediately.
65
66
68 The devlink_callback() function will fail if:
69
70 EINVAL One or more arguments is invalid.
71
72
73 ENOMEM Insufficient memory is available.
74
75
77 See attributes(5) for descriptions of the following attributes:
78
79
80
81
82 ┌─────────────────────────────┬─────────────────────────────┐
83 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
84 ├─────────────────────────────┼─────────────────────────────┤
85 │Interface Stability │Committed │
86 ├─────────────────────────────┼─────────────────────────────┤
87 │MT-Level │Safe │
88 └─────────────────────────────┴─────────────────────────────┘
89
91 di_devlink_init(3DEVINFO), di_devlink_path(3DEVINFO), libdevinfo(3LIB),
92 malloc(3C), attributes(5), regex(5)
93
94
95
96SunOS 5.11 15 May 2008 di_devlink_walk(3DEVINFO)