13df2l2.txt ;************************************************************************************************** ; LISTING 2 - DISPATCH ROUTINE ; ; "Get those boards talking under Linux," EDN, June 22, 2000, pg 153 ; ; http://www.ednmag.com/ednmag/reg/2000/06222000/13df2.htm ;**************************************************************************************************** //============ ioctl dispatch routine =================== static int pd_ioctl( struct inode *inode, struct file *file, unsigned int command, unsigned long argument ) { int real_minor, board, board_minor, iRes; // calculate board# and subsystem real_minor = MINOR(file->f_dentry->d_inode->i_rdev); board = real_minor / PD_MINOR_RANGE; board_minor = real_minor % PD_MINOR_RANGE; // check if this process owns the subsystem if (!pd_CheckOwnerPID(board, board_minor, current->pid)) return -EBUSY; // dispatch the ioctl() call to board-dependent routine iRes = pd_dispatch_ioctl(board, // adapter number board_minor, // adapter subsystem command, // command argument, // input/output buffer ptr argument // output buffer ptr ); // convert board-dependent error code into OS-dependent code return pd_ConvertErrorCode(iRes); }