#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);
Solaris DDI specific (Solaris DDI).
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.
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 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. 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 ENUMERATE_DEV.
The device is a node invariant device and can be opened from any node in the cluster.
The device is node invariant but it has cluster wide state associated with it so that all subsequent opens must be directed there.
The device node provides node specific information and must be opened co-located with the process.
Unique cluster wide device nodes. The i/o must take place at the host where the device node was created.
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.
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);