summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2005-11-07 23:49:33 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2005-11-07 23:49:33 +0000
commit1c46dce0d084f885ce776c3cc5eb1d64c622b4b4 (patch)
tree7a74a964f79d997f3d833991e8cf2ba8e2c05712
parent33146c34aef439a7bd65be456cc607e1e4d4dd7a (diff)
Death to superfluous verbiage. Suppress errors when getting the parameters
for a raw partition like we suppress errors for the other operations on raw partitions. Replace 'could not get size' with more specific and informative SC_DEBUG() output. Silences a usb card reader that fgsch@ found. Now attach message is only 'sdX: drive offline'. Tested & ok fgsch@
-rw-r--r--sys/scsi/scsi_base.c16
-rw-r--r--sys/scsi/sd.c5
2 files changed, 12 insertions, 9 deletions
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index 1888e23a322..97566fafc2c 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_base.c,v 1.93 2005/11/02 01:36:05 krw Exp $ */
+/* $OpenBSD: scsi_base.c,v 1.94 2005/11/07 23:49:32 krw Exp $ */
/* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */
/*
@@ -232,6 +232,7 @@ scsi_size(sc_link, flags, blksize)
struct scsi_read_capacity scsi_cmd;
struct scsi_read_cap_data rdcap;
u_long max_addr;
+ int error;
if (blksize)
*blksize = 0;
@@ -247,13 +248,14 @@ scsi_size(sc_link, flags, blksize)
* If the command works, interpret the result as a 4 byte
* number of blocks
*/
- if (scsi_scsi_cmd(sc_link, (struct scsi_generic *)&scsi_cmd,
- sizeof(scsi_cmd), (u_char *)&rdcap, sizeof(rdcap),
- 2, 20000, NULL, flags | SCSI_DATA_IN) != 0) {
- sc_print_addr(sc_link);
- printf("could not get size\n");
+ error = scsi_scsi_cmd(sc_link, (struct scsi_generic *)&scsi_cmd,
+ sizeof(scsi_cmd), (u_char *)&rdcap, sizeof(rdcap), 2, 20000, NULL,
+ flags | SCSI_DATA_IN);
+ if (error) {
+ SC_DEBUG(sc_link, SDEV_DB1, ("READ CAPACITY error (%#x)\n",
+ error));
return (0);
- }
+ }
max_addr = _4btol(rdcap.addr);
if (blksize)
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index a30bc308cb5..8d74761bdd1 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.95 2005/10/10 20:06:12 krw Exp $ */
+/* $OpenBSD: sd.c,v 1.96 2005/11/07 23:49:32 krw Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -408,7 +408,8 @@ sdopen(dev, flag, fmt, p)
}
/* Load the physical device parameters. */
sc_link->flags |= SDEV_MEDIA_LOADED;
- if (sd_get_parms(sd, &sd->params, 0) == SDGP_RESULT_OFFLINE) {
+ if (sd_get_parms(sd, &sd->params, (rawopen ? SCSI_SILENT : 0))
+ == SDGP_RESULT_OFFLINE) {
sc_link->flags &= ~SDEV_MEDIA_LOADED;
error = ENXIO;
goto bad;