'\" te .\" Copyright (c) 2003, Sun Microsystems, Inc., All Rights Reserved .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 \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.