kernels/linux-2.4.0/drivers/net/tlan.c
/**************************************************************
	 *	TLan_ioctl
	 *	
	 *	Returns:
	 *		0 on success, error code otherwise
	 *	Params:
	 *		dev	structure of device to receive ioctl.
	 *		
	 *		rq	ifreq structure to hold userspace data.
	 *
	 *		cmd	ioctl command.
	 *
	 *
	 *************************************************************/


0 on success, error code otherwise
Params:
dev     structure of device to receive ioctl.

rq      ifreq structure to hold userspace data.

cmd     ioctl command.
0 on success error code otherwise Params : dev structure of device to receive ioctl . rq ifreq structure to hold userspace data . cmd ioctl command .
static int TLan_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
	TLanPrivateInfo *priv = (TLanPrivateInfo *) dev->priv;
	u16 *data = (u16 *)&rq->ifr_data;
	u32 phy   = priv->phy[priv->phyNum];
	if (!priv->phyOnline)
		return -EAGAIN;
	switch(cmd) {
		case SIOCDEVPRIVATE:
			data[0] = phy;
		case SIOCDEVPRIVATE+1: 
			TLan_MiiReadReg(dev, data[0], data[1], &data[3]);
			return 0;
		case SIOCDEVPRIVATE+2: 
			if (!capable(CAP_NET_ADMIN))
				return -EPERM;
			TLan_MiiWriteReg(dev, data[0], data[1], data[2]);
			return 0;
		default:
			return -EOPNOTSUPP;
	}
}
static int TLan_ioctl ( struct net_device * dev , struct ifreq * rq , int cmd ) { TLanPrivateInfo * priv = ( TLanPrivateInfo * ) dev -> priv ; u16 * data = ( u16 * ) & rq -> ifr_data ; u32 phy = priv -> phy [ priv -> phyNum ] ; if ( ! priv -> phyOnline ) return - EAGAIN ; switch ( cmd ) { case SIOCDEVPRIVATE : data [ 0 ] = phy ; case SIOCDEVPRIVATE + 1 : TLan_MiiReadReg ( dev , data [ 0 ] , data [ 1 ] , & data [ 3 ] ) ; return 0 ; case SIOCDEVPRIVATE + 2 : if ( ! capable ( CAP_NET_ADMIN ) ) return - EPERM ; TLan_MiiWriteReg ( dev , data [ 0 ] , data [ 1 ] , data [ 2 ] ) ; return 0 ; default : return - EOPNOTSUPP ; } }
TLan_ioctl
TLan_ioctl
/* Read MII register */ /* Write MII register */