case SIOCIWLASTPRIV: err = orinoco_debug_dump_recs(dev); if (err) printk(KERN_ERR "%s: Unable to dump records (%d)\n", dev->name, err); break;   
orinoco_ioctl(struct net_device *dev, struct ifreq *rq, int cmd){	struct orinoco_private *priv = netdev_priv(dev);	struct iwreq *wrq = (struct iwreq *)rq;	int err = 0;	int tmp;	int changed = 0;	unsigned long flags;	TRACE_ENTER(dev->name);	/* In theory, we could allow most of the the SET stuff to be	 * done. In practice, the lapse of time at startup when the	 * card is not ready is very short, so why bother...  Note	 * that netif_device_present is different from up/down	 * (ifconfig), when the device is not yet up, it is usually	 * already ready...  Jean II */	if (! netif_device_present(dev))		return -ENODEV;	switch (cmd) {	case SIOCGIWNAME:		strcpy(wrq->u.name, "IEEE 802.11-DS");		break;			case SIOCGIWAP:		wrq->u.ap_addr.sa_family = ARPHRD_ETHER;		err = orinoco_hw_get_bssid(priv, wrq->u.ap_addr.sa_data);		break;	case SIOCGIWRANGE:		err = orinoco_ioctl_getiwrange(dev, &wrq->u.data);		break;	case SIOCSIWMODE:		if (orinoco_lock(priv, &flags) != 0)			return -EBUSY;		switch (wrq->u.mode) {		case IW_MODE_ADHOC:			if (! (priv->has_ibss || priv->has_port3) )				err = -EINVAL;			else {				priv->iw_mode = IW_MODE_ADHOC;				changed = 1;			}			break;		case IW_MODE_INFRA:			priv->iw_mode = IW_MODE_INFRA;			changed = 1;			break;		default:			err = -EINVAL;			break;		}		set_port_type(priv);		orinoco_unlock(priv, &flags);		break;	case SIOCGIWMODE:		if (orinoco_lock(priv, &flags) != 0)			return -EBUSY;		wrq->u.mode = priv->iw_mode;		orinoco_unlock(priv, &flags);		break;	case SIOCSIWENCODE:		err = orinoco_ioctl_setiwencode(dev, &wrq->u.encoding);		if (! err)			changed = 1;		break;	case SIOCGIWENCODE:		if (! capable(CAP_NET_ADMIN)) {			err = -EPERM;			break;		}		err = orinoco_ioctl_getiwencode(dev, &wrq->u.encoding);		break;	case SIOCSIWESSID:		err = orinoco_ioctl_setessid(dev, &wrq->u.essid);		if (! err)			changed = 1;		break;	case SIOCGIWESSID:		err = orinoco_ioctl_getessid(dev, &wrq->u.essid);		break;	case SIOCSIWNICKN:		err = orinoco_ioctl_setnick(dev, &wrq->u.data);		if (! err)			changed = 1;		break;	case SIOCGIWNICKN:		err = orinoco_ioctl_getnick(dev, &wrq->u.data);		break;	case SIOCGIWFREQ:		tmp = orinoco_hw_get_freq(priv);		if (tmp < 0) {			err = tmp;		} else {			wrq->u.freq.m = tmp;			wrq->u.freq.e = 1;		}		break;	case SIOCSIWFREQ:		err = orinoco_ioctl_setfreq(dev, &wrq->u.freq);		if (! err)			changed = 1;		break;	case SIOCGIWSENS:		err = orinoco_ioctl_getsens(dev, &wrq->u.sens);		break;	case SIOCSIWSENS:		err = orinoco_ioctl_setsens(dev, &wrq->u.sens);		if (! err)			changed = 1;		break;	case SIOCGIWRTS:		wrq->u.rts.value = priv->rts_thresh;		wrq->u.rts.disabled = (wrq->u.rts.value == 2347);		wrq->u.rts.fixed = 1;		break;	case SIOCSIWRTS:		err = orinoco_ioctl_setrts(dev, &wrq->u.rts);		if (! err)			changed = 1;		break;	case SIOCSIWFRAG:		err = orinoco_ioctl_setfrag(dev, &wrq->u.frag);		if (! err)			changed = 1;		break;	case SIOCGIWFRAG:		err = orinoco_ioctl_getfrag(dev, &wrq->u.frag);		break;	case SIOCSIWRATE:		err = orinoco_ioctl_setrate(dev, &wrq->u.bitrate);		if (! err)			changed = 1;		break;	case SIOCGIWRATE:		err = orinoco_ioctl_getrate(dev, &wrq->u.bitrate);		break;	case SIOCSIWPOWER:		err = orinoco_ioctl_setpower(dev, &wrq->u.power);		if (! err)			changed = 1;		break;	case SIOCGIWPOWER:		err = orinoco_ioctl_getpower(dev, &wrq->u.power);		break;	case SIOCGIWTXPOW:		/* The card only supports one tx power, so this is easy */		wrq->u.txpower.value = 15; /* dBm */		wrq->u.txpower.fixed = 1;		wrq->u.txpower.disabled = 0;		wrq->u.txpower.flags = IW_TXPOW_DBM;		break;	case SIOCSIWRETRY:		err = -EOPNOTSUPP;		break;	case SIOCGIWRETRY:		err = orinoco_ioctl_getretry(dev, &wrq->u.retry);		break;	case SIOCSIWSPY:		err = orinoco_ioctl_setspy(dev, &wrq->u.data);		break;	case SIOCGIWSPY:		err = orinoco_ioctl_getspy(dev, &wrq->u.data);		break;	case SIOCGIWPRIV:		if (wrq->u.data.pointer) {			struct iw_priv_args privtab[] = {				{ SIOCIWFIRSTPRIV + 0x0, 0, 0, "force_reset" },				{ SIOCIWFIRSTPRIV + 0x1, 0, 0, "card_reset" },				{ SIOCIWFIRSTPRIV + 0x2,				  IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,				  0, "set_port3" },				{ SIOCIWFIRSTPRIV + 0x3, 0,				  IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,				  "get_port3" },				{ SIOCIWFIRSTPRIV + 0x4,				  IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,				  0, "set_preamble" },				{ SIOCIWFIRSTPRIV + 0x5, 0,				  IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,				  "get_preamble" },				{ SIOCIWFIRSTPRIV + 0x6,				  IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,				  0, "set_ibssport" },				{ SIOCIWFIRSTPRIV + 0x7, 0,				  IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,				  "get_ibssport" },				{ SIOCIWLASTPRIV, 0, 0, "dump_recs" },			};			wrq->u.data.length = sizeof(privtab) / sizeof(privtab[0]);			if (copy_to_user(wrq->u.data.pointer, privtab, sizeof(privtab)))				err = -EFAULT;		}		break;	       	case SIOCIWFIRSTPRIV + 0x0: /* force_reset */	case SIOCIWFIRSTPRIV + 0x1: /* card_reset */		if (! capable(CAP_NET_ADMIN)) {			err = -EPERM;			break;		}				printk(KERN_DEBUG "%s: Force scheduling reset!\n", dev->name);		schedule_work(&priv->reset_work);		break;	case SIOCIWFIRSTPRIV + 0x2: /* set_port3 */		if (! capable(CAP_NET_ADMIN)) {			err = -EPERM;			break;		}		err = orinoco_ioctl_setport3(dev, wrq);		if (! err)			changed = 1;		break;	case SIOCIWFIRSTPRIV + 0x3: /* get_port3 */		err = orinoco_ioctl_getport3(dev, wrq);		break;	case SIOCIWFIRSTPRIV + 0x4: /* set_preamble */		if (! capable(CAP_NET_ADMIN)) {			err = -EPERM;			break;		}		/* 802.11b has recently defined some short preamble.		 * Basically, the Phy header has been reduced in size.		 * This increase performance, especially at high rates		 * (the preamble is transmitted at 1Mb/s), unfortunately		 * this give compatibility troubles... - Jean II */		if(priv->has_preamble) {			int val = *( (int *) wrq->u.name );			if (orinoco_lock(priv, &flags) != 0)				return -EBUSY;			if (val)				priv->preamble = 1;			else				priv->preamble = 0;			orinoco_unlock(priv, &flags);			changed = 1;		} else			err = -EOPNOTSUPP;		break;	case SIOCIWFIRSTPRIV + 0x5: /* get_preamble */		if(priv->has_preamble) {			int *val = (int *)wrq->u.name;			if (orinoco_lock(priv, &flags) != 0)				return -EBUSY;			*val = priv->preamble;			orinoco_unlock(priv, &flags);		} else			err = -EOPNOTSUPP;		break;	case SIOCIWFIRSTPRIV + 0x6: /* set_ibssport */		if (! capable(CAP_NET_ADMIN)) {			err = -EPERM;			break;		}		err = orinoco_ioctl_setibssport(dev, wrq);		if (! err)			changed = 1;		break;	case SIOCIWFIRSTPRIV + 0x7: /* get_ibssport */		err = orinoco_ioctl_getibssport(dev, wrq);		break;	case SIOCIWLASTPRIV:		err = orinoco_debug_dump_recs(dev);		if (err)			printk(KERN_ERR "%s: Unable to dump records (%d)\n",			       dev->name, err);		break;	default:		err = -EOPNOTSUPP;	}		if (! err && changed && netif_running(dev)) {		err = orinoco_reconfigure(dev);	}			TRACE_EXIT(dev->name);	return err;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/1fc5eb642805fa724b67fd17f008b582b0400919/orinoco.c/buggy/drivers/net/wireless/orinoco.c