ccdvar.h revision 1.2 1 /* $NetBSD: ccdvar.h,v 1.2 1994/06/29 06:31:31 cgd Exp $ */
2
3 /*
4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1990 The Regents of the University of California.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. All advertising materials mentioning features or use of this software
21 * must display the following acknowledgement:
22 * This product includes software developed by the University of
23 * California, Berkeley and its contributors.
24 * 4. Neither the name of the University nor the names of its contributors
25 * may be used to endorse or promote products derived from this software
26 * without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * SUCH DAMAGE.
39 *
40 * from: Utah $Hdr: cdvar.h 1.1 90/07/09$
41 *
42 * @(#)cdvar.h 7.2 (Berkeley) 11/4/90
43 */
44
45 #define NCCDISKS 8 /* max # of component disks */
46
47 /*
48 * A concatenated disk is described at config time by this structure.
49 */
50 struct ccddevice {
51 int ccd_unit; /* logical unit of this ccd */
52 int ccd_interleave; /* interleave (DEV_BSIZE blocks) */
53 int ccd_flags; /* misc. information */
54 int ccd_dk; /* disk number */
55 dev_t ccd_dev[NCCDISKS]; /* component devices */
56 };
57
58 /* ccd_flags */
59 #define CDF_SWAP 0x01 /* interleave should be dmmax */
60 #define CDF_UNIFORM 0x02 /* use LCD of sizes for uniform interleave */
61
62 /*
63 * Component info table.
64 * Describes a single component of a concatenated disk.
65 */
66 struct ccdcinfo {
67 dev_t ci_dev; /* devno */
68 size_t ci_size; /* size */
69 };
70
71 /*
72 * Interleave description table.
73 * Computed at boot time to speed irregular-interleave lookups.
74 * The idea is that we interleave in "groups". First we interleave
75 * evenly over all component disks up to the size of the smallest
76 * component (the first group), then we interleave evenly over all
77 * remaining disks up to the size of the next-smallest (second group),
78 * and so on.
79 *
80 * Each table entry describes the interleave characteristics of one
81 * of these groups. For example if a concatenated disk consisted of
82 * three components of 5, 3, and 7 DEV_BSIZE blocks interleaved at
83 * DEV_BSIZE (1), the table would have three entries:
84 *
85 * ndisk startblk startoff dev
86 * 3 0 0 0, 1, 2
87 * 2 9 3 0, 2
88 * 1 13 5 2
89 * 0 - - -
90 *
91 * which says that the first nine blocks (0-8) are interleaved over
92 * 3 disks (0, 1, 2) starting at block offset 0 on any component disk,
93 * the next 4 blocks (9-12) are interleaved over 2 disks (0, 2) starting
94 * at component block 3, and the remaining blocks (13-14) are on disk
95 * 2 starting at offset 5.
96 */
97 struct ccdiinfo {
98 int ii_ndisk; /* # of disks range is interleaved over */
99 daddr_t ii_startblk; /* starting scaled block # for range */
100 daddr_t ii_startoff; /* starting component offset (block #) */
101 char ii_index[NCCDISKS];/* ordered list of components in range */
102 };
103
104 #ifdef KERNEL
105 extern struct ccddevice ccddevice[];
106 #endif
107