'\" te .\" Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. .TH ddi_create_minor_node 9F "7 Jul 2011" "SunOS 5.11" "Kernel Functions for Drivers" .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 .mk .na \fB\fIdip\fR\fR .ad .RS 13n .rt A pointer to the device's \fBdev_info\fR structure. .RE .sp .ne 2 .mk .na \fB\fIname\fR\fR .ad .RS 13n .rt The name of this particular minor device. .RE .sp .ne 2 .mk .na \fB\fIspec_type\fR\fR .ad .RS 13n .rt \fBS_IFCHR\fR or \fBS_IFBLK\fR for character or block minor devices respectively. .RE .sp .ne 2 .mk .na \fB\fIminor_num\fR\fR .ad .RS 13n .rt The minor number for this particular minor device. .RE .sp .ne 2 .mk .na \fB\fInode_type\fR\fR .ad .RS 13n .rt Any string literal that uniquely identifies the type of node. The following predefined node types are provided with this release: .sp .ne 2 .mk .na \fB\fBDDI_NT_SERIAL\fR\fR .ad .RS 23n .rt For serial ports .RE .sp .ne 2 .mk .na \fB\fBDDI_NT_SERIAL_MB\fR\fR .ad .RS 23n .rt For on board serial ports .RE .sp .ne 2 .mk .na \fB\fBDDI_NT_SERIAL_DO\fR\fR .ad .RS 23n .rt For dial out ports .RE .sp .ne 2 .mk .na \fB\fBDDI_NT_SERIAL_MB_DO\fR\fR .ad .RS 23n .rt For on board dial out ports .RE .sp .ne 2 .mk .na \fB\fBDDI_NT_BLOCK\fR\fR .ad .RS 23n .rt For hard disks .RE .sp .ne 2 .mk .na \fB\fBDDI_NT_BLOCK_CHAN\fR\fR .ad .RS 23n .rt For hard disks with channel or target numbers .RE .sp .ne 2 .mk .na \fB\fBDDI_NT_CD\fR\fR .ad .RS 23n .rt For CDROM drives .RE .sp .ne 2 .mk .na \fB\fBDDI_NT_CD_CHAN\fR\fR .ad .RS 23n .rt For CDROM drives with channel or target numbers .RE .sp .ne 2 .mk .na \fB\fBDDI_NT_TAPE\fR\fR .ad .RS 23n .rt For tape drives .RE .sp .ne 2 .mk .na \fB\fBDDI_NT_NET\fR\fR .ad .RS 23n .rt For DLPI style 1 or style 2 network devices .RE .sp .ne 2 .mk .na \fB\fBDDI_NT_DISPLAY\fR\fR .ad .RS 23n .rt For display devices .RE .sp .ne 2 .mk .na \fB\fBDDI_PSEUDO\fR\fR .ad .RS 23n .rt For pseudo devices .RE .RE .sp .ne 2 .mk .na \fB\fIflag\fR\fR .ad .RS 13n .rt 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 .mk .na \fB\fBDDI_SUCCESS\fR\fR .ad .RS 15n .rt 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 .mk .na \fB\fBDDI_FAILURE\fR\fR .ad .RS 15n .rt 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 for Oracle Solaris 11.2\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 \fBCLONE_DEV\fR 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 \fBDDI_FAILURE\fR for \fBDDI_INFO_DEVT2INSTANCE\fR and \fBDDI_INFO_DEVT2DEVINFO\fR \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 \fBGLOBAL_DEV\fR, \fBNODEBOUND_DEV\fR, \fBNODESPECIFIC_DEV\fR, and \fBENUMERATED_DEV\fR to compile under Solaris 10 and later versions.