diff options
author | Marc Aurele La France <tsi@cvs.openbsd.org> | 2007-09-19 23:47:51 +0000 |
---|---|---|
committer | Marc Aurele La France <tsi@cvs.openbsd.org> | 2007-09-19 23:47:51 +0000 |
commit | a707b36c0d40dd8a7a80672030e1f8a5e0016778 (patch) | |
tree | 9a28f4c790692a302cd77056bdae24d10ea791bf /sys/arch/sparc64 | |
parent | 9b25d264b12c1dae43c84ade0563d93fee3f2e14 (diff) |
On sparc & sparc64, change `mount -a` to recognise Linux ext2 partitions
by interpreting more fields out of a standard Sun disk label.
ok krw@
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r-- | sys/arch/sparc64/sparc64/disksubr.c | 59 |
1 files changed, 57 insertions, 2 deletions
diff --git a/sys/arch/sparc64/sparc64/disksubr.c b/sys/arch/sparc64/sparc64/disksubr.c index fbae3ef8a45..7addd06835e 100644 --- a/sys/arch/sparc64/sparc64/disksubr.c +++ b/sys/arch/sparc64/sparc64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.46 2007/06/20 18:15:46 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.47 2007/09/19 23:47:50 tsi Exp $ */ /* $NetBSD: disksubr.c,v 1.13 2000/12/17 22:39:18 pk Exp $ */ /* @@ -231,6 +231,7 @@ disklabel_sun_to_bsd(struct sun_disklabel *sl, struct disklabel *lp) { struct partition *npp; struct sun_dkpart *spp; + struct sun_partinfo *ppp; int i, secpercyl; u_short cksum = 0, *sp1, *sp2; @@ -327,13 +328,67 @@ disklabel_sun_to_bsd(struct sun_disklabel *sl, struct disklabel *lp) npp->p_cpg = 16; } } - if (sl->sl_xpmag == SL_XPMAGTYP) + if (sl->sl_xpmag == SL_XPMAGTYP) { for (i = 0; i < MAXPARTITIONS; i++) { npp = &lp->d_partitions[i]; npp->p_fstype = sl->sl_types[i]; npp->p_fragblock = sl->sl_fragblock[i]; npp->p_cpg = sl->sl_cpg[i]; } + } + } else if (sl->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 = 8; + break; + } + } + + while (i-- > 0) { + npp = &lp->d_partitions[i]; + if (npp->p_size == 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: + case SPTAG_SUNOS_HOME: + npp->p_fstype = FS_BSDFFS; + npp->p_fragblock = + DISKLABELV1_FFS_FRAGBLOCK(2048, 8); + npp->p_cpg = 16; + break; + case SPTAG_LINUX_EXT2: + npp->p_fstype = FS_EXT2FS; + break; + default: + npp->p_fstype = FS_UNUSED; + break; + } + } } lp->d_checksum = 0; |