2 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH DI_DEVLINK_INIT 3DEVINFO "Jul 21, 2008"
8 di_devlink_init, di_devlink_fini \- create and destroy a snapshot of devlinks
12 \fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-ldevinfo\fR [ \fIlibrary\fR... ]
13 #include <libdevinfo.h>
15 \fBdi_devlink_handle_t\fR \fBdi_devlink_init\fR(\fBconst char *\fR\fIname\fR,
16 \fBuint_t\fR \fIflags\fR);
21 \fBint\fR \fBdi_devlink_fini\fR(\fBdi_devlink_handle_t *\fR\fIhdlp\fR);
31 The following values are supported:
35 \fB\fBDI_MAKE_LINK\fR\fR
38 Synchronize with devlink management before taking the snapshot. The name
39 argument determines which devlink management activities must complete before
40 taking a devlink snapshot. Appropriate privileges are required to use this
52 If flags is \fBDI_MAKE_LINK\fR, \fIname\fR determines which devlink management
53 activity must complete prior to snapshot.
58 If \fIname\fR is \fINULL\fR then all devlink management activities must
59 complete. The devlink snapshot returned accurately reflects the entire kernel
66 If \fIname\fR is a driver name, devlink management activities associated with
67 nodes bound to that driver must complete.
73 If \fIname\fR is a path to a node in the kernel device tree (no
74 "\fB/devices\fR" prefix), devlink management activities below node must
81 If \fIname\fR is a path to a minor node in the kernel device tree (no
82 "\fB/devices\fR"prefix), devlink management activities on that minor node must
93 The handle to the snapshot obtained by calling \fBdi_devlink_init()\fR.
99 System management applications often need to map a "\fB/devices\fR" path to a
100 minor node to a public "\fB/dev\fR" device name. The \fBdi_devlink_*()\fR
101 functions provide an efficient way to accomplish this.
104 The \fBdi_devlink_init()\fR function takes a snapshot of devlinks and returns a
105 handle to this snapshot.
108 The \fBdi_devlink_fini()\fR function destroys the devlink snapshot and frees
109 the associated memory.
113 Upon successful completion, \fBdi_devlink_init()\fR returns a handle to a
114 devlink snapshot. Otherwise, \fBDI_LINK_NIL\fR is returned and \fBerrno\fR is
115 set to indicate the error.
118 Upon successful completion, \fBdi_devlink_fini()\fR returns 0. Otherwise, -1 is
119 returned and \fBerrno\fR is set to indicate the error.
123 The \fBdi_devlink_init()\fR function will fail if:
130 One or more arguments is invalid.
135 The \fBdi_devlink_init()\fR function with \fBDI_MAKE_LINK\fR can also fail if:
142 The user does no have appropriate privileges.
147 The \fBdi_devlink_init()\fR function can set \fBerrno\fR to any error value
148 that can also be set by \fBmalloc\fR(3C), \fBopen\fR(2), \fBioctl\fR(2), or
153 See \fBattributes\fR(5) for descriptions of the following attributes:
161 ATTRIBUTE TYPE ATTRIBUTE VALUE
163 Interface Stability Committed
171 \fBioctl\fR(2), \fBmmap\fR(2), \fBopen\fR(2), \fBdi_devlink_path\fR(3DEVINFO),
172 \fBdi_devlink_walk\fR(3DEVINFO), \fBlibdevinfo\fR(3LIB), \fBmalloc\fR(3C),