'\" te .\" Copyright (c) 2004, 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 DDI_CREATE_MINOR_NODE 9F "Dec 14, 2004" .SH NAME ddi_create_minor_node \- Create a minor node for this device .SH SYNOPSIS .LP .nf #include #include \fBint\fR \fBddi_create_minor_node\fR(\fBdev_info_t *\fR\fIdip\fR, \fBchar *\fR\fIname\fR, \fBint\fR \fIspec_type\fR, \fBminor_t\fR \fIminor_num\fR, \fBchar *\fR\fInode_type\fR, \fBint\fR \fIflag\fR); .fi .SH INTERFACE LEVEL .sp .LP Solaris DDI specific (Solaris DDI). .SH PARAMETERS .sp .ne 2 .na \fB\fIdip\fR \fR .ad .RS 14n A pointer to the device's \fBdev_info\fR structure. .RE .sp .ne 2 .na \fB\fIname\fR \fR .ad .RS 14n The name of this particular minor device. .RE .sp .ne 2 .na \fB\fIspec_type\fR \fR .ad .RS 14n \fBS_IFCHR\fR or \fBS_IFBLK\fR for character or block minor devices respectively. .RE .sp .ne 2 .na \fB\fIminor_num\fR \fR .ad .RS 14n The minor number for this particular minor device. .RE .sp .ne 2 .na \fB\fInode_type\fR \fR .ad .RS 14n Any string literal that uniquely identifies the type of node. The following predefined node types are provided with this release: .sp .ne 2 .na \fB\fBDDI_NT_SERIAL\fR \fR .ad .RS 24n For serial ports .RE .sp .ne 2 .na \fB\fBDDI_NT_SERIAL_MB\fR \fR .ad .RS 24n For on board serial ports .RE .sp .ne 2 .na \fB\fBDDI_NT_SERIAL_DO\fR \fR .ad .RS 24n For dial out ports .RE .sp .ne 2 .na \fB\fBDDI_NT_SERIAL_MB_DO\fR \fR .ad .RS 24n For on board dial out ports .RE .sp .ne 2 .na \fB\fBDDI_NT_BLOCK\fR \fR .ad .RS 24n For hard disks .RE .sp .ne 2 .na \fB\fBDDI_NT_BLOCK_CHAN\fR \fR .ad .RS 24n For hard disks with channel or target numbers .RE .sp .ne 2 .na \fB\fBDDI_NT_CD\fR \fR .ad .RS 24n For CDROM drives .RE .sp .ne 2 .na \fB\fBDDI_NT_CD_CHAN\fR \fR .ad .RS 24n For CDROM drives with channel or target numbers .RE .sp .ne 2 .na \fB\fBDDI_NT_FD\fR \fR .ad .RS 24n For floppy disks .RE .sp .ne 2 .na \fB\fBDDI_NT_TAPE\fR \fR .ad .RS 24n For tape drives .RE .sp .ne 2 .na \fB\fBDDI_NT_NET\fR \fR .ad .RS 24n For DLPI style 1 or style 2 network devices .RE .sp .ne 2 .na \fB\fBDDI_NT_DISPLAY\fR \fR .ad .RS 24n For display devices .RE .sp .ne 2 .na \fB\fBDDI_PSEUDO\fR \fR .ad .RS 24n For pseudo devices .RE .RE .sp .ne 2 .na \fB\fIflag\fR \fR .ad .RS 14n If the device is a clone device then this flag is set to \fBCLONE_DEV\fR else it is set to \fB0\fR. .RE .SH DESCRIPTION .sp .LP \fBddi_create_minor_node()\fR provides the necessary information to enable the system to create the \fB/dev\fR and \fB/devices\fR hierarchies. The \fIname\fR is used to create the minor name of the block or character special file under the \fB/devices\fR hierarchy. At-sign (\fB@\fR), slash (\fB/\fR), and space are not allowed. The \fIspec_type\fR specifies whether this is a block or character device. The \fIminor_num\fR is the minor number for the device. The \fInode_type\fR is used to create the names in the \fB/dev\fR hierarchy that refers to the names in the \fB/devices\fR hierarchy. See \fBdisks\fR(1M), \fBports\fR(1M), \fBtapes\fR(1M), \fBdevlinks\fR(1M). Finally \fIflag\fR determines if this is a clone device or not, and what device class the node belongs to. .SH RETURN VALUES .sp .LP \fBddi_create_minor_node()\fR returns: .sp .ne 2 .na \fB\fBDDI_SUCCESS\fR \fR .ad .RS 16n Was able to allocate memory, create the minor data structure, and place it into the linked list of minor devices for this driver. .RE .sp .ne 2 .na \fB\fBDDI_FAILURE\fR \fR .ad .RS 16n Minor node creation failed. .RE .SH CONTEXT .sp .LP The \fBddi_create_minor_node()\fR function can be called from user context. It is typically called from \fBattach\fR(9E) or \fBioctl\fR(9E). .SH EXAMPLES .LP \fBExample 1 \fRCreate Data Structure Describing Minor Device with Minor Number of 0 .sp .LP The following example creates a data structure describing a minor device called \fIfoo\fR which has a minor number of 0. It is of type \fBDDI_NT_BLOCK\fR (a block device) and it is not a clone device. .sp .in +2 .nf ddi_create_minor_node(dip, "foo", S_IFBLK, 0, DDI_NT_BLOCK, 0); .fi .in -2 .SH SEE ALSO .sp .LP \fBadd_drv\fR(1M), \fBdevlinks\fR(1M), \fBdisks\fR(1M), \fBdrvconfig\fR(1M), \fBports\fR(1M), \fBtapes\fR(1M), \fBattach\fR(9E), \fBddi_remove_minor_node\fR(9F) .sp .LP \fIWriting Device Drivers\fR .SH NOTES .sp .LP If the driver is for a network device (\fInode_type\fR \fBDDI_NT_NET\fR), note that the driver name will undergo the driver name constraints identified in the NOTES section of \fBdlpi\fR(7P). Additionally, the minor name must match the driver name for a DLPI style 2 provider. If the driver is a DLPI style 1 provider, the minor name must also match the driver name with the exception that the ppa is appended to the minor name. .sp .LP Non-\fBgld\fR(7D)-based DLPI network streams drivers are encouraged to switch to \fBgld\fR(7D). Failing this, a driver that creates DLPI style-2 minor nodes must specify CLONE_DEV for its style-2 \fBddi_create_minor_node()\fR nodes and use \fBqassociate\fR(9F). A driver that supports both style-1 and style-2 minor nodes should return DDI_FAILURE for DDI_INFO_DEVT2INSTANCE and DDI_INFO_DEVT2DEVINFO \fBgetinfo\fR(9E) calls to style-2 minor nodes. (The correct association is already established by \fBqassociate\fR(9F)). A driver that only supports style-2 minor nodes can use \fBddi_no_info\fR(9F) for its \fBgetinfo\fR(9E) implementation. For drivers that do not follow these rules, the results of a \fBmodunload\fR(1M) of the driver or a \fBcfgadm\fR(1M) remove of hardware controlled by the driver are undefined. .SH WARNING .sp .LP Drivers must remove references to GLOBAL_DEV, NODEBOUND_DEV, NODESPECIFIC_DEV, and ENUMERATED_DEV to compile under Solaris 10 and later versions.