summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2006-07-15 00:04:12 +0000
committerBob Beck <beck@cvs.openbsd.org>2006-07-15 00:04:12 +0000
commita0bae1c7921b23870da99990c920290b11effe54 (patch)
tree2e5fb6c79b6e6344083afad688631e6104583d40
parentf5939ce0764a2ebcf61e6dd55d17d8f41698e3c2 (diff)
catch "Media Removal Prevented" for devices that are capable of telling us
when we're not allowed to yank things out of them. Instead of returning a generic EIO and having the kernel printf a scsi sense to the console, we now return EBUSY to userland and avoid the dmesg spewing. ok krw@
-rw-r--r--sys/scsi/scsi_base.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index 5d79b67a37a..7a3adc013da 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_base.c,v 1.107 2006/07/13 11:46:16 krw Exp $ */
+/* $OpenBSD: scsi_base.c,v 1.108 2006/07/15 00:04:11 beck Exp $ */
/* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */
/*
@@ -1006,6 +1006,9 @@ scsi_interpret_sense(struct scsi_xfer *xs)
case SKEY_ILLEGAL_REQUEST:
if ((xs->flags & SCSI_IGNORE_ILLEGAL_REQUEST) != 0)
return (0);
+ if (sense->add_sense_code == 0x53 &&
+ sense->add_sense_code_qual == 0x02)
+ return(EBUSY); /* Medium Removal Prevented */
error = EINVAL;
break;
case SKEY_UNIT_ATTENTION: