Remove odd practice of inverting error codes.

-EPERM is equal to ERESTART, returning which from ioctl() handler causes
infinite syscall restart.

MFC after:	2 weeks
This commit is contained in:
Alexander Motin 2014-06-27 22:28:14 +00:00
parent 37a107a407
commit acee7463b6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=267986

View File

@ -2147,14 +2147,14 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
* to this FETD.
*/
if ((softc->ioctl_info.flags & CTL_IOCTL_FLAG_ENABLED) == 0) {
retval = -EPERM;
retval = EPERM;
break;
}
io = ctl_alloc_io(softc->ioctl_info.fe.ctl_pool_ref);
if (io == NULL) {
printf("ctl_ioctl: can't allocate ctl_io!\n");
retval = -ENOSPC;
retval = ENOSPC;
break;
}
@ -2689,7 +2689,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
softc->flags |= CTL_FLAG_REAL_SYNC;
break;
default:
retval = -EINVAL;
retval = EINVAL;
break;
}
mtx_unlock(&softc->ctl_lock);
@ -3168,7 +3168,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
if (found == 0) {
printf("ctl: unknown ioctl command %#lx or backend "
"%d\n", cmd, type);
retval = -EINVAL;
retval = EINVAL;
break;
}
retval = backend->ioctl(dev, cmd, addr, flag, td);
@ -3333,7 +3333,7 @@ ctl_pool_create(struct ctl_softc *ctl_softc, ctl_pool_type pool_type,
pool = (struct ctl_io_pool *)malloc(sizeof(*pool), M_CTL,
M_NOWAIT | M_ZERO);
if (pool == NULL) {
retval = -ENOMEM;
retval = ENOMEM;
goto bailout;
}
@ -3416,7 +3416,7 @@ ctl_pool_acquire(struct ctl_io_pool *pool)
mtx_assert(&pool->ctl_softc->pool_lock, MA_OWNED);
if (pool->flags & CTL_POOL_FLAG_INVALID)
return (-EINVAL);
return (EINVAL);
pool->refcount++;
@ -9389,7 +9389,7 @@ ctl_tur(struct ctl_scsiio *ctsio)
CTL_DEBUG_PRINT(("ctl_tur\n"));
if (lun == NULL)
return (-EINVAL);
return (EINVAL);
ctsio->scsi_status = SCSI_STATUS_OK;
ctsio->io_hdr.status = CTL_SUCCESS;
@ -13183,7 +13183,7 @@ ctl_queue(union ctl_io *io)
break;
default:
printf("ctl_queue: unknown I/O type %d\n", io->io_hdr.io_type);
return (-EINVAL);
return (EINVAL);
}
return (CTL_RETVAL_COMPLETE);