summaryrefslogtreecommitdiff
path: root/sys/scsi/scsi_ioctl.c
diff options
context:
space:
mode:
authorJason Downs <downsj@cvs.openbsd.org>1997-08-31 07:41:54 +0000
committerJason Downs <downsj@cvs.openbsd.org>1997-08-31 07:41:54 +0000
commita70ba74917ad8e7114c0ceaaab276e7c458da3e7 (patch)
tree4a713f42e99f65187a1803c241ded6db540df011 /sys/scsi/scsi_ioctl.c
parente4f3bdcf31a8b99f4ad6b7905a396b710bf3b4ee (diff)
* Make scsi_do_ioctl() sane again.
* Use scsi_do_ioctl() in cd.c and uk.c again.
Diffstat (limited to 'sys/scsi/scsi_ioctl.c')
-rw-r--r--sys/scsi/scsi_ioctl.c29
1 files changed, 12 insertions, 17 deletions
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;
}