STREAMS-UX Programmer's Guide (February 2007)
Modules and Drivers
Data Structures
Chapter 4
67
c_major Assign the major number or set it to -1 for dynamic assignment. If the major number is
manually assigned, it is the responsibility of the driver developer to assign a unique
number.
cdio Set this field to NULL.
gio_private Set this field to NULL.
cdio_private Set this field to NULL.
The drv_ops_t Structure
This structure is applicable only for STREAMS drivers. This must be allocated statically.
The drv_ops_t has the following fields.
d_open_t d_open;
d_close_t d_close;
d_strategy_t d_strategy;
d_dump_t d_dump;
d_psize_t d_psize;
int (*reserved0) __(());
d_read_t d_read;
d_write_t d_write;
d_ioctl_t d_ioctl;
d_select_t d_select;
d_option1_t d_option1;
pfilter_t *pfilter;
int (*reserved1) __(());
int (*reserved2) __(());
aio_ops_t *d_aio_ops;
int d_flags;
The d_flags field is the only valid field for STREAMS drivers. STREAMS drivers can use the d_flags field.
All the other fields in drv_ops_t are ignored set to NULL.
The d_flags Field
C_ALLCLOSES If this flag is set, it is the responsibility of driver to keep track of the information about the
number of opens and closes for this device.
If this flag is set, STREAMS sends the M_CLOSE message downstream and waits for a reply
from the driver. The stream is dismantled if the reply (M_CLOSE_REPLY) for the M_CLOSE
message has MSGLASTCLOSE set in the b_flag.
C_CLONESMAJOR When this flag is set it indicates that driver supports cloning method where drivers will be
able to encode information in their minor numbers. The driver open() routine checks for the
clone minor number. The driver routine allocates a minor number and returns a new device
number to the caller. See the “Cloning” on page 60 section for more details.