check Device Queue Management Routine

Purpose

Provides a means for performing device-specific validity checking for parameters included in request queue elements.

Syntax

#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;

Parameters

Item Description
type Specifies the type of call. The following values are used when the kernel calls the check routine:
CHECK_PARMS + SEND_CMD
Send command queue element.
CHECK_PARMS + START_IO
Start I/O CCB queue element.
CHECK_PARMS + GEN_PURPOSE
General purpose queue element.
ptr Specifies the address of the queue element.
length Specifies the length of the queue element.

Description

The check routine is part of the Device Queue Management Kernel extension. 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.

Execution Environment

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.

Return Values

Item Description
RC_GOOD Indicates successful completion.

All other return values are device-specific.