summaryrefslogtreecommitdiff
path: root/sys/scsi/sd.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2005-07-30 15:54:46 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2005-07-30 15:54:46 +0000
commiteba09883ce0bd8f8ab42d958a39975474e754287 (patch)
treeff1aadc5a03a8e5712f237f9fe3c525b7c4e81b5 /sys/scsi/sd.c
parent8b2ca3768ac54170af8012d88eb5405b8d1f082c (diff)
Use the blocksize returned from scsi_size() in preference to all
other values as was intended. As opposed to overwriting it with scsi_do_mode_sense() calls. May help PR4313. ok tdeval@
Diffstat (limited to 'sys/scsi/sd.c')
-rw-r--r--sys/scsi/sd.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 6a94e9e28e7..becd6f1ae38 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.81 2005/07/05 00:55:25 krw Exp $ */
+/* $OpenBSD: sd.c,v 1.82 2005/07/30 15:54:45 krw Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -1332,10 +1332,10 @@ sd_get_parms(sd, dp, flags)
{
struct scsi_mode_sense_buf buf;
union scsi_disk_pages *sense_pages;
- u_int32_t heads = 0, sectors = 0, cyls = 0, blksize;
+ u_int32_t heads = 0, sectors = 0, cyls = 0, blksize, ssblksize;
u_int16_t rpm = 0;
- dp->disksize = scsi_size(sd->sc_link, flags, &blksize);
+ dp->disksize = scsi_size(sd->sc_link, flags, &ssblksize);
switch (sd->sc_link->inqdata.device & SID_TYPE) {
case T_OPTICAL:
@@ -1395,6 +1395,11 @@ sd_get_parms(sd, dp, flags)
if (dp->disksize == 0)
return (SDGP_RESULT_OFFLINE);
+ if (ssblksize > 0)
+ dp->blksize = ssblksize;
+ else
+ dp->blksize = (blksize == 0) ? 512 : blksize;
+
/*
* Use Adaptec standard geometry values for anything we still don't
@@ -1402,7 +1407,6 @@ sd_get_parms(sd, dp, flags)
*/
dp->heads = (heads == 0) ? 64 : heads;
- dp->blksize = (blksize == 0) ? 512 : blksize;
dp->sectors = (sectors == 0) ? 32 : sectors;
dp->rot_rate = (rpm == 0) ? 3600 : rpm;