1 /*
2  * Copyright (c) 1992, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This software was developed by the Computer Systems Engineering group
6  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
7  * contributed to Berkeley.
8  *
9  * All advertising materials mentioning features or use of this software
10  * must display the following acknowledgement:
11  *	This product includes software developed by the University of
12  *	California, Lawrence Berkeley Laboratory.
13  *
14  * %sccs.include.redist.c%
15  *
16  *	@(#)sun_disklabel.h	8.1 (Berkeley) 06/11/93
17  *
18  * from: $Header: sun_disklabel.h,v 1.4 92/06/17 07:04:13 torek Exp $
19  */
20 
21 /*
22  * SunOS disk label layout (only relevant portions discovered here).
23  */
24 
25 #define	SUN_DKMAGIC	55998
26 
27 /* These are the guys that Sun's dkinfo needs... */
28 #define DKIOCGGEOM	_IOR('d', 2, struct sun_dkgeom)	/* geometry info */
29 #define DKIOCINFO	_IOR('d', 8, struct sun_dkctlr)	/* controller info */
30 #define DKIOCGPART	_IOR('d', 4, struct sun_dkpart)	/* partition info */
31 
32 /* geometry info */
33 struct sun_dkgeom {
34 	u_short	sdkc_ncylinders;	/* data cylinders */
35 	u_short	sdkc_acylinders;	/* alternate cylinders */
36 	u_short	sdkc_xxx1;
37 	u_short	sdkc_ntracks;		/* tracks per cylinder */
38 	u_short	sdkc_xxx2;
39 	u_short	sdkc_nsectors;		/* sectors per track */
40 	u_short	sdkc_interleave;	/* interleave factor */
41 	u_short	sdkc_xxx3;
42 	u_short	sdkc_xxx4;
43 	u_short	sdkc_sparespercyl;	/* spare sectors per cylinder */
44 	u_short	sdkc_rpm;		/* rotational speed */
45 	u_short	sdkc_pcylinders;	/* physical cylinders */
46 	u_short	sdkc_xxx5[7];
47 };
48 
49 /* controller info */
50 struct sun_dkctlr {
51 	int	sdkc_addr;		/* controller address */
52 	short	sdkc_unit;		/* unit (slave) address */
53 	short	sdkc_type;		/* controller type */
54 	short	sdkc_flags;		/* flags */
55 };
56 
57 /* partition info */
58 struct sun_dkpart {
59 	long	sdkp_cyloffset;		/* starting cylinder */
60 	long	sdkp_nsectors;		/* number of sectors */
61 };
62 
63 struct sun_disklabel {			/* total size = 512 bytes */
64 	char	sl_text[128];
65 	char	sl_xxx1[292];
66 	u_short sl_rpm;			/* rotational speed */
67 	char	sl_xxx2[2];
68 	u_short sl_sparespercyl;	/* spare sectors per cylinder */
69 	char	sl_xxx3[4];
70 	u_short sl_interleave;		/* interleave factor */
71 	u_short	sl_ncylinders;		/* data cylinders */
72 	u_short	sl_acylinders;		/* alternate cylinders */
73 	u_short	sl_ntracks;		/* tracks per cylinder */
74 	u_short	sl_nsectors;		/* sectors per track */
75 	char	sl_xxx4[4];
76 	struct sun_dkpart sl_part[8];	/* partition layout */
77 	u_short	sl_magic;		/* == SUN_DKMAGIC */
78 	u_short	sl_cksum;		/* xor checksum of all shorts */
79 };
80 
81 #ifdef KERNEL
82 /* reads sun label in sector at [cp..cp+511] and sets *lp to BSD label */
83 int	sun_disklabel __P((caddr_t, struct disklabel *)); /* true on success */
84 
85 /* compatability dk ioctl's */
86 int	sun_dkioctl __P((struct dkdevice *, int, caddr_t, int));
87 #endif
88