summaryrefslogtreecommitdiff
path: root/sys/arch/hppa64
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2006-10-17 23:42:38 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2006-10-17 23:42:38 +0000
commitbfde9a5e08bbbd7d384adb3bfb70adeaa47659ed (patch)
tree405ed27db511b51e317b8c9b3cc459d36a27d180 /sys/arch/hppa64
parent504633b3eac97c77e073af15b877798f75a45588 (diff)
The dosparts member of cpu_disklabel was not used for any persistant
data. Eliminate it, and just use the data being read in while processing MBR and EBR records. Should be no functional change. ok weingart@ deraadt@
Diffstat (limited to 'sys/arch/hppa64')
-rw-r--r--sys/arch/hppa64/hppa64/disksubr.c243
-rw-r--r--sys/arch/hppa64/include/disklabel.h5
2 files changed, 121 insertions, 127 deletions
diff --git a/sys/arch/hppa64/hppa64/disksubr.c b/sys/arch/hppa64/hppa64/disksubr.c
index 95dbc857b35..ebcfbae1b20 100644
--- a/sys/arch/hppa64/hppa64/disksubr.c
+++ b/sys/arch/hppa64/hppa64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.20 2006/10/10 03:17:45 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.21 2006/10/17 23:42:37 krw Exp $ */
/*
* Copyright (c) 1999 Michael Shalayeff
@@ -217,9 +217,12 @@ readdoslabel(bp, strat, lp, osdep, partoffp, cylp, spoofonly)
int *cylp;
int spoofonly;
{
- struct dos_partition *dp = osdep->u._i386.dosparts, *dp2;
+ struct dos_partition *dp, *dp2;
+ unsigned long extoff = 0;
+ daddr_t part_blkno = DOSBBSECTOR;
char *msg = NULL, *cp;
int dospartoff, cyl, i, ourpart = -1;
+ int wander = 1, n = 0, loop = 0;
if (lp->d_secpercyl == 0) {
msg = "invalid label, d_secpercyl == 0";
@@ -233,138 +236,132 @@ readdoslabel(bp, strat, lp, osdep, partoffp, cylp, spoofonly)
/* do dos partitions in the process of getting disklabel? */
dospartoff = 0;
cyl = I386_LABELSECTOR / lp->d_secpercyl;
- if (dp) {
- daddr_t part_blkno = DOSBBSECTOR;
- unsigned long extoff = 0;
- int wander = 1, n = 0, loop = 0;
+ /*
+ * Read dos partition table, follow extended partitions.
+ * Map the partitions to disklabel entries i-p
+ */
+ while (wander && n < 8 && loop < 8) {
+ loop++;
+ wander = 0;
+ if (part_blkno < extoff)
+ part_blkno = extoff;
+
+ /* read boot record */
+ bp->b_blkno = part_blkno;
+ bp->b_bcount = lp->d_secsize;
+ bp->b_flags = B_BUSY | B_READ;
+ bp->b_cylinder = part_blkno / lp->d_secpercyl;
+ (*strat)(bp);
+
+ /* if successful, wander through dos partition table */
+ if (biowait(bp)) {
+ msg = "dos partition I/O error";
+ if (partoffp)
+ *partoffp = -1;
+ return (msg);
+ }
+ dp = (struct dos_partition *)(bp->b_data + DOSPARTOFF);
+
+ if (ourpart == -1) {
+ /* Search for our MBR partition */
+ for (dp2=dp, i=0; i < NDOSPART && ourpart == -1;
+ i++, dp2++)
+ if (letoh32(dp2->dp_size) &&
+ dp2->dp_typ == DOSPTYP_OPENBSD)
+ ourpart = i;
+ if (ourpart == -1)
+ goto donot;
+ /*
+ * This is our MBR partition. need sector
+ * address for SCSI/IDE, cylinder for
+ * ESDI/ST506/RLL
+ */
+ dp2 = &dp[ourpart];
+ dospartoff = letoh32(dp2->dp_start) + part_blkno;
+ cyl = DPCYL(dp2->dp_scyl, dp2->dp_ssect);
+
+ /* XXX build a temporary disklabel */
+ lp->d_partitions[0].p_size = letoh32(dp2->dp_size);
+ lp->d_partitions[0].p_offset =
+ letoh32(dp2->dp_start) + part_blkno;
+ if (lp->d_ntracks == 0)
+ lp->d_ntracks = dp2->dp_ehd + 1;
+ if (lp->d_nsectors == 0)
+ lp->d_nsectors = DPSECT(dp2->dp_esect);
+ if (lp->d_secpercyl == 0)
+ lp->d_secpercyl = lp->d_ntracks *
+ lp->d_nsectors;
+ }
+donot:
/*
- * Read dos partition table, follow extended partitions.
- * Map the partitions to disklabel entries i-p
+ * In case the disklabel read below fails, we want to
+ * provide a fake label in i-p.
*/
- while (wander && n < 8 && loop < 8) {
- loop++;
- wander = 0;
- if (part_blkno < extoff)
- part_blkno = extoff;
-
- /* read boot record */
- bp->b_blkno = part_blkno;
- bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
- bp->b_cylinder = part_blkno / lp->d_secpercyl;
- (*strat)(bp);
-
- /* if successful, wander through dos partition table */
- if (biowait(bp)) {
- msg = "dos partition I/O error";
- if (partoffp)
- *partoffp = -1;
- return (msg);
- }
- bcopy(bp->b_data + DOSPARTOFF, dp,
- NDOSPART * sizeof(*dp));
-
- if (ourpart == -1) {
- /* Search for our MBR partition */
- for (dp2=dp, i=0; i < NDOSPART && ourpart == -1;
- i++, dp2++)
- if (letoh32(dp2->dp_size) &&
- dp2->dp_typ == DOSPTYP_OPENBSD)
- ourpart = i;
- if (ourpart == -1)
- goto donot;
+ for (dp2=dp, i=0; i < NDOSPART && n < 8; i++, dp2++) {
+ struct partition *pp = &lp->d_partitions[8+n];
+
+ if (dp2->dp_typ == DOSPTYP_OPENBSD)
+ continue;
+ if (letoh32(dp2->dp_size) > lp->d_secperunit)
+ continue;
+ if (letoh32(dp2->dp_size))
+ pp->p_size = letoh32(dp2->dp_size);
+ if (letoh32(dp2->dp_start))
+ pp->p_offset =
+ letoh32(dp2->dp_start) + part_blkno;
+
+ switch (dp2->dp_typ) {
+ case DOSPTYP_UNUSED:
+ for (cp = (char *)dp2;
+ cp < (char *)(dp2 + 1); cp++)
+ if (*cp)
+ break;
/*
- * This is our MBR partition. need sector
- * address for SCSI/IDE, cylinder for
- * ESDI/ST506/RLL
+ * Was it all zeroes? If so, it is
+ * an unused entry that we don't
+ * want to show.
*/
- dp2 = &dp[ourpart];
- dospartoff = letoh32(dp2->dp_start) + part_blkno;
- cyl = DPCYL(dp2->dp_scyl, dp2->dp_ssect);
+ if (cp == (char *)(dp2 + 1))
+ continue;
+ lp->d_partitions[8 + n++].p_fstype =
+ FS_UNUSED;
+ break;
- /* XXX build a temporary disklabel */
- lp->d_partitions[0].p_size = letoh32(dp2->dp_size);
- lp->d_partitions[0].p_offset =
- letoh32(dp2->dp_start) + part_blkno;
- if (lp->d_ntracks == 0)
- lp->d_ntracks = dp2->dp_ehd + 1;
- if (lp->d_nsectors == 0)
- lp->d_nsectors = DPSECT(dp2->dp_esect);
- if (lp->d_secpercyl == 0)
- lp->d_secpercyl = lp->d_ntracks *
- lp->d_nsectors;
- }
-donot:
- /*
- * In case the disklabel read below fails, we want to
- * provide a fake label in i-p.
- */
- for (dp2=dp, i=0; i < NDOSPART && n < 8; i++, dp2++) {
- struct partition *pp = &lp->d_partitions[8+n];
+ case DOSPTYP_LINUX:
+ pp->p_fstype = FS_EXT2FS;
+ n++;
+ break;
- if (dp2->dp_typ == DOSPTYP_OPENBSD)
- continue;
- if (letoh32(dp2->dp_size) > lp->d_secperunit)
- continue;
- if (letoh32(dp2->dp_size))
- pp->p_size = letoh32(dp2->dp_size);
- if (letoh32(dp2->dp_start))
- pp->p_offset =
- letoh32(dp2->dp_start) + part_blkno;
-
- switch (dp2->dp_typ) {
- case DOSPTYP_UNUSED:
- for (cp = (char *)dp2;
- cp < (char *)(dp2 + 1); cp++)
- if (*cp)
- break;
- /*
- * Was it all zeroes? If so, it is
- * an unused entry that we don't
- * want to show.
- */
- if (cp == (char *)(dp2 + 1))
- continue;
- lp->d_partitions[8 + n++].p_fstype =
- FS_UNUSED;
- break;
-
- case DOSPTYP_LINUX:
- pp->p_fstype = FS_EXT2FS;
- n++;
- break;
-
- case DOSPTYP_FAT12:
- case DOSPTYP_FAT16S:
- case DOSPTYP_FAT16B:
- case DOSPTYP_FAT32:
- case DOSPTYP_FAT32L:
- case DOSPTYP_FAT16L:
- pp->p_fstype = FS_MSDOS;
- n++;
- break;
- case DOSPTYP_EXTEND:
- case DOSPTYP_EXTENDL:
- part_blkno =
- letoh32(dp2->dp_start) + extoff;
- if (!extoff) {
- extoff = letoh32(dp2->dp_start);
- part_blkno = 0;
- }
- wander = 1;
- break;
- default:
- pp->p_fstype = FS_OTHER;
- n++;
- break;
+ case DOSPTYP_FAT12:
+ case DOSPTYP_FAT16S:
+ case DOSPTYP_FAT16B:
+ case DOSPTYP_FAT32:
+ case DOSPTYP_FAT32L:
+ case DOSPTYP_FAT16L:
+ pp->p_fstype = FS_MSDOS;
+ n++;
+ break;
+ case DOSPTYP_EXTEND:
+ case DOSPTYP_EXTENDL:
+ part_blkno =
+ letoh32(dp2->dp_start) + extoff;
+ if (!extoff) {
+ extoff = letoh32(dp2->dp_start);
+ part_blkno = 0;
}
+ wander = 1;
+ break;
+ default:
+ pp->p_fstype = FS_OTHER;
+ n++;
+ break;
}
}
- lp->d_bbsize = 8192;
- lp->d_sbsize = 64*1024; /* XXX ? */
- lp->d_npartitions = n > 0 ? n + 8 : 3;
}
+ lp->d_bbsize = 8192;
+ lp->d_sbsize = 64*1024; /* XXX ? */
+ lp->d_npartitions = n > 0 ? n + 8 : 3;
/* record the OpenBSD partition's placement for the caller */
if (partoffp)
diff --git a/sys/arch/hppa64/include/disklabel.h b/sys/arch/hppa64/include/disklabel.h
index ef2437b2500..fa058bf0c5a 100644
--- a/sys/arch/hppa64/include/disklabel.h
+++ b/sys/arch/hppa64/include/disklabel.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: disklabel.h,v 1.7 2006/10/03 01:37:22 krw Exp $ */
+/* $OpenBSD: disklabel.h,v 1.8 2006/10/17 23:42:37 krw Exp $ */
/* $NetBSD: disklabel.h,v 1.1 1995/02/13 23:07:34 cgd Exp $ */
/*
@@ -179,9 +179,6 @@ struct cpu_disklabel {
int labelsector;
union {
struct {
- struct dos_partition dosparts[NDOSPART];
- } _i386;
- struct {
struct lifvol lifvol;
struct lifdir lifdir[LIF_NUMDIR];
struct hpux_label hplabel;