summaryrefslogtreecommitdiff
path: root/sys/arch/hp300
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-05-02 05:36:59 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-05-02 05:36:59 +0000
commit89795c51ed2b586f78803fc550d71069c1d05611 (patch)
tree957e5084b36e3ad6390469bcbc1ed5cace8f449a /sys/arch/hp300
parent8520ad0af4a689230043e0672f3ddb870033d43f (diff)
If computed value for d_nsectors truncated to 0, set it to 32 and
adjust d_ncylinders instead of just setting d_nsectors to 1 (which is not useful for putting a filesystem on a device).
Diffstat (limited to 'sys/arch/hp300')
-rw-r--r--sys/arch/hp300/dev/sd.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/sys/arch/hp300/dev/sd.c b/sys/arch/hp300/dev/sd.c
index 791ce329ef6..58abd418d18 100644
--- a/sys/arch/hp300/dev/sd.c
+++ b/sys/arch/hp300/dev/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.17 1998/05/02 05:04:44 millert Exp $ */
+/* $OpenBSD: sd.c,v 1.18 1998/05/02 05:36:58 millert Exp $ */
/* $NetBSD: sd.c,v 1.34 1997/07/10 18:14:10 kleink Exp $ */
/*
@@ -442,8 +442,18 @@ sdgetinfo(dev)
lp->d_ncylinders = sc->sc_cyls;
lp->d_nsectors = lp->d_secperunit /
(lp->d_ntracks * lp->d_ncylinders);
- if (lp->d_nsectors < 1)
- lp->d_nsectors = 1; /* must be >= 1 */
+ /*
+ * We must make sure d_nsectors is a sane value.
+ * Adjust d_ncylinders to be reasonable if we
+ * monkey with d_nsectors.
+ */
+ if (lp->d_nsectors < 1) {
+ lp->d_nsectors = 32;
+ lp->d_ncylinders = lp->d_secperunit /
+ ( lp->d_ntracks * lp->d_nsectors);
+ if (lp->d_ncylinders == 0)
+ lp->d_ncylinders = sc->sc_cyls;
+ }
} else {
lp->d_ntracks = 20;
lp->d_ncylinders = 1;