kernels/linux-2.4.0/drivers/net/wan/sdlamain.c
/*============================================================================
 * Driver I/O control. 
 * o verify arguments
 * o perform requested action
 *
 * This function is called when router handles one of the reserved user
 * IOCTLs.  Note that 'arg' stil points to user address space.
 */
Driver I/O control.
o verify arguments
o perform requested action

This function is called when router handles one of the reserved user
IOCTLs.  Note that 'arg' stil points to user address space.
Driver I / O control . o verify arguments o perform requested action This function is called when router handles one of the reserved user IOCTLs . Note that ' arg ' stil points to user address space .
static int ioctl (wan_device_t* wandev, unsigned cmd, unsigned long arg)
{
	sdla_t* card;
	int err;
	if ((wandev == NULL) || (wandev->private == NULL))
		return -EFAULT;
	if (wandev->state == WAN_UNCONFIGURED)
		return -ENODEV;
	card = wandev->private;
	if(card->hw.type != SDLA_S514){
		disable_irq(card->hw.irq);
	}
	if (test_and_set_bit(0, (void*)&wandev->critical)) {
		if(card->hw.type != SDLA_S514){
			enable_irq(card->hw.irq);
		}
		return -EAGAIN;
	}
	switch (cmd) {
	case WANPIPE_DUMP:
		err = ioctl_dump(wandev->private, (void*)arg);
		break;
	case WANPIPE_EXEC:
		err = ioctl_exec(wandev->private, (void*)arg);
		break;
	default:
		err = -EINVAL;
	}
	clear_bit(0, (void*)&wandev->critical);
        if(card->hw.type != SDLA_S514){
		enable_irq(card->hw.irq);
	}
	return err;
}
static int ioctl ( wan_device_t * wandev , unsigned cmd , unsigned long arg ) { sdla_t * card ; int err ; if ( ( wandev == NULL ) || ( wandev -> private == NULL ) ) return - EFAULT ; if ( wandev -> state == WAN_UNCONFIGURED ) return - ENODEV ; card = wandev -> private ; if ( card -> hw . type != SDLA_S514 ) { disable_irq ( card -> hw . irq ) ; } if ( test_and_set_bit ( 0 , ( void * ) & wandev -> critical ) ) { if ( card -> hw . type != SDLA_S514 ) { enable_irq ( card -> hw . irq ) ; } return - EAGAIN ; } switch ( cmd ) { case WANPIPE_DUMP : err = ioctl_dump ( wandev -> private , ( void * ) arg ) ; break ; case WANPIPE_EXEC : err = ioctl_exec ( wandev -> private , ( void * ) arg ) ; break ; default : err = - EINVAL ; } clear_bit ( 0 , ( void * ) & wandev -> critical ) ; if ( card -> hw . type != SDLA_S514 ) { enable_irq ( card -> hw . irq ) ; } return err ; }
Driver I/O control.
Driver I / O control .
/* sanity checks */