Specifications
Sample Driver Written in C
B.1 LRDRIVER Example
/* Mark the device as "on line" and ready to accept I/O requests */
ucb->ucb$r_ucb.ucb$v_online = 1;
return SS$_NORMAL;
}
/*
* LR$SETMODE - FDT Routine for Set Mode and Set Characteristics
*
* Functional description:
*
* This routine is called by the FDT dispatcher in the $QIO system service
* to process set mode and set characteristics functions. This FDT routine
* completes the I/O request without sending it to the driver start I/O
* routine. The modification of the UCB by this routine is synchronized
* with respect to other processes through the use of a mutex.
*
* Since this is an upper-level FDT routine, this routine always returns
* the SS$_FDT_COMPL status. The $QIO status that is to be returned to
* the caller of the $QIO system service is returned indirectly by the
* FDT completion routines (e. g. exe_std$abortio, exe_std$finishio) via
* the FDT context structure.
*
* Calling convention:
*
* status = lr$setmode (irp, pcb, ucb, ccb)
*
* Input parameters:
*
* irp Pointer to I/O request packet
* pcb Pointer process control block
* ucb Pointer to unit control block
* ccb Pointer to channel control block
*
* Output parameters:
*
* None.
*
* Return value:
*
* status SS$_FDT_COMPL
*
* Environment:
*
* Kernel mode, user process context, IPL 2.
*/
int lr$setmode (IRP *irp, PCB *pcb, LR_UCB *ucb, CCB *ccb) {
/* Define a structure that corresponds to the layout of the caller’s
* set mode or set characteristics buffer and declare a local pointer
* to a structure of this type.
*/
typedef struct {
unsigned char devclass;
unsigned char devtype;
unsigned short devbufsiz;
unsigned int devdepend;
} SETMODE_BUF;
SETMODE_BUF *setmode_bufp;
B–11