diff options
author | 2007-05-31 00:30:08 +0000 | |
---|---|---|
committer | 2007-05-31 00:30:08 +0000 | |
commit | 346fa1630badbf95a4ef1f5f7aca4e6592e5b0eb (patch) | |
tree | f39cbbb84a0996e1c1dab9865158f42727863562 | |
parent | Add support for iBook G4. -moj (diff) | |
download | wireguard-openbsd-346fa1630badbf95a4ef1f5f7aca4e6592e5b0eb.tar.xz wireguard-openbsd-346fa1630badbf95a4ef1f5f7aca4e6592e5b0eb.zip |
extend the sun disklabel format to contain filesystem types. also,
store the information fsck needs. this allows us to create raid
partitions, nicely, of course.
ok miod todd krw
-rw-r--r-- | sys/arch/sparc/sparc/disksubr.c | 20 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/disksubr.c | 20 | ||||
-rw-r--r-- | sys/dev/sun/disklabel.h | 54 |
3 files changed, 49 insertions, 45 deletions
diff --git a/sys/arch/sparc/sparc/disksubr.c b/sys/arch/sparc/sparc/disksubr.c index c8394812869..1af6c1b0340 100644 --- a/sys/arch/sparc/sparc/disksubr.c +++ b/sys/arch/sparc/sparc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.44 2007/05/29 06:28:15 otto Exp $ */ +/* $OpenBSD: disksubr.c,v 1.45 2007/05/31 00:30:08 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */ /* @@ -424,6 +424,7 @@ disklabel_sun_to_bsd(cp, lp) secpercyl = sl->sl_nsectors * sl->sl_ntracks; lp->d_secpercyl = secpercyl; lp->d_secperunit = secpercyl * sl->sl_ncylinders; + lp->d_version = 1; /* 48 bit addressing */ lp->d_sparespercyl = sl->sl_sparespercyl; lp->d_acylinders = sl->sl_acylinders; @@ -465,7 +466,7 @@ disklabel_sun_to_bsd(cp, lp) } /* Check to see if there's an "extended" partition table */ - if (sl->sl_xpmag == SL_XPMAG && + if ((sl->sl_xpmag == SL_XPMAG || sl->sl_xpmag == SL_XPMAGTYP) && sun_extended_sum(sl) == sl->sl_xpsum) { /* ...yes! */ /* * There is. Copy over the "extended" partitions. @@ -487,6 +488,13 @@ disklabel_sun_to_bsd(cp, lp) npp->p_cpg = 16; } } + 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]; + } } lp->d_checksum = 0; @@ -554,7 +562,7 @@ disklabel_bsd_to_sun(lp, cp) } /* We do need to load the extended table? */ if (i < SUNXPART) { - sl->sl_xpmag = SL_XPMAG; + sl->sl_xpmag = SL_XPMAGTYP; for (i = 0; i < SUNXPART; i++) { spp = &sl->sl_xpart[i]; npp = &lp->d_partitions[i+8]; @@ -564,6 +572,12 @@ disklabel_bsd_to_sun(lp, cp) npp->p_offset / secpercyl; sl->sl_xpart[i].sdkp_nsectors = npp->p_size; } + for (i = 0; i < MAXPARTITIONS; i++) { + npp = &lp->d_partitions[i]; + sl->sl_types[i] = npp->p_fstype; + sl->sl_fragblock[i] = npp->p_fragblock; + sl->sl_cpg[i] = npp->p_cpg; + } sl->sl_xpsum = sun_extended_sum(sl); } else { sl->sl_xpmag = 0; diff --git a/sys/arch/sparc64/sparc64/disksubr.c b/sys/arch/sparc64/sparc64/disksubr.c index 58681d551d4..0be5c0a7429 100644 --- a/sys/arch/sparc64/sparc64/disksubr.c +++ b/sys/arch/sparc64/sparc64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.23 2007/05/29 06:56:30 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.24 2007/05/31 00:30:10 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.13 2000/12/17 22:39:18 pk Exp $ */ /* @@ -421,6 +421,7 @@ disklabel_sun_to_bsd(cp, lp) secpercyl = sl->sl_nsectors * sl->sl_ntracks; lp->d_secpercyl = secpercyl; lp->d_secperunit = secpercyl * sl->sl_ncylinders; + lp->d_version = 1; /* 48 bit addressing */ lp->d_sparespercyl = sl->sl_sparespercyl; lp->d_acylinders = sl->sl_acylinders; @@ -462,7 +463,7 @@ disklabel_sun_to_bsd(cp, lp) } /* Check to see if there's an "extended" partition table */ - if (sl->sl_xpmag == SL_XPMAG && + if ((sl->sl_xpmag == SL_XPMAG || sl->sl_xpmag == SL_XPMAGTYP) && sun_extended_sum(sl) == sl->sl_xpsum) { /* ...yes! */ /* * There is. Copy over the "extended" partitions. @@ -484,6 +485,13 @@ disklabel_sun_to_bsd(cp, lp) npp->p_cpg = 16; } } + 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]; + } } lp->d_checksum = 0; @@ -551,7 +559,7 @@ disklabel_bsd_to_sun(lp, cp) } /* We do need to load the extended table? */ if (i < SUNXPART) { - sl->sl_xpmag = SL_XPMAG; + sl->sl_xpmag = SL_XPMAGTYP; for (i = 0; i < SUNXPART; i++) { spp = &sl->sl_xpart[i]; npp = &lp->d_partitions[i+8]; @@ -561,6 +569,12 @@ disklabel_bsd_to_sun(lp, cp) npp->p_offset / secpercyl; sl->sl_xpart[i].sdkp_nsectors = npp->p_size; } + for (i = 0; i < MAXPARTITIONS; i++) { + npp = &lp->d_partitions[i]; + sl->sl_types[i] = npp->p_fstype; + sl->sl_fragblock[i] = npp->p_fragblock; + sl->sl_cpg[i] = npp->p_cpg; + } sl->sl_xpsum = sun_extended_sum(sl); } else { sl->sl_xpmag = 0; diff --git a/sys/dev/sun/disklabel.h b/sys/dev/sun/disklabel.h index 1b5366ec9c7..79baa56a232 100644 --- a/sys/dev/sun/disklabel.h +++ b/sys/dev/sun/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.3 2003/06/02 23:28:04 millert Exp $ */ +/* $OpenBSD: disklabel.h,v 1.4 2007/05/31 00:30:10 deraadt Exp $ */ /* $NetBSD: disklabel.h,v 1.2 1998/08/22 14:55:28 mrg Exp $ */ /* @@ -47,51 +47,29 @@ #define SUN_DKMAGIC 55998 -/* These are the guys that Sun's dkinfo needs... */ -#define DKIOCGGEOM _IOR('d', 2, struct sun_dkgeom) /* geometry info */ -#define DKIOCINFO _IOR('d', 8, struct sun_dkctlr) /* controller info */ -#define DKIOCGPART _IOR('d', 4, struct sun_dkpart) /* partition info */ - -/* geometry info */ -struct sun_dkgeom { - u_short sdkc_ncylinders; /* data cylinders */ - u_short sdkc_acylinders; /* alternate cylinders */ - u_short sdkc_xxx1; - u_short sdkc_ntracks; /* tracks per cylinder */ - u_short sdkc_xxx2; - u_short sdkc_nsectors; /* sectors per track */ - u_short sdkc_interleave; /* interleave factor */ - u_short sdkc_xxx3; - u_short sdkc_xxx4; - u_short sdkc_sparespercyl; /* spare sectors per cylinder */ - u_short sdkc_rpm; /* rotational speed */ - u_short sdkc_pcylinders; /* physical cylinders */ - u_short sdkc_xxx5[7]; -}; - -/* controller info */ -struct sun_dkctlr { - int sdkc_addr; /* controller address */ - short sdkc_unit; /* unit (slave) address */ - short sdkc_type; /* controller type */ - short sdkc_flags; /* flags */ -}; - /* partition info */ struct sun_dkpart { int sdkp_cyloffset; /* starting cylinder */ int sdkp_nsectors; /* number of sectors */ }; -#define SUNXPART 8 -#define SL_XPMAG (0x199d1fe2+SUNXPART) +#define SUNXPART 8 +#define SL_XPMAG (0x199d1fe2+SUNXPART) +#define SL_XPMAGTYP (0x199d1fe2+SUNXPART+1) /* contains types */ struct sun_disklabel { /* total size = 512 bytes */ - char sl_text[128]; - u_int sl_xpsum; /* additive cksum, [xl_xpmag,sl_xx1) */ - u_int sl_xpmag; /* "extended" magic number */ + char sl_text[128]; + u_int sl_xpsum; /* additive cksum, [xl_xpmag,sl_xx1) */ + u_int sl_xpmag; /* "extended" magic number */ struct sun_dkpart sl_xpart[SUNXPART]; /* "extended" partitions, i through p */ - char sl_xxx1[292-8-(8*SUNXPART)]; /* [292] include sl_x* */ + u_char sl_types[MAXPARTITIONS]; + u_int8_t sl_fragblock[MAXPARTITIONS]; + u_int16_t sl_cpg[MAXPARTITIONS]; + char sl_xxx1[292 - sizeof(u_int) - sizeof(u_int) - + (sizeof(struct sun_dkpart) * SUNXPART) - + sizeof(u_char) * MAXPARTITIONS - + sizeof(u_int8_t) * MAXPARTITIONS - + sizeof(u_int16_t) * MAXPARTITIONS]; u_short sl_rpm; /* rotational speed */ u_short sl_pcylinders; /* number of physical cyls */ #define sl_pcyl sl_pcylinders /* XXX: old sun3 */ @@ -107,5 +85,3 @@ struct sun_disklabel { /* total size = 512 bytes */ u_short sl_magic; /* == SUN_DKMAGIC */ u_short sl_cksum; /* xor checksum of all shorts */ }; - -#define SUN_LABELOFFSET 128 /* XXX we don't use this */ |