summaryrefslogtreecommitdiff
path: root/usr/src/man/man9f/ldi_get_dev.9f
blob: 16d6845039d32cf0a48689b1e5381ed28ace15e4 (plain)
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
'\" te
.\"  Copyright (c) 2003, 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 ldi_get_dev 9F "3 June 2003" "SunOS 5.11" "Kernel Functions for Drivers"
.SH NAME
ldi_get_dev, ldi_get_otyp, ldi_get_devid, ldi_get_minor_name \- Extract
information from a layered handle
.SH SYNOPSIS
.LP
.nf
#include <sys/sunldi.h> 

\fBint\fR \fBldi_get_dev\fR(\fBldi_handle_t lh\fR, \fBdev_t *\fR\fIdevp\fR);
.fi

.LP
.nf
\fBint\fR \fBldi_get_otyp\fR(\fBldi_handle_t lh\fR, \fBint *\fR\fIotyp\fR);
.fi

.LP
.nf
\fBint\fR \fBldi_get_devid\fR(\fBldi_handle_t lh\fR, \fBddi_devid_t *\fR\fIdevid\fR);
.fi

.LP
.nf
\fBint\fR \fBldi_get_minor_name\fR(\fBldi_handle_t lh\fR, \fBchar **\fR\fIminor_name\fR);
.fi

.SH PARAMETERS
.sp
.ne 2
.mk
.na
\fB\fIlh\fR \fR
.ad
.RS 15n
.rt  
Layered handle
.RE

.sp
.ne 2
.mk
.na
\fB\fIotyp\fR \fR
.ad
.RS 15n
.rt  
Indicates on which interface the driver was opened. Valid settings are:
.sp
.ne 2
.mk
.na
\fBOTYP_BLK\fR
.ad
.RS 12n
.rt  
Open device block interface.
.RE

.sp
.ne 2
.mk
.na
\fBOTYP_CHR\fR
.ad
.RS 12n
.rt  
Open device character interface.
.RE

.RE

.sp
.ne 2
.mk
.na
\fB\fIdevp\fR \fR
.ad
.RS 15n
.rt  
Pointer to a device number.
.RE

.sp
.ne 2
.mk
.na
\fB\fIdevid\fR \fR
.ad
.RS 15n
.rt  
Device ID.
.RE

.sp
.ne 2
.mk
.na
\fB\fIminor_name\fR \fR
.ad
.RS 15n
.rt  
Minor device node name.
.RE

.SH DESCRIPTION
.sp
.LP
The \fBldi_get_dev()\fR function retrieves the \fBdev_t\fR associated with a
layered handle.
.sp
.LP
The \fBldi_get_otyp()\fR retrieves the open flag that was used to open the
device associated with the layered handle.
.sp
.LP
The \fBldi_get_devid()\fR function retrieves a \fIdevid\fR for the device
associated with the layered handle. The caller  should use
\fBddi_devid_free()\fR to free the devid when done with it.
.sp
.LP
The \fBldi_get_minor_name()\fR function retrieves the name of the minor node
opened for the device associated with the layered handle.
\fBldi_get_minor_name()\fR allocates a buffer containing the minor node name
and returns it via the \fIminor_name\fR parameter. The caller should use
\fBkmem_free()\fR to release the buffer when done with it.
.SH RETURN VALUES
.sp
.LP
The \fBldi_get_dev()\fR, \fBldi_get_otyp()\fR, \fBldi_get_devid()\fR, and
\fBldi_get_devid()\fR functions return \fB0\fR upon success.
.sp
.LP
In case of an error, the following values may be returned:
.sp
.ne 2
.mk
.na
\fBEINVAL\fR
.ad
.RS 11n
.rt  
Invalid input parameters.
.RE

.sp
.ne 2
.mk
.na
\fBENOTSUP\fR
.ad
.RS 11n
.rt  
The operation is not supported for this device.
.RE

.SH CONTEXT
.sp
.LP
These functions may be called from user or kernel context.