STREAMS-UX Programmer's Guide (February 2007)
Modules and Drivers
STREAMS Driver
Chapter 4
103
switch (mp->b_datap->db_type) {
case M_DATA:
case M_PROTO:
/* process the message */
...
...
case M_IOCTL:
struct iocblk * iocp = (struct iocblk *)mp->b_rptr;
switch (iocp->ioc_cmd) {
/* ioctl commands recognized by the driver */
case D_IOCTL1:
/*
* process and reply back with a positive
* or negative acknowledgment
*/
...
if (success) {
...
mp->b_datap->db_type = M_IOCACK;
} else {
...
mp->b_datap->db_type = M_IOCNAK;
}
qreply(q, mp);
return;
case D_IOCTL2:
...
...
/* ioctl commands not recognized by the driver */
default:
/* Send a negative acknowledgement upstream */
mp->b_datap->db_type = M_IOCNAK;
qreply(q, mp);
return;
}
case M_FLUSH:
if (*mp->b_rptr & FLUSHW) {
/* Flush the write queue */
...