13df2l5.txt ;************************************************************************************************** ; LISTING 5 - IOCTL () ROUTINE ; ; "Get those boards talking under Linux," EDN, June 22, 2000, pg 153 ; ; http://www.ednmag.com/ednmag/reg/2000/06222000/13df2.htm ;**************************************************************************************************** static int pd_ioctl( . . . ) { int real_minor, board, board_minor; // Find out which board/subsystem ioctl is going to access real_minor = MINOR(file->f_dentry->d_inode->i_rdev); board = real_minor / PD_MINOR_RANGE; board_minor = real_minor % PD_MINOR_RANGE; // check board subsystem ownership, does it belong to calling process? if (!pd_CheckOwnerPID(board, board_minor, current->pid)) return -EBUSY; // call registered dispatch routine iRes = pIoctlProc[board](board, board_minor, ... ); ... }