'\" 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 "Jun 3, 2003"
.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
.na
\fB\fIlh\fR \fR
.ad
.RS 15n
Layered handle
.RE

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

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

.RE

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

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

.sp
.ne 2
.na
\fB\fIminor_name\fR \fR
.ad
.RS 15n
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
.na
\fBEINVAL\fR
.ad
.RS 11n
Invalid input parameters.
.RE

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

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