summaryrefslogtreecommitdiff
path: root/sys/scsi
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2010-07-02 00:04:12 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2010-07-02 00:04:12 +0000
commit49d47f6028ac2f9793e00d7d432bd1d138071dc2 (patch)
treee86fd6fc4e35c579402d155713d4f531ff13b261 /sys/scsi
parent4116d8a387370fa5be708ad38892a9e7ca9d7bb8 (diff)
Use M_NOWAIT only if SCSI_NOSLEEP is set, as is the usual idiom. From
matthew@ who won't be home until late. ok matthew@ & tedu@.
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/scsi_base.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index 9f72d67689c..0bbe0a8b931 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_base.c,v 1.179 2010/07/01 22:20:01 krw Exp $ */
+/* $OpenBSD: scsi_base.c,v 1.180 2010/07/02 00:04:11 krw Exp $ */
/* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */
/*
@@ -628,8 +628,8 @@ scsi_size(struct scsi_link *sc_link, int flags, u_int32_t *blksize)
{
struct scsi_read_capacity_16 rc16;
struct scsi_read_capacity rc;
- struct scsi_read_cap_data_16 *rdcap16 = NULL;
- struct scsi_read_cap_data *rdcap = NULL;
+ struct scsi_read_cap_data_16 *rdcap16;
+ struct scsi_read_cap_data *rdcap;
daddr64_t max_addr;
int error;
@@ -647,7 +647,8 @@ scsi_size(struct scsi_link *sc_link, int flags, u_int32_t *blksize)
* If the command works, interpret the result as a 4 byte
* number of blocks
*/
- rdcap = malloc(sizeof(*rdcap), M_TEMP, M_NOWAIT|M_ZERO);
+ rdcap = malloc(sizeof(*rdcap), M_TEMP, ((flags & SCSI_NOSLEEP) ? M_NOWAIT :
+ M_WAITOK) | M_ZERO);
if (rdcap == NULL)
return (0);
error = scsi_scsi_cmd(sc_link, (struct scsi_generic *)&rc, sizeof(rc),
@@ -677,7 +678,8 @@ scsi_size(struct scsi_link *sc_link, int flags, u_int32_t *blksize)
rc16.byte2 = SRC16_SERVICE_ACTION;
_lto4b(sizeof(*rdcap16), rc16.length);
- rdcap16 = malloc(sizeof(*rdcap16), M_TEMP, M_NOWAIT|M_ZERO);
+ rdcap16 = malloc(sizeof(*rdcap16), M_TEMP, ((flags & SCSI_NOSLEEP) ?
+ M_NOWAIT : M_WAITOK) | M_ZERO);
if (rdcap16 == NULL)
return (0);
error = scsi_scsi_cmd(sc_link, (struct scsi_generic *)&rc16,