1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
'\" te
.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH DI_DEVLINK_INIT 3DEVINFO "Jul 21, 2008"
.SH NAME
di_devlink_init, di_devlink_fini \- create and destroy a snapshot of devlinks
.SH SYNOPSIS
.LP
.nf
\fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-ldevinfo\fR [ \fIlibrary\fR... ]
#include <libdevinfo.h>
\fBdi_devlink_handle_t\fR \fBdi_devlink_init\fR(\fBconst char *\fR\fIname\fR,
\fBuint_t\fR \fIflags\fR);
.fi
.LP
.nf
\fBint\fR \fBdi_devlink_fini\fR(\fBdi_devlink_handle_t *\fR\fIhdlp\fR);
.fi
.SH PARAMETERS
.sp
.ne 2
.na
\fB\fIflags\fR\fR
.ad
.RS 9n
The following values are supported:
.sp
.ne 2
.na
\fB\fBDI_MAKE_LINK\fR\fR
.ad
.RS 16n
Synchronize with devlink management before taking the snapshot. The name
argument determines which devlink management activities must complete before
taking a devlink snapshot. Appropriate privileges are required to use this
flag.
.RE
.RE
.sp
.ne 2
.na
\fB\fIname\fR\fR
.ad
.RS 9n
If flags is \fBDI_MAKE_LINK\fR, \fIname\fR determines which devlink management
activity must complete prior to snapshot.
.RS +4
.TP
.ie t \(bu
.el o
If \fIname\fR is \fINULL\fR then all devlink management activities must
complete. The devlink snapshot returned accurately reflects the entire kernel
device tree.
.RE
.RS +4
.TP
.ie t \(bu
.el o
If \fIname\fR is a driver name, devlink management activities associated with
nodes bound to that driver must complete.
.RE
.RS +4
.TP
.ie t \(bu
.el o
If \fIname\fR is a path to a node in the kernel device tree (no
"\fB/devices\fR" prefix), devlink management activities below node must
complete.
.RE
.RS +4
.TP
.ie t \(bu
.el o
If \fIname\fR is a path to a minor node in the kernel device tree (no
"\fB/devices\fR"prefix), devlink management activities on that minor node must
complete.
.RE
.RE
.sp
.ne 2
.na
\fB\fIhdlp\fR\fR
.ad
.RS 9n
The handle to the snapshot obtained by calling \fBdi_devlink_init()\fR.
.RE
.SH DESCRIPTION
.sp
.LP
System management applications often need to map a "\fB/devices\fR" path to a
minor node to a public "\fB/dev\fR" device name. The \fBdi_devlink_*()\fR
functions provide an efficient way to accomplish this.
.sp
.LP
The \fBdi_devlink_init()\fR function takes a snapshot of devlinks and returns a
handle to this snapshot.
.sp
.LP
The \fBdi_devlink_fini()\fR function destroys the devlink snapshot and frees
the associated memory.
.SH RETURN VALUES
.sp
.LP
Upon successful completion, \fBdi_devlink_init()\fR returns a handle to a
devlink snapshot. Otherwise, \fBDI_LINK_NIL\fR is returned and \fBerrno\fR is
set to indicate the error.
.sp
.LP
Upon successful completion, \fBdi_devlink_fini()\fR returns 0. Otherwise, -1 is
returned and \fBerrno\fR is set to indicate the error.
.SH ERRORS
.sp
.LP
The \fBdi_devlink_init()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
One or more arguments is invalid.
.RE
.sp
.LP
The \fBdi_devlink_init()\fR function with \fBDI_MAKE_LINK\fR can also fail if:
.sp
.ne 2
.na
\fB\fBEPERM\fR\fR
.ad
.RS 9n
The user does no have appropriate privileges.
.RE
.sp
.LP
The \fBdi_devlink_init()\fR function can set \fBerrno\fR to any error value
that can also be set by \fBmalloc\fR(3C), \fBopen\fR(2), \fBioctl\fR(2), or
\fBmmap\fR(2).
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp
.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE ATTRIBUTE VALUE
_
Interface Stability Committed
_
MT-Level Safe
.TE
.SH SEE ALSO
.sp
.LP
.BR ioctl (2),
.BR mmap (2),
.BR open (2),
.BR malloc (3C),
.BR di_devlink_path (3DEVINFO),
.BR di_devlink_walk (3DEVINFO),
.BR libdevinfo (3LIB),
.BR attributes (7)
|