Specifications
Sample Driver Written in C
B.1 LRDRIVER Example
/* If the request was cancelled or timed out of its own accord then
* set the status accordingly.
*/
if (ucb->ucb$r_ucb.ucb$v_cancel) {
status = SS$_ABORT;
} else if (ucb->ucb$r_ucb.ucb$v_timout) {
status = SS$_TIMEOUT;
}
/* Send this I/O request to I/O post processing */
ioc_std$reqcom (status, 0, &(ucb->ucb$r_ucb));
return;
}
/*
* LR$WFI_TIMEOUT - Wait-for-interrupt timeout routine
*
* Functional description:
*
* This routine is the wait-for-interrupt timeout routine. It is called
* by exe$timeout when an operation set up by wfikpch takes more that the
* specified number of seconds.
*
* This routine queues a fork routine, lr$check_ready_fork, to handle
* periodic checking of the readiness of the device to resume output and
* to issue periodic "device offline" messages via OPCOM.
*
* Calling convention:
*
* lr$wfi_timeout (irp, not_used, ucb)
*
* Input parameters:
*
* irp Pointer to I/O request packet
* not_used Unused fork routine parameter fr4
* ucb Pointer to unit control block
*
* Output parameters:
*
* None.
*
* Return value:
*
* None.
*
* Environment:
*
* Kernel mode, system context, device IPL, fork lock held, device lock held.
*
*/
void lr$wfi_timeout (IRP *irp, void *not_used, LR_UCB *ucb) {
/* A wait-for-interrupt has timed out. Count the device as having been
* offline for the duration of the wait-for-interrupt interval.
*/
ucb->ucb$l_lr_oflcnt = LR_WFI_TMO;
/* Queue a fork-wait thread that checks once a second for the device being
* ready to accept data. One reason for deferring this work to fork level
* is that exe_std$sndevmsg cannot be called at device IPL.
*/
fork_wait (lr$check_ready_fork, irp, 0, ucb);
return;
}
B–20










