1ddi_create_minor_node(9F)Kernel Functions for Driversddi_create_minor_node(9F)
2
3
4

NAME

6       ddi_create_minor_node - Create a minor node for this device
7

SYNOPSIS

9       #include <sys/stat.h>
10       #include <sys/sunddi.h>
11
12
13
14       int ddi_create_minor_node(dev_info_t *dip, char *name, int spec_type,
15            minor_t minor_num, char *node_type, int flag);
16
17

INTERFACE LEVEL

19       Solaris DDI specific (Solaris DDI).
20

PARAMETERS

22       dip           A pointer to the device's dev_info structure.
23
24
25       name          The name of this particular minor device.
26
27
28       spec_type     S_IFCHR  or  S_IFBLK for character or block minor devices
29                     respectively.
30
31
32       minor_num     The minor number for this particular minor device.
33
34
35       node_type     Any string literal that uniquely identifies the  type  of
36                     node.  The  following  predefined node types are provided
37                     with this release:
38
39                     DDI_NT_SERIAL           For serial ports
40
41
42                     DDI_NT_SERIAL_MB        For on board serial ports
43
44
45                     DDI_NT_SERIAL_DO        For dial out ports
46
47
48                     DDI_NT_SERIAL_MB_DO     For on board dial out ports
49
50
51                     DDI_NT_BLOCK            For hard disks
52
53
54                     DDI_NT_BLOCK_CHAN       For hard disks  with  channel  or
55                                             target numbers
56
57
58                     DDI_NT_CD               For CDROM drives
59
60
61                     DDI_NT_CD_CHAN          For  CDROM drives with channel or
62                                             target numbers
63
64
65                     DDI_NT_FD               For floppy disks
66
67
68                     DDI_NT_TAPE             For tape drives
69
70
71                     DDI_NT_NET              For DLPI style 1 or style 2  net‐
72                                             work devices
73
74
75                     DDI_NT_DISPLAY          For display devices
76
77
78                     DDI_PSEUDO              For pseudo devices
79
80
81
82       flag          If  the device is a clone device then this flag is set to
83                     CLONE_DEV else it is set to 0.
84
85

DESCRIPTION

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

RETURN VALUES

99       ddi_create_minor_node() returns:
100
101       DDI_SUCCESS     Was  able  to  allocate  memory,  create the minor data
102                       structure, and place it into the linked list  of  minor
103                       devices for this driver.
104
105
106       DDI_FAILURE     Minor node creation failed.
107
108

CONTEXT

110       The  ddi_create_minor_node()  function can be called from user context.
111       It is typically called from attach(9E) or ioctl(9E).
112

EXAMPLES

114       Example 1 Create Data Structure Describing Minor Device with Minor Num‐
115       ber of 0
116
117
118       The  following  example  creates  a  data  structure describing a minor
119       device called foo which has  a  minor  number  of  0.  It  is  of  type
120       DDI_NT_BLOCK (a block device) and it is not a clone device.
121
122
123         ddi_create_minor_node(dip, "foo", S_IFBLK, 0, DDI_NT_BLOCK, 0);
124
125

SEE ALSO

127       add_drv(1M),   devlinks(1M),   disks(1M),   drvconfig(1M),   ports(1M),
128       tapes(1M), attach(9E), ddi_remove_minor_node(9F)
129
130
131       Writing Device Drivers
132

NOTES

134       If the driver is for a network device (node_type DDI_NT_NET), note that
135       the  driver name will undergo the driver name constraints identified in
136       the NOTES section of dlpi(7P). Additionally, the minor name must  match
137       the  driver  name  for a DLPI style 2 provider. If the driver is a DLPI
138       style 1 provider, the minor name must also match the driver  name  with
139       the exception that the ppa is appended to the minor name.
140
141
142       Non-gld(7D)-based DLPI network streams drivers are encouraged to switch
143       to gld(7D). Failing this, a driver that creates  DLPI  style-2    minor
144       nodes  must  specify  CLONE_DEV for its style-2 ddi_create_minor_node()
145       nodes and use qassociate(9F). A driver that supports both  style-1  and
146       style-2     minor     nodes     should     return    DDI_FAILURE    for
147       DDI_INFO_DEVT2INSTANCE and DDI_INFO_DEVT2DEVINFO getinfo(9E)  calls  to
148       style-2 minor nodes. (The correct association is already established by
149       qassociate(9F)). A driver that only supports style-2  minor  nodes  can
150       use  ddi_no_info(9F)  for  its  getinfo(9E) implementation. For drivers
151       that do not follow these rules, the results of a modunload(1M)  of  the
152       driver  or a cfgadm(1M) remove of hardware controlled by the driver are
153       undefined.
154

WARNING

156       Drivers must remove references to GLOBAL_DEV,  NODEBOUND_DEV,  NODESPE‐
157       CIFIC_DEV,  and  ENUMERATED_DEV  to  compile under Solaris 10 and later
158       versions.
159
160
161
162SunOS 5.11                        14 Dec 2004        ddi_create_minor_node(9F)
Impressum