summaryrefslogtreecommitdiff
path: root/sys/scsi/sd.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2008-03-21 19:57:45 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2008-03-21 19:57:45 +0000
commit095d864bb45c4316667a3b06f644d2d5b148232b (patch)
treee22b9641b2b194e22a8bbd0fb18db8c0e0dcd559 /sys/scsi/sd.c
parent7049288c591b820e3ea7e1d9eb425240ea3f4dae (diff)
USB Floppies are umass devices so we always use the default 63/255
geometry. But 63 * 255 > 2880 and the cylinder count becomes 0. So if we end up with a valid disksize but 0 cylinders, set heads = cylinders = 1 and sectors-per-track = disksize.
Diffstat (limited to 'sys/scsi/sd.c')
-rw-r--r--sys/scsi/sd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 290b7832f6a..0242673d9ca 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.141 2007/12/28 16:19:15 dlg Exp $ */
+/* $OpenBSD: sd.c,v 1.142 2008/03/21 19:57:44 krw Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -1460,6 +1460,11 @@ validate:
dp->cyls = (cyls == 0) ? dp->disksize / (dp->heads * dp->sectors) :
cyls;
+ if (dp->cyls == 0) {
+ dp->heads = dp->cyls = 1;
+ dp->sectors = dp->disksize;
+ }
+
return (SDGP_RESULT_OK);
}