Sun Microsystems, Inc.
spacerspacer
spacer   www.sun.com docs.sun.com | | |  
spacer
black dot
   
A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z
    
 
Kernel Functions for Driversddi_create_minor_node(9F)


NAME

 ddi_create_minor_node - create a minor node for this device

SYNOPSIS

 
#include <sys/stat.h> 
#include <sys/sunddi.h> 
int ddi_create_minor_node(dev_info_t *dip, char *name, int spec_type, minor_t minor_num, char *node_type, int flag);

INTERFACE LEVEL

 

Solaris DDI specific (Solaris DDI).

PARAMETERS

 
dip
A pointer to the device's dev_info structure.
name
The name of this particular minor device.
spec_type
S_IFCHR or S_IFBLK for character or block minor devices respectively.
minor_num
The minor number for this particular minor device.
node_type
Any string that uniquely identifies the type of node. The following predefined node types are provided with this release:
DDI_NT_SERIAL
For serial ports
DDI_NT_SERIAL_MB
For on board serial ports
DDI_NT_SERIAL_DO
For dial out ports
DDI_NT_SERIAL_MB_DO
For on board dial out ports
DDI_NT_BLOCK
For hard disks
DDI_NT_BLOCK_CHAN
For hard disks with channel or target numbers
DDI_NT_CD
For CDROM drives
DDI_NT_CD_CHAN
For CDROM drives with channel or target numbers
DDI_NT_FD
For floppy disks
DDI_NT_TAPE
For tape drives
DDI_NT_NET
For DLPI style 1 or style 2 network devices
DDI_NT_DISPLAY
For display devices
DDI_PSEUDO
For pseudo devices
flag
If the device is a clone device then this flag is set to CLONE_DEV else it is set to 0. The device node class can also be specified using this flag. The device classes do not have an effect in the creation of the device node in a non-clustered environment; but for device drivers intended for use in a clustered environment, one of the following needs to be specified. If the device class is not indicated the default class for pseudo devices will be NODESPECIFIC_DEV and for physical devices will be ENUMERATED_DEV.
GLOBAL_DEV
The device is a node invariant device and can be opened from any node in the cluster.
NODEBOUND_DEV
The device is node invariant but it has cluster wide state associated with it so that all subsequent opens must be directed there.
NODESPECIFIC_DEV
The device node provides node specific information and must be opened co-located with the process.
ENUMERATED_DEV
Unique cluster wide device nodes. The i/o must take place at the host where the device node was created.

DESCRIPTION

 

ddi_create_minor_node() provides the necessary information to enable the system to create the /dev and /devices hierarchies. The name is used to create the minor name of the block or character special file under the /devices hierarchy. At-sign (@), slash (/), and space are not allowed. The spec_type specifies whether this is a block or character device. The minor_num is the minor number for the device. The node_type is used to create the names in the /dev hierarchy that refers to the names in the /devices hierarchy. See disks(1M), ports(1M), tapes(1M), devlinks(1M). Finally flag determines if this is a clone device or not, and what device class the node belongs to.

RETURN VALUES

 

ddi_create_minor_node() returns:

DDI_SUCCESS
Was able to allocate memory, create the minor data structure, and place it into the linked list of minor devices for this driver.
DDI_FAILURE
Minor node creation failed.

EXAMPLES

 Example 1. Create Data Structure Describing Minor Device with Minor Number of 0
 

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);

SEE ALSO

 

add_drv(1M), devlinks(1M), disks(1M), drvconfig(1M), ports(1M), tapes(1M), attach(9E), ddi_remove_minor_node(9F)

Writing Device Drivers

NOTES

 

If the driver is for a network device (node_type DDI_NT_NET), note that the driver name will undergo the driver name constraints identified in the NOTES section of dlpi(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.


SunOS 5.9Go To TopLast Changed 7 Jun 2001

 
      
      
Copyright 2002 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.