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]
#include <sys/stat.h> #include <sys/sunddi.h> int ddi_create_minor_node(dev_info_t *dip, const char *name, int spec_type, minor_t minor_num, const char *node_type, int flag);
A pointer to the device's dev_info structure.
The name of this particular minor device.
S_IFCHR or S_IFBLK for character or block minor devices respectively.
The minor number for this particular minor device.
Any string literal that uniquely identifies the type of node. The following predefined node types are provided with this release: DDI_NT_SERIAL
For serial ports
For on board serial ports
For dial out ports
For on board dial out ports
For hard disks
For hard disks with channel or target numbers
For CDROM drives
For CDROM drives with channel or target numbers
For floppy disks
For tape drives
For DLPI style 1 or style 2 network devices
For display devices
For pseudo devices
If the device is a clone device then this flag is set to CLONE_DEV else it is set to 0.
Was able to allocate memory, create the minor data structure, and place it into the linked list of minor devices for this driver.
Minor node creation failed.
The following example creates a data structure describing a minor device called foo which has a minor number of 0. It is of type DDI_NT_BLOCK (a block device) and it is not a clone device.
ddi_create_minor_node(dip, "foo", S_IFBLK, 0, DDI_NT_BLOCK, 0);
Writing Device Drivers
Non-gld(4D)-based DLPI network streams drivers are encouraged to switch to gld(4D). Failing this, a driver that creates DLPI style-2 minor nodes must specify CLONE_DEV for its style-2 ddi_create_minor_node() nodes and use qassociate(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 getinfo(9E) calls to style-2 minor nodes. (The correct association is already established by qassociate(9F)). A driver that only supports style-2 minor nodes can use ddi_no_info(9F) for its getinfo(9E) implementation. For drivers that do not follow these rules, the results of a modunload(8) of the driver or a cfgadm(8) remove of hardware controlled by the driver are undefined.