xref: /original-bsd/sys/dev/cdvar.h (revision a95f03a8)
1 /*
2  * Copyright (c) 1988 University of Utah.
3  * Copyright (c) 1990 The Regents of the University of California.
4  * All rights reserved.
5  *
6  * This code is derived from software contributed to Berkeley by
7  * the Systems Programming Group of the University of Utah Computer
8  * Science Department.
9  *
10  * %sccs.include.redist.c%
11  *
12  * from: Utah $Hdr: cdvar.h 1.1 90/07/09$
13  *
14  *	@(#)cdvar.h	7.2 (Berkeley) 11/04/90
15  */
16 
17 #define	NCDISKS	8			/* max # of component disks */
18 
19 /*
20  * A concatenated disk is described at config time by this structure.
21  */
22 struct cddevice {
23 	int	cd_unit;		/* logical unit of this cd */
24 	int	cd_interleave;		/* interleave (DEV_BSIZE blocks) */
25 	int	cd_flags;		/* misc. information */
26 	int	cd_dk;			/* disk number */
27 	dev_t	cd_dev[NCDISKS];	/* component devices */
28 };
29 
30 /* cd_flags */
31 #define	CDF_SWAP	0x01	/* interleave should be dmmax */
32 #define CDF_UNIFORM	0x02	/* use LCD of sizes for uniform interleave */
33 
34 /*
35  * Component info table.
36  * Describes a single component of a concatenated disk.
37  */
38 struct cdcinfo {
39 	dev_t		ci_dev;	 /* devno */
40 	size_t		ci_size; /* size */
41 };
42 
43 /*
44  * Interleave description table.
45  * Computed at boot time to speed irregular-interleave lookups.
46  * The idea is that we interleave in "groups".  First we interleave
47  * evenly over all component disks up to the size of the smallest
48  * component (the first group), then we interleave evenly over all
49  * remaining disks up to the size of the next-smallest (second group),
50  * and so on.
51  *
52  * Each table entry describes the interleave characteristics of one
53  * of these groups.  For example if a concatenated disk consisted of
54  * three components of 5, 3, and 7 DEV_BSIZE blocks interleaved at
55  * DEV_BSIZE (1), the table would have three entries:
56  *
57  *	ndisk	startblk	startoff	dev
58  *	3	0		0		0, 1, 2
59  *	2	9		3		0, 2
60  *	1	13		5		2
61  *	0	-		-		-
62  *
63  * which says that the first nine blocks (0-8) are interleaved over
64  * 3 disks (0, 1, 2) starting at block offset 0 on any component disk,
65  * the next 4 blocks (9-12) are interleaved over 2 disks (0, 2) starting
66  * at component block 3, and the remaining blocks (13-14) are on disk
67  * 2 starting at offset 5.
68  */
69 struct cdiinfo {
70 	int	ii_ndisk;	/* # of disks range is interleaved over */
71 	daddr_t	ii_startblk;	/* starting scaled block # for range */
72 	daddr_t	ii_startoff;	/* starting component offset (block #) */
73 	char	ii_index[NCDISKS];/* ordered list of components in range */
74 };
75 
76 #ifdef KERNEL
77 extern	struct cddevice cddevice[];
78 #endif
79