diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1997-08-31 07:41:54 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1997-08-31 07:41:54 +0000 |
commit | a70ba74917ad8e7114c0ceaaab276e7c458da3e7 (patch) | |
tree | 4a713f42e99f65187a1803c241ded6db540df011 | |
parent | e4f3bdcf31a8b99f4ad6b7905a396b710bf3b4ee (diff) |
* Make scsi_do_ioctl() sane again.
* Use scsi_do_ioctl() in cd.c and uk.c again.
-rw-r--r-- | sys/scsi/cd.c | 4 | ||||
-rw-r--r-- | sys/scsi/scsi_ioctl.c | 29 | ||||
-rw-r--r-- | sys/scsi/uk.c | 4 |
3 files changed, 16 insertions, 21 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index 6e9e730e6be..f00038c3ea5 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd.c,v 1.24 1997/08/08 21:47:05 niklas Exp $ */ +/* $OpenBSD: cd.c,v 1.25 1997/08/31 07:41:51 downsj Exp $ */ /* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */ /* @@ -1027,7 +1027,7 @@ cdioctl(dev, cmd, addr, flag, p) default: if (CDPART(dev) != RAW_PART) return ENOTTY; - return scsi_do_safeioctl(cd->sc_link, dev, cmd, addr, flag, p); + return scsi_do_ioctl(cd->sc_link, dev, cmd, addr, flag, p); } #ifdef DIAGNOSTIC diff --git a/sys/scsi/scsi_ioctl.c b/sys/scsi/scsi_ioctl.c index f1fc067dff8..3d81d77bc47 100644 --- a/sys/scsi/scsi_ioctl.c +++ b/sys/scsi/scsi_ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi_ioctl.c,v 1.7 1997/04/14 04:09:11 downsj Exp $ */ +/* $OpenBSD: scsi_ioctl.c,v 1.8 1997/08/31 07:41:52 downsj Exp $ */ /* $NetBSD: scsi_ioctl.c,v 1.23 1996/10/12 23:23:17 christos Exp $ */ /* @@ -290,15 +290,9 @@ scsi_do_ioctl(sc_link, dev, cmd, addr, flag, p) SC_DEBUG(sc_link, SDEV_DB2, ("scsi_do_ioctl(0x%lx)\n", cmd)); - /* Check for the safe-ness of this request. */ - switch (cmd) { - case SCIOCIDENTIFY: - break; - - default: - if ((flag & FWRITE) == 0) - return EBADF; - } + /* If we don't have write access, just skip to the safe ones. */ + if ((flag & FWRITE) == 0) + return scsi_do_safeioctl(sc_link, dev, cmd, addr, flag, p); switch(cmd) { case SCIOCCOMMAND: { @@ -306,9 +300,6 @@ scsi_do_ioctl(sc_link, dev, cmd, addr, flag, p) struct scsi_ioctl *si; int len; - if ((flag & FWRITE) == 0) - return EBADF; - si = si_get(); si->si_screq = *screq; si->si_sc_link = sc_link; @@ -344,8 +335,6 @@ scsi_do_ioctl(sc_link, dev, cmd, addr, flag, p) case SCIOCDEBUG: { int level = *((int *)addr); - if ((flag & FWRITE) == 0) - return EBADF; SC_DEBUG(sc_link, SDEV_DB3, ("debug set to %d\n", level)); sc_link->flags &= ~SDEV_DBX; /* clear debug bits */ if (level & 1) @@ -361,8 +350,6 @@ scsi_do_ioctl(sc_link, dev, cmd, addr, flag, p) case SCIOCREPROBE: { struct scsi_addr *sca = (struct scsi_addr *)addr; - if ((flag & FWRITE) == 0) - return EBADF; return scsi_probe_busses(sca->scbus, sca->target, sca->lun); } case SCIOCRECONFIG: @@ -404,6 +391,14 @@ scsi_do_safeioctl(sc_link, dev, cmd, addr, flag, p) sca->lun = sc_link->lun; return 0; } + case SCIOCCOMMAND: + case SCIOCDEBUG: + case SCIOCREPROBE: + case SCIOCRESET: + return EBADF; + case SCIOCRECONFIG: + case SCIOCDECONFIG: + return EINVAL; default: return ENOTTY; } diff --git a/sys/scsi/uk.c b/sys/scsi/uk.c index 8860b64a0db..315b42c5265 100644 --- a/sys/scsi/uk.c +++ b/sys/scsi/uk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uk.c,v 1.5 1996/10/04 17:58:45 niklas Exp $ */ +/* $OpenBSD: uk.c,v 1.6 1997/08/31 07:41:53 downsj Exp $ */ /* $NetBSD: uk.c,v 1.15 1996/03/17 00:59:57 thorpej Exp $ */ /* @@ -182,5 +182,5 @@ ukioctl(dev, cmd, addr, flag, p) { register struct uk_softc *uk = uk_cd.cd_devs[UKUNIT(dev)]; - return scsi_do_safeioctl(uk->sc_link, dev, cmd, addr, flag, p); + return scsi_do_ioctl(uk->sc_link, dev, cmd, addr, flag, p); } |