diff options
author | 2005-11-07 23:49:32 +0000 | |
---|---|---|
committer | 2005-11-07 23:49:32 +0000 | |
commit | e62d8670bfcabbc2b569dfe14ef03a91a789bd3d (patch) | |
tree | 6301c26f871a0c9733384966eca0381a02d295fb /sys | |
parent | add missing ctype.h (diff) | |
download | wireguard-openbsd-e62d8670bfcabbc2b569dfe14ef03a91a789bd3d.tar.xz wireguard-openbsd-e62d8670bfcabbc2b569dfe14ef03a91a789bd3d.zip |
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@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/scsi/scsi_base.c | 16 | ||||
-rw-r--r-- | sys/scsi/sd.c | 5 |
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; |