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/dev/sun | |
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/dev/sun')
-rw-r--r-- | sys/dev/sun/disklabel.h | 91 |
1 files changed, 76 insertions, 15 deletions
diff --git a/sys/dev/sun/disklabel.h b/sys/dev/sun/disklabel.h index 79baa56a232..947719cd15a 100644 --- a/sys/dev/sun/disklabel.h +++ b/sys/dev/sun/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.4 2007/05/31 00:30:10 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.5 2007/09/19 23:47:50 tsi Exp $ */ /* $NetBSD: disklabel.h,v 1.2 1998/08/22 14:55:28 mrg Exp $ */ /* @@ -43,36 +43,97 @@ /* * SunOS disk label layout (only relevant portions discovered here). + * This describes the format typically found on SPARC systems, but not + * that usually seen on SunOS/x86 and SunOS/amd64 systems. */ #define SUN_DKMAGIC 55998 /* partition info */ struct sun_dkpart { - int sdkp_cyloffset; /* starting cylinder */ - int sdkp_nsectors; /* number of sectors */ + u_int sdkp_cyloffset; /* starting cylinder */ + u_int sdkp_nsectors; /* number of sectors */ }; +/* partition types */ +struct sun_partinfo { + u_short spi_tag; /* filesystem type */ + u_short spi_flag; /* flags */ +}; + +/* some spi_tag values */ +#define SPTAG_EMPTY 0x00 +#define SPTAG_BOOT 0x01 +#define SPTAG_SUNOS_ROOT 0x02 +#define SPTAG_SUNOS_SWAP 0x03 +#define SPTAG_SUNOS_USR 0x04 +#define SPTAG_WHOLE_DISK 0x05 +#define SPTAG_SUNOS_STAND 0x06 +#define SPTAG_SUNOS_VAR 0x07 +#define SPTAG_SUNOS_HOME 0x08 +#define SPTAG_LINUX_SWAP 0x82 +#define SPTAG_LINUX_EXT2 0x83 + #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 */ - struct sun_dkpart sl_xpart[SUNXPART]; /* "extended" partitions, i through p */ - 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]; + union { + /* Sun standard fields, also used on Linux */ + struct { + /* label version */ + u_int sli_version; + /* short volume name */ + char sli_volume[8]; + /* partition count */ + u_short sli_nparts; + struct sun_partinfo sli_part[8]; + char sli_xxx1[292 - sizeof(u_int) - + (sizeof(char) * 8) - sizeof(u_short) - + (sizeof(struct sun_partinfo) * 8)]; + } i; + /* BSD-specific extensions */ + struct { + /* additive cksum, [xl_xpmag,sl_xx1) */ + u_int slx_xpsum; + /* "extended" magic number */ + u_int slx_xpmag; + /* "extended" partitions, i through p */ + struct sun_dkpart slx_xpart[SUNXPART]; + u_char slx_types[MAXPARTITIONS]; + u_int8_t slx_fragblock[MAXPARTITIONS]; + u_int16_t slx_cpg[MAXPARTITIONS]; + char slx_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)]; + } x; + } u; +/* Compatibility */ +#define sl_xpsum u.x.slx_xpsum +#define sl_xpmag u.x.slx_xpmag +#define sl_xpart u.x.slx_xpart +#define sl_types u.x.slx_types +#define sl_fragblock u.x.slx_fragblock +#define sl_cpg u.x.slx_cpg +#define sl_xxx1 u.x.slx_xxx1 +/* Convenience */ +#define sl_version u.i.sli_version +#define sl_volume u.i.sli_volume +#define sl_nparts u.i.sli_nparts +#define sl_ipart u.i.sli_part +#define sl_xxx1i u.i.sli_xxx1 u_short sl_rpm; /* rotational speed */ u_short sl_pcylinders; /* number of physical cyls */ -#define sl_pcyl sl_pcylinders /* XXX: old sun3 */ +#define sl_pcyl sl_pcylinders /* XXX: old sun3 */ u_short sl_sparespercyl; /* spare sectors per cylinder */ char sl_xxx3[4]; u_short sl_interleave; /* interleave factor */ |