Kernel Functions for Drivers ddicreateminornode(9F)
NAME
ddicreateminornode - Create a minor node for this device
SYNOPSIS
#include
#include
int ddicreateminornode(devinfot *dip, char *name, int spectype,
minort minornum, char *nodetype, int flag);
INTERFACE LEVEL
Solaris DI specific (Solaris DI).
PARAMETERS
dip A pointer to the device's devinfo structure.
name The name of this particular minor device.
spectype SIFCHR or SIFBLK for character or block
minor devices respectively.
minornum The minor number for this particular minor
device.
nodetype Any string literal that uniquely identifies
the type of node. The following predefined
node types are provided with this release:
DINTSERIAL For serial ports
DINTSERIALMB For on board serial
ports
DINTSERIALDO For dial out ports
DINTSERIALMBDO For on board dial out
ports
DINTBLOCK For hard disks
SunOS 5.11 Last change: 14 Dec 2004 1
Kernel Functions for Drivers ddicreateminornode(9F)
DINTBLOCKCHAN For hard disks with
channel or target
numbers
DINTCD For CDROM drives
DINTCDCHAN For CDROM drives with
channel or target
numbers
DINTFD For floppy disks
DINTAPE For tape drives
DINTNET For DLPI style 1 or
style 2 network dev-
ices
DINTDISPLAY For display devices
DIPSEUDO For pseudo devices
flag If the device is a clone device then this flag
is set to CLONEDEV else it is set to 0.
DESCRIPTION
ddicreateminornode() provides the necessary information
to enable the system to create the /dev and /devices hierar-
chies. The name is used to create the minor name of the
block or character special file under the /devices hierar-
chy. At-sign (@), slash (/), and space are not allowed. The
spectype specifies whether this is a block or character
device. The minornum is the minor number for the device.
The nodetype is used to create the names in the /dev
hierarchy that refers to the names in the /devices hierar-
chy. 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
ddicreateminornode() returns:
SunOS 5.11 Last change: 14 Dec 2004 2
Kernel Functions for Drivers ddicreateminornode(9F)
DISUCES Was able to allocate memory, create the
minor data structure, and place it into the
linked list of minor devices for this
driver.
DIFAILURE Minor node creation failed.
CONTEXT
The ddicreateminornode() function can be called from user
context. It is typically called from attach(9E) or
ioctl(9E).
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 DINTBLOCK (a block device) and it is not a clone
device.
ddicreateminornode(dip, "foo", SIFBLK, 0, DINTBLOCK, 0);
SEE ALSO
adddrv(1M), devlinks(1M), disks(1M), drvconfig(1M),
ports(1M), tapes(1M), attach(9E), ddiremoveminornode(9F)
Writing Device Drivers
NOTES
If the driver is for a network device (nodetype
DINTNET), 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.
Non-gld(7D)-based DLPI network streams drivers are
encouraged to switch to gld(7D). Failing this, a driver that
creates DLPI style-2 minor nodes must specify CLONEDEV
for its style-2 ddicreateminornode() nodes and use
qassociate(9F). A driver that supports both style-1 and
style-2 minor nodes should return DIFAILURE for
SunOS 5.11 Last change: 14 Dec 2004 3
Kernel Functions for Drivers ddicreateminornode(9F)
DINFODEVT2INSTANCE and DINFODEVT2DEVINFO 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 ddinoinfo(9F) for its
getinfo(9E) implementation. For drivers that do not follow
these rules, the results of a modunload(1M) of the driver or
a cfgadm(1M) remove of hardware controlled by the driver are
undefined.
WARNING
Drivers must remove references to GLOBALDEV, NODEBOUNDEV,
NODESPECIFICDEV, and ENUMERATEDEV to compile under
Solaris 10 and later versions.
SunOS 5.11 Last change: 14 Dec 2004 4
|