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