Provides a means for performing device-specific validity checking for parameters included in request queue elements.
#include <sys/types.h> #include <sys/errno.h> #include <sys/deviceq.h>
int check (type, ptr, length) int type; struct req_qe *ptr; int length;
Each device queue can have a check routine. This routine is optional and must be specified when the device queue is created with the creatq service. The enque service calls the check routine before a request queue element is put on the device queue. The kernel uses the routine's return value to determine whether to put the queue element on the device queue or to stop the request.
The kernel does not call the check routine when an acknowledgment or control queue element is sent. Therefore, the check routine is only called while executing within a process.
The address of the actual queue element is passed to this routine. In the check routine, take care to alter only the fields that were meant to be altered. This routine does not need to be serialized with the rest of the server's routines, because it is only checking the parameters in the queue element.
The check routine can check the request before the request queue element is placed on the device queue. The advantage of using this routine is that you can filter out unacceptable commands before they are put on the device queue.
The routine looks at the queue element and returns RC_GOOD if the request is acceptable. If the return code is not RC_GOOD, the kernel does not place the queue element in a device queue.
The check routine executes under the process environment of the requester. Therefore, access to data areas must be handled as if the routine were in an interrupt handler environment. There is, however, no requirement to pin the code and data as in a normal interrupt handler environment.
RC_GOOD | Indicates successful completion. |
All other return values are device-specific.
The check routine is part of the Device Queue Management Kernel extension.
The enque kernel service.