diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2006-05-28 00:47:46 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2006-05-28 00:47:46 +0000 |
commit | 464a31b695a337bf748780c7083829b38fd1af53 (patch) | |
tree | b7c2ef968ad09c3ec417fe60fa817b3da25a1a7f /sys/scsi | |
parent | 7bffa453e53008e5a42475a2e17aebf5f89b9702 (diff) |
Always allow ioctl's to work, even if there is no media loaded.
Analogous to what sd does for the raw partition. Eliminates useless
error messages and premature command completion. e.g. 'mt status' will
wait for media to to finish loading.
ok beck@
Diffstat (limited to 'sys/scsi')
-rw-r--r-- | sys/scsi/st.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/sys/scsi/st.c b/sys/scsi/st.c index ea1468c3615..c0f07618996 100644 --- a/sys/scsi/st.c +++ b/sys/scsi/st.c @@ -1,4 +1,4 @@ -/* $OpenBSD: st.c,v 1.52 2006/05/28 00:27:09 krw Exp $ */ +/* $OpenBSD: st.c,v 1.53 2006/05/28 00:47:45 krw Exp $ */ /* $NetBSD: st.c,v 1.71 1997/02/21 23:03:49 thorpej Exp $ */ /* @@ -60,6 +60,7 @@ #include <sys/fcntl.h> #include <sys/errno.h> #include <sys/ioctl.h> +#include <sys/stat.h> #include <sys/malloc.h> #include <sys/buf.h> #include <sys/proc.h> @@ -471,17 +472,16 @@ st_loadquirks(st) * open the device. */ int -stopen(dev, flags, mode, p) +stopen(dev, flags, fmt, p) dev_t dev; int flags; - int mode; + int fmt; struct proc *p; { - int unit; - u_int stmode, dsty; - int error = 0; - struct st_softc *st; struct scsi_link *sc_link; + struct st_softc *st; + u_int dsty; + int error = 0, unit; unit = STUNIT(dev); if (unit >= st_cd.cd_ndevs) @@ -490,7 +490,6 @@ stopen(dev, flags, mode, p) if (!st) return ENXIO; - stmode = STMODE(dev); dsty = STDSTY(dev); sc_link = st->sc_link; @@ -509,19 +508,15 @@ stopen(dev, flags, mode, p) * Catch any unit attention errors. */ error = scsi_test_unit_ready(sc_link, TEST_READY_RETRIES_DEFAULT, - SCSI_IGNORE_MEDIA_CHANGE | - (stmode == CTLMODE ? SCSI_IGNORE_NOT_READY : 0)); - if (error) + SCSI_IGNORE_MEDIA_CHANGE | SCSI_IGNORE_ILLEGAL_REQUEST | + ((fmt == S_IFCHR) ? SCSI_SILENT : 0)); + if (error && (fmt != S_IFCHR)) goto bad; sc_link->flags |= SDEV_OPEN; /* unit attn are now errors */ - /* - * If the mode is 3 (e.g. minor = 3,7,11,15) - * then the device has been opened to set defaults - * This mode does NOT ALLOW I/O, only ioctls - */ - if (stmode == CTLMODE) + /* Allow ioctl's to proceed in all cases, even if we can't mount. */ + if (error && (fmt == S_IFCHR)) return 0; /* |