copyreq(D4DK) —
NAME
copyreq − STREAMS transparent ioctl copy request structure
SYNOPSIS
#include <sys/stream.h>
DESCRIPTION
The copyreq structure contains the information necessary to process transparent ioctls. It is used in M_COPYIN and M_COPYOUT messages. The module or driver usually converts an M_IOCTL or M_IOCDATA message into an M_COPYIN or M_COPYOUT message. The copyreq structure is thus overlaid on top of the iocblk(D4DK) or copyresp(D4DK) structure. The stream head guarantees that the message is large enough to contain the different structures.
STRUCTURE MEMBERS
| int | cq_cmd; | /∗ ioctl command ∗/ |
| cred_t | ∗cq_cr; | /∗ user credentials ∗/ |
| uint_t | cq_id; | /∗ ioctl ID ∗/ |
| caddr_t | cq_addr; | /∗ copy buffer address ∗/ |
| uint_t | cq_size; | /∗ number of bytes to copy ∗/ |
| int | cq_flag; | /∗ for future use ∗/ |
| mblk_t | ∗cq_private; | /∗ module private data ∗/ |
The cq_cmd field is the ioctl command, copied from the ioc_cmd field of the iocblk structure. If the same message is used, then the cq_cmd field directly overlays the ioc_cmd field (that is, it need not be copied.)
The cq_cr field contains a pointer to the user credentials. It is copied from the ioc_cr field of the iocblk structure. If the same message is used, then the cq_cr field directly overlays the ioc_cr field (that is, it need not be copied.)
The cq_id field is the ioctl ID, copied from the ioc_id field of the iocblk structure. It is used to uniquely identify the ioctl request in the stream. If the same message is used, then the cq_id field directly overlays the ioc_id field (that is, it need not be copied.)
For an M_COPYIN message, the cq_addr field contains the user address from which the data are to be copied. For an M_COPYOUT message, the cq_addr field contains the user address to which the data are to be copied. In both cases, the cq_size field contains the number of bytes to copy.
The cq_flag field is reserved for future use and should be set to 0 by the module or driver.
The cq_private field is a field set aside for use by the driver. It can be used to hold whatever state information is necessary to process the ioctl. It is copied to the cp_private field in the resultant M_IOCDATA message.
NOTES
When the M_COPYIN or M_COPYOUT message is freed, any message that cq_private refers to is not freed by the STREAMS subsystem. It is the responsibility of the module or driver to free it.
SEE ALSO
copyresp(D4DK), datab(D4DK), iocblk(D4DK), msgb(D4DK), messages(D5DK).
DDI/DKI — STREAMS