static int suni_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg) { switch (cmd) { case SONET_GETSTATZ: case SONET_GETSTAT: return fetch_stats(dev, arg, cmd == SONET_GETSTATZ); case SONET_SETDIAG: return change_diag(dev,arg,1); case SONET_CLRDIAG: return change_diag(dev,arg,0); case SONET_GETDIAG: return get_diag(dev,arg); case SONET_SETFRAMING: if (!capable(CAP_NET_ADMIN)) return -EPERM; return set_framing(dev, arg); case SONET_GETFRAMING: return get_framing(dev, arg); case SONET_GETFRSENSE: return -EINVAL; case ATM_SETLOOP: if (!capable(CAP_NET_ADMIN)) return -EPERM; return set_loopback(dev,(int)(unsigned long)arg); case ATM_GETLOOP: return put_user(PRIV(dev)->loop_mode,(int __user *)arg) ? -EFAULT : 0; case ATM_QUERYLOOP: return put_user(ATM_LM_LOC_PHY | ATM_LM_RMT_PHY, (int __user *) arg) ? -EFAULT : 0; default: return -ENOIOCTLCMD; } }
static int suni_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) { switch (cmd) { case SONET_GETSTATZ: case SONET_GETSTAT: return fetch_stats(dev,(struct sonet_stats *) arg, cmd == SONET_GETSTATZ); case SONET_SETDIAG: return change_diag(dev,arg,1); case SONET_CLRDIAG: return change_diag(dev,arg,0); case SONET_GETDIAG: return get_diag(dev,arg); case SONET_SETFRAMING: if (arg != SONET_FRAME_SONET) return -EINVAL; return 0; case SONET_GETFRAMING: return put_user(SONET_FRAME_SONET,(int *) arg) ? -EFAULT : 0; case SONET_GETFRSENSE: return -EINVAL; case ATM_SETLOOP: return set_loopback(dev,(int) (long) arg); case ATM_GETLOOP: return put_user(PRIV(dev)->loop_mode,(int *) arg) ? -EFAULT : 0; case ATM_QUERYLOOP: return put_user(ATM_LM_LOC_PHY | ATM_LM_RMT_PHY, (int *) arg) ? -EFAULT : 0; default: return -ENOIOCTLCMD; } }