diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-10-02 03:27:00 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-10-02 03:27:00 +0000 |
commit | 9482a3e5e3076e73812a2814ddade34ebfe620f1 (patch) | |
tree | f3379fa4e6ca8e6ab2279c9b7e694fb4bce41ef4 /sys/arch/sparc | |
parent | fcfb7cb8255b0a7271e581314b67d6479d83ad7c (diff) |
Fiddle Sun traditional disklabel recognition to eliminate union and
associated field access defines. This reverts most changes to
dev/sun/disklabel.h without eliminating new functionality. Fix
comments to line up and fit on 80 column line, making both tsi@ and I
feel better.
Simplify logic in disksubr.c. No semantic change.
Tested & ok tsi@.
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r-- | sys/arch/sparc/sparc/disksubr.c | 46 |
1 files changed, 15 insertions, 31 deletions
diff --git a/sys/arch/sparc/sparc/disksubr.c b/sys/arch/sparc/sparc/disksubr.c index 995aeeadd79..10c56e999c1 100644 --- a/sys/arch/sparc/sparc/disksubr.c +++ b/sys/arch/sparc/sparc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.71 2007/09/19 23:47:50 tsi Exp $ */ +/* $OpenBSD: disksubr.c,v 1.72 2007/10/02 03:26:59 krw Exp $ */ /* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */ /* @@ -236,11 +236,12 @@ sun_extended_sum(struct sun_disklabel *sl, void *end) char * disklabel_sun_to_bsd(struct sun_disklabel *sl, struct disklabel *lp) { - struct partition *npp; - struct sun_dkpart *spp; + struct sun_preamble *preamble = (struct sun_preamble *)sl; struct sun_partinfo *ppp; - int i, secpercyl; + struct sun_dkpart *spp; + struct partition *npp; u_short cksum = 0, *sp1, *sp2; + int i, secpercyl; /* Verify the XOR check. */ sp1 = (u_short *)sl; @@ -343,42 +344,24 @@ disklabel_sun_to_bsd(struct sun_disklabel *sl, struct disklabel *lp) npp->p_cpg = sl->sl_cpg[i]; } } - } else if (sl->sl_nparts <= 8) { + } else if (preamble->sl_nparts <= 8) { /* * A more traditional Sun label. Recognise certain filesystem * types from it, if they are available. */ - if ((i = sl->sl_nparts) == 0) { - for (i = 8; i-- > 0; ) { - npp = &lp->d_partitions[i]; - if (npp->p_size == 0) - continue; - - ppp = &sl->sl_ipart[i]; - if ((ppp->spi_tag == 0) && (ppp->spi_flag == 0)) - continue; + i = preamble->sl_nparts; + if (i == 0) + i = 8; - i = 8; - break; - } - } - - while (i-- > 0) { - npp = &lp->d_partitions[i]; + npp = &lp->d_partitions[i-1]; + ppp = &preamble->sl_part[i-1]; + for (; i > 0; i--, npp--, ppp--) { if (npp->p_size == 0) continue; + if ((ppp->spi_tag == 0) && (ppp->spi_flag == 0)) + continue; - ppp = &sl->sl_ipart[i]; switch (ppp->spi_tag) { - case SPTAG_EMPTY: - case SPTAG_BOOT: - case SPTAG_WHOLE_DISK: - npp->p_fstype = FS_UNUSED; - break; - case SPTAG_SUNOS_SWAP: - case SPTAG_LINUX_SWAP: - npp->p_fstype = FS_UNUSED; /* FS_SWAP? */ - break; case SPTAG_SUNOS_ROOT: case SPTAG_SUNOS_USR: case SPTAG_SUNOS_VAR: @@ -392,6 +375,7 @@ disklabel_sun_to_bsd(struct sun_disklabel *sl, struct disklabel *lp) npp->p_fstype = FS_EXT2FS; break; default: + /* FS_SWAP for _SUNOS_SWAP and _LINUX_SWAP? */ npp->p_fstype = FS_UNUSED; break; } |