diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2006-07-07 23:47:38 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2006-07-07 23:47:38 +0000 |
commit | 10157221a2659d2c272524b419801c7f9718ef12 (patch) | |
tree | e41780893a681e8d7edd098722398f743353136a /sys/arch/hppa64 | |
parent | 82591ef1eb156d609b57ff16c71feb7d88b92aa1 (diff) |
Unroll DLT_* logic into simple 'look for native disklabel, then try
DOS MBR' logic.
Leave DOS MBR logic inside #if defined(DISKLABEL_I386) blocks until
impact on install media can be evaluated. Eliminates most remnants
of cross-endian, cross-architecture disklabel processing attempts.
Fix some mips64 issues with last commit, found by kettenis@.
No functional change.
Diffstat (limited to 'sys/arch/hppa64')
-rw-r--r-- | sys/arch/hppa64/hppa64/disksubr.c | 68 | ||||
-rw-r--r-- | sys/arch/hppa64/include/disklabel.h | 16 |
2 files changed, 24 insertions, 60 deletions
diff --git a/sys/arch/hppa64/hppa64/disksubr.c b/sys/arch/hppa64/hppa64/disksubr.c index e5ae72737c9..d6dfe643b3a 100644 --- a/sys/arch/hppa64/hppa64/disksubr.c +++ b/sys/arch/hppa64/hppa64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.9 2006/07/03 20:00:22 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.10 2006/07/07 23:47:37 krw Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -35,7 +35,7 @@ */ /* - * This disksubr.c module started to take it's present form on OpenBSD/alpha + * This disksubr.c module started to take its present form on OpenBSD/alpha * but it was always thought it should be made completely MI and not need to * be in that alpha-specific tree at all. * @@ -64,8 +64,6 @@ char *readdoslabel(struct buf *, void (*)(struct buf *), char *readliflabel(struct buf *, void (*)(struct buf *), struct disklabel *, struct cpu_disklabel *, int *, int *, int); -static enum disklabel_tag probe_order[] = { LABELPROBES, -1 }; - /* * Try to read a standard BSD disklabel at a certain sector. */ @@ -146,7 +144,6 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) { struct buf *bp = NULL; char *msg = "no disk label"; - enum disklabel_tag *tp; int i; struct disklabel minilabel, fallbacklabel; @@ -173,32 +170,22 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - for (tp = probe_order; msg && *tp != -1; tp++) { - switch (*tp) { - case DLT_I386: + msg = readliflabel(bp, strat, lp, osdep, 0, 0, spoofonly); + if (msg) + *lp = minilabel; #if defined(DISKLABEL_I386) - msg = readdoslabel(bp, strat, lp, osdep, 0, 0, spoofonly); - if (msg) - /* Fallback alternative */ - fallbacklabel = *lp; -#endif - break; - - case DLT_HPPA: - msg = readliflabel(bp, strat, lp, osdep, 0, 0, spoofonly); - break; - - default: - panic("unrecognized disklabel tag %d", *tp); - } - if (msg) + if (msg) { + msg = readdoslabel(bp, strat, lp, osdep, 0, 0, spoofonly); + if (msg) { + /* Fallback alternative XXX always valid? */ + fallbacklabel = *lp; *lp = minilabel; + } } - +#endif /* Record metainformation about the disklabel. */ if (msg == NULL) { osdep->labelsector = bp->b_blkno; - osdep->labeltag = *tp; } #if defined(CD9660) @@ -644,7 +631,7 @@ setdisklabel(olp, nlp, openmask, osdep) * XXX Nice thought, but it doesn't work, if the intention was to * force a reread at the next *readdisklabel call. That does not * happen. There's still some use for it though as you can pseudo- - * partitition the disk. + * partition the disk. * * Special case to allow disklabel to be invalidated. */ @@ -697,7 +684,6 @@ writedisklabel(dev, strat, lp, osdep) struct disklabel *lp; struct cpu_disklabel *osdep; { - enum disklabel_tag *tp; char *msg = "no disk label"; struct buf *bp; struct disklabel dl; @@ -714,28 +700,16 @@ writedisklabel(dev, strat, lp, osdep) * think it might be useful to reprobe if someone has written * a newer disklabel of another type with disklabel(8) and -r. */ - for (tp = probe_order; msg && *tp != -1; tp++) { - dl = *lp; - switch (*tp) { - case DLT_I386: + dl = *lp; + msg = readliflabel(bp, strat, &dl, &cdl, &partoff, &cyl, 0); + labeloffset = HPPA_LABELOFFSET; #if defined(DISKLABEL_I386) - msg = readdoslabel(bp, strat, &dl, &cdl, &partoff, - &cyl, 0); - labeloffset = I386_LABELOFFSET; -#endif - break; - - case DLT_HPPA: - msg = readliflabel(bp, strat, &dl, &cdl, &partoff, - &cyl, 0); - labeloffset = HPPA_LABELOFFSET; - break; - - default: - panic("unrecognized disklabel tag %d", *tp); - } + if (msg) { + dl = *lp; + msg = readdoslabel(bp, strat, &dl, &cdl, &partoff, &cyl, 0); + labeloffset = I386_LABELOFFSET; } - +#endif if (msg) { if (partoff == -1) return EIO; diff --git a/sys/arch/hppa64/include/disklabel.h b/sys/arch/hppa64/include/disklabel.h index 08bd639495c..051dbe2865b 100644 --- a/sys/arch/hppa64/include/disklabel.h +++ b/sys/arch/hppa64/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.5 2006/07/03 20:00:22 krw Exp $ */ +/* $OpenBSD: disklabel.h,v 1.6 2006/07/07 23:47:37 krw Exp $ */ /* $NetBSD: disklabel.h,v 1.1 1995/02/13 23:07:34 cgd Exp $ */ /* @@ -34,19 +34,10 @@ #ifndef _MACHINE_DISKLABEL_H_ #define _MACHINE_DISKLABEL_H_ -enum disklabel_tag { DLT_I386, DLT_HPPA }; - -/* - * What disklabels are we probing for, and in which order? - */ -#ifndef LABELPROBES -#define LABELPROBES DLT_I386, DLT_HPPA -#endif - -#define I386_LABELSECTOR 1 /* sector containing label */ -#define I386_LABELOFFSET 0 /* offset of label in sector */ #define HPPA_LABELSECTOR 1 /* sector containing label */ #define HPPA_LABELOFFSET 0 /* offset of label in sector */ +#define I386_LABELSECTOR 1 /* sector containing label */ +#define I386_LABELOFFSET 0 /* offset of label in sector */ #define LABELSECTOR HPPA_LABELSECTOR #define LABELOFFSET HPPA_LABELOFFSET @@ -186,7 +177,6 @@ struct hpux_label { #include <sys/dkbad.h> struct cpu_disklabel { - enum disklabel_tag labeltag; int labelsector; union { struct { |