Now that all uses of this file use explicit encoding/decoding, remove

all the bits we do not need, and drop the attempt at "disk-image"
structure definition.

Add idempotency (sp?) #ifdef
This commit is contained in:
Poul-Henning Kamp 2003-04-21 20:40:41 +00:00
parent 6ad44047ca
commit 18fdae6bd8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=113825

View file

@ -45,8 +45,15 @@
* $FreeBSD$
*/
#ifndef _SYS_SUN_DISKLABEL_H_
#define _SYS_SUN_DISKLABEL_H_
/*
* SunOS disk label layout (only relevant portions discovered here).
* SunOS/Solaris disk label layout (partial).
*
* Suns disk label format contains a lot of historical baggage which we
* ignore entirely. The structure below contains the relevant bits and the
* _enc/_dec functions encode/decode only these fields.
*/
#define SUN_DKMAGIC 55998
@ -54,58 +61,27 @@
#define SUN_RAWPART 2
#define SUN_SIZE 512
/* 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 {
u_int32_t sdkp_cyloffset; /* starting cylinder */
u_int32_t sdkp_nsectors; /* number of sectors */
};
struct sun_disklabel { /* total size = 512 bytes */
struct sun_disklabel {
char sl_text[128];
char sl_xxx1[292];
u_int16_t sl_rpm; /* rotational speed */
u_int16_t sl_rpm; /* rotational speed */
u_int16_t sl_pcylinders; /* number of physical cyls */
u_int16_t sl_sparespercyl; /* spare sectors per cylinder */
char sl_xxx3[4];
u_int16_t sl_interleave; /* interleave factor */
u_int16_t sl_ncylinders; /* data cylinders */
u_int16_t sl_acylinders; /* alternate cylinders */
u_int16_t sl_ntracks; /* tracks per cylinder */
u_int16_t sl_nsectors; /* sectors per track */
char sl_xxx4[4];
struct sun_dkpart sl_part[SUN_NPART]; /* partition layout */
u_int16_t sl_magic; /* == SUN_DKMAGIC */
u_int16_t sl_cksum; /* xor checksum of all shorts */
};
#ifdef CTASSERT
CTASSERT(sizeof (struct sun_disklabel) == 512);
#endif
int sunlabel_dec(void const *pp, struct sun_disklabel *sl);
void sunlabel_enc(void *pp, struct sun_disklabel *sl);
#endif /* _SYS_SUN_DISKLABEL_H_ */