Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Jul 2014 02:04:45 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r268547 - stable/9/sys/cam/ctl
Message-ID:  <201407120204.s6C24jbO016042@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sat Jul 12 02:04:45 2014
New Revision: 268547
URL: http://svnweb.freebsd.org/changeset/base/268547

Log:
  MFC r267986:
  Remove odd practice of inverting error codes.
  
  -EPERM is equal to ERESTART, returning which from ioctl() handler causes
  infinite syscall restart.

Modified:
  stable/9/sys/cam/ctl/ctl.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/cam/ctl/ctl.c
==============================================================================
--- stable/9/sys/cam/ctl/ctl.c	Sat Jul 12 02:03:29 2014	(r268546)
+++ stable/9/sys/cam/ctl/ctl.c	Sat Jul 12 02:04:45 2014	(r268547)
@@ -2180,14 +2180,14 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
 		 * 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;
 		}
 
@@ -2717,7 +2717,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
 			softc->flags |= CTL_FLAG_REAL_SYNC;
 			break;
 		default:
-			retval = -EINVAL;
+			retval = EINVAL;
 			break;
 		}
 		mtx_unlock(&softc->ctl_lock);
@@ -3166,7 +3166,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
 		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);
@@ -3331,7 +3331,7 @@ ctl_pool_create(struct ctl_softc *ctl_so
 	pool = (struct ctl_io_pool *)malloc(sizeof(*pool), M_CTL,
 					    M_NOWAIT | M_ZERO);
 	if (pool == NULL) {
-		retval = -ENOMEM;
+		retval = ENOMEM;
 		goto bailout;
 	}
 
@@ -3414,7 +3414,7 @@ ctl_pool_acquire(struct ctl_io_pool *poo
 	mtx_assert(&pool->ctl_softc->pool_lock, MA_OWNED);
 
 	if (pool->flags & CTL_POOL_FLAG_INVALID)
-		return (-EINVAL);
+		return (EINVAL);
 
 	pool->refcount++;
 
@@ -8901,7 +8901,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;
@@ -12704,7 +12704,7 @@ ctl_queue(union ctl_io *io)
 	default:
 		mtx_unlock(&ctl_softc->ctl_lock);
 		printf("ctl_queue: unknown I/O type %d\n", io->io_hdr.io_type);
-		return (-EINVAL);
+		return (EINVAL);
 		break; /* NOTREACHED */
 	}
 	mtx_unlock(&ctl_softc->ctl_lock);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407120204.s6C24jbO016042>