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