summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authormycroft <mycroft@NetBSD.org>1994-03-12 22:32:48 +0000
committermycroft <mycroft@NetBSD.org>1994-03-12 22:32:48 +0000
commit9ab5683dc7f88c310fda1490f7c1b0fcee8d9dcf (patch)
tree6f2f1a45528c4d0e8eb33e01b9aff2074ceb242b /sys/dev
parent28183d4cff34f487a425c449b4032abb6cee672b (diff)
Fix problem with reading the disk label if it's not at the beginning of the
disk.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ata/wd.c22
-rw-r--r--sys/dev/isa/wd.c22
2 files changed, 30 insertions, 14 deletions
diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c
index 2dd40835665..79d27d41645 100644
--- a/sys/dev/ata/wd.c
+++ b/sys/dev/ata/wd.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
- * $Id: wd.c,v 1.71 1994/03/12 03:45:08 mycroft Exp $
+ * $Id: wd.c,v 1.72 1994/03/12 22:32:48 mycroft Exp $
*/
#define INSTRUMENT /* instrumentation stuff by Brad Parker */
@@ -841,14 +841,22 @@ wdopen(dev, flag, fmt, p)
wd->sc_state = RECAL;
/* Read label using "raw" partition. */
-#ifdef notdef
- /* wdsetctlr(wd); */ /* Maybe do this TIH */
msg = readdisklabel(makewddev(major(dev), WDUNIT(dev), WDRAW),
wdstrategy, &wd->sc_label, &wd->sc_cpulabel);
- wdsetctlr(wd);
-#endif
- if (msg = readdisklabel(makewddev(major(dev), WDUNIT(dev),
- WDRAW), wdstrategy, &wd->sc_label, &wd->sc_cpulabel)) {
+ if (msg) {
+ /*
+ * This probably happened because the drive's default
+ * geometry doesn't match the DOS geometry. We
+ * assume the DOS geometry is now in the label and try
+ * again. XXX This is a kluge.
+ */
+ if (wd->sc_state > GEOMETRY)
+ wd->sc_state = GEOMETRY;
+ msg = readdisklabel(makewddev(major(dev), WDUNIT(dev),
+ WDRAW), wdstrategy, &wd->sc_label,
+ &wd->sc_cpulabel);
+ }
+ if (msg) {
log(LOG_WARNING, "%s: cannot find label (%s)\n",
wd->sc_dev.dv_xname, msg);
if (part != WDRAW)
diff --git a/sys/dev/isa/wd.c b/sys/dev/isa/wd.c
index 2dd40835665..79d27d41645 100644
--- a/sys/dev/isa/wd.c
+++ b/sys/dev/isa/wd.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
- * $Id: wd.c,v 1.71 1994/03/12 03:45:08 mycroft Exp $
+ * $Id: wd.c,v 1.72 1994/03/12 22:32:48 mycroft Exp $
*/
#define INSTRUMENT /* instrumentation stuff by Brad Parker */
@@ -841,14 +841,22 @@ wdopen(dev, flag, fmt, p)
wd->sc_state = RECAL;
/* Read label using "raw" partition. */
-#ifdef notdef
- /* wdsetctlr(wd); */ /* Maybe do this TIH */
msg = readdisklabel(makewddev(major(dev), WDUNIT(dev), WDRAW),
wdstrategy, &wd->sc_label, &wd->sc_cpulabel);
- wdsetctlr(wd);
-#endif
- if (msg = readdisklabel(makewddev(major(dev), WDUNIT(dev),
- WDRAW), wdstrategy, &wd->sc_label, &wd->sc_cpulabel)) {
+ if (msg) {
+ /*
+ * This probably happened because the drive's default
+ * geometry doesn't match the DOS geometry. We
+ * assume the DOS geometry is now in the label and try
+ * again. XXX This is a kluge.
+ */
+ if (wd->sc_state > GEOMETRY)
+ wd->sc_state = GEOMETRY;
+ msg = readdisklabel(makewddev(major(dev), WDUNIT(dev),
+ WDRAW), wdstrategy, &wd->sc_label,
+ &wd->sc_cpulabel);
+ }
+ if (msg) {
log(LOG_WARNING, "%s: cannot find label (%s)\n",
wd->sc_dev.dv_xname, msg);
if (part != WDRAW)