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