2008-04-29 00:22:51 +04:00
|
|
|
/* $NetBSD: ccdvar.h,v 1.30 2008/04/28 20:23:46 martin Exp $ */
|
1995-08-17 20:31:30 +04:00
|
|
|
|
1996-02-28 04:01:17 +03:00
|
|
|
/*-
|
2007-02-15 18:40:50 +03:00
|
|
|
* Copyright (c) 1996, 1997, 1998, 1999, 2007 The NetBSD Foundation, Inc.
|
1995-08-17 20:31:30 +04:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
1996-02-28 04:01:17 +03:00
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Jason R. Thorpe.
|
|
|
|
*
|
1995-08-17 20:31:30 +04:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
1996-02-28 04:01:17 +03:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
1997-10-09 12:03:42 +04:00
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
1996-02-28 04:01:17 +03:00
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
1995-08-17 20:31:30 +04:00
|
|
|
*/
|
1994-06-29 10:29:24 +04:00
|
|
|
|
1994-06-24 18:11:02 +04:00
|
|
|
/*
|
1994-07-02 10:03:47 +04:00
|
|
|
* Copyright (c) 1990, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
1994-06-24 18:11:02 +04:00
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
2003-08-07 20:26:28 +04:00
|
|
|
* the Systems Programming Group of the University of Utah Computer
|
|
|
|
* Science Department.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* from: Utah $Hdr: cdvar.h 1.1 90/07/09$
|
|
|
|
*
|
|
|
|
* @(#)cdvar.h 8.1 (Berkeley) 6/10/93
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1988 University of Utah.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
1994-06-24 18:11:02 +04:00
|
|
|
* the Systems Programming Group of the University of Utah Computer
|
|
|
|
* Science Department.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1994-06-29 10:29:24 +04:00
|
|
|
* from: Utah $Hdr: cdvar.h 1.1 90/07/09$
|
|
|
|
*
|
1994-07-02 10:03:47 +04:00
|
|
|
* @(#)cdvar.h 8.1 (Berkeley) 6/10/93
|
1994-06-24 18:11:02 +04:00
|
|
|
*/
|
|
|
|
|
2004-08-23 08:30:28 +04:00
|
|
|
#ifndef _DEV_CCDVAR_H_
|
|
|
|
#define _DEV_CCDVAR_H_
|
|
|
|
|
2003-05-18 01:42:08 +04:00
|
|
|
#include <sys/buf.h>
|
2007-02-15 18:40:50 +03:00
|
|
|
#include <sys/mutex.h>
|
1997-01-30 07:00:52 +03:00
|
|
|
#include <sys/queue.h>
|
|
|
|
|
1995-08-17 20:31:30 +04:00
|
|
|
/*
|
|
|
|
* Dynamic configuration and disklabel support by:
|
|
|
|
* Jason R. Thorpe <thorpej@nas.nasa.gov>
|
|
|
|
* Numerical Aerodynamic Simulation Facility
|
|
|
|
* Mail Stop 258-6
|
|
|
|
* NASA Ames Research Center
|
|
|
|
* Moffett Field, CA 94035
|
|
|
|
*/
|
1994-06-24 18:11:02 +04:00
|
|
|
|
1995-08-17 20:31:30 +04:00
|
|
|
/*
|
|
|
|
* This structure is used to configure a ccd via ioctl(2).
|
|
|
|
*/
|
|
|
|
struct ccd_ioctl {
|
|
|
|
char **ccio_disks; /* pointer to component paths */
|
2001-08-05 15:20:13 +04:00
|
|
|
u_int ccio_ndisks; /* number of disks to concatenate */
|
1995-08-17 20:31:30 +04:00
|
|
|
int ccio_ileave; /* interleave (DEV_BSIZE blocks) */
|
1999-01-12 03:21:47 +03:00
|
|
|
int ccio_flags; /* see sc_flags below */
|
1995-08-17 20:31:30 +04:00
|
|
|
int ccio_unit; /* unit number: use varies */
|
|
|
|
size_t ccio_size; /* (returned) size of ccd */
|
1994-06-24 18:11:02 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Component info table.
|
|
|
|
* Describes a single component of a concatenated disk.
|
|
|
|
*/
|
|
|
|
struct ccdcinfo {
|
1995-08-17 20:31:30 +04:00
|
|
|
struct vnode *ci_vp; /* device's vnode */
|
|
|
|
dev_t ci_dev; /* XXX: device's dev_t */
|
|
|
|
size_t ci_size; /* size */
|
|
|
|
char *ci_path; /* path to component */
|
|
|
|
size_t ci_pathlen; /* length of component path */
|
1994-06-24 18:11:02 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Interleave description table.
|
|
|
|
* Computed at boot time to speed irregular-interleave lookups.
|
|
|
|
* The idea is that we interleave in "groups". First we interleave
|
|
|
|
* evenly over all component disks up to the size of the smallest
|
|
|
|
* component (the first group), then we interleave evenly over all
|
|
|
|
* remaining disks up to the size of the next-smallest (second group),
|
|
|
|
* and so on.
|
|
|
|
*
|
|
|
|
* Each table entry describes the interleave characteristics of one
|
|
|
|
* of these groups. For example if a concatenated disk consisted of
|
|
|
|
* three components of 5, 3, and 7 DEV_BSIZE blocks interleaved at
|
|
|
|
* DEV_BSIZE (1), the table would have three entries:
|
|
|
|
*
|
|
|
|
* ndisk startblk startoff dev
|
|
|
|
* 3 0 0 0, 1, 2
|
|
|
|
* 2 9 3 0, 2
|
|
|
|
* 1 13 5 2
|
|
|
|
* 0 - - -
|
|
|
|
*
|
|
|
|
* which says that the first nine blocks (0-8) are interleaved over
|
|
|
|
* 3 disks (0, 1, 2) starting at block offset 0 on any component disk,
|
|
|
|
* the next 4 blocks (9-12) are interleaved over 2 disks (0, 2) starting
|
|
|
|
* at component block 3, and the remaining blocks (13-14) are on disk
|
|
|
|
* 2 starting at offset 5.
|
|
|
|
*/
|
|
|
|
struct ccdiinfo {
|
|
|
|
int ii_ndisk; /* # of disks range is interleaved over */
|
|
|
|
daddr_t ii_startblk; /* starting scaled block # for range */
|
|
|
|
daddr_t ii_startoff; /* starting component offset (block #) */
|
1995-10-13 00:28:32 +03:00
|
|
|
int *ii_index; /* ordered list of components in range */
|
1994-06-24 18:11:02 +04:00
|
|
|
};
|
|
|
|
|
1995-08-17 20:31:30 +04:00
|
|
|
/*
|
|
|
|
* Concatenated disk pseudo-geometry information.
|
|
|
|
*/
|
|
|
|
struct ccdgeom {
|
|
|
|
u_int32_t ccg_secsize; /* # bytes per sector */
|
|
|
|
u_int32_t ccg_nsectors; /* # data sectors per track */
|
|
|
|
u_int32_t ccg_ntracks; /* # tracks per cylinder */
|
|
|
|
u_int32_t ccg_ncylinders; /* # cylinders per unit */
|
|
|
|
};
|
|
|
|
|
1997-01-30 07:00:52 +03:00
|
|
|
struct ccdbuf;
|
|
|
|
|
1995-08-17 20:31:30 +04:00
|
|
|
/*
|
|
|
|
* A concatenated disk is described after initialization by this structure.
|
|
|
|
*/
|
|
|
|
struct ccd_softc {
|
|
|
|
int sc_flags; /* flags */
|
|
|
|
size_t sc_size; /* size of ccd */
|
|
|
|
int sc_ileave; /* interleave */
|
2001-08-05 15:20:13 +04:00
|
|
|
u_int sc_nccdisks; /* number of components */
|
|
|
|
#define CCD_MAXNDISKS 65536
|
1995-08-17 20:31:30 +04:00
|
|
|
struct ccdcinfo *sc_cinfo; /* component info */
|
|
|
|
struct ccdiinfo *sc_itable; /* interleave table */
|
|
|
|
struct ccdgeom sc_geom; /* pseudo geometry info */
|
1996-01-08 01:01:38 +03:00
|
|
|
char sc_xname[8]; /* XXX external name */
|
|
|
|
struct disk sc_dkdev; /* generic disk device info */
|
2007-02-15 18:40:50 +03:00
|
|
|
kmutex_t sc_lock; /* lock on this structure */
|
2004-10-28 10:59:18 +04:00
|
|
|
#if defined(_KERNEL) /* XXX ccdconfig(8) refers softc directly using kvm */
|
2005-10-15 21:29:10 +04:00
|
|
|
struct bufq_state *sc_bufq; /* buffer queue */
|
2004-10-28 10:59:18 +04:00
|
|
|
#endif
|
1995-08-17 20:31:30 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/* sc_flags */
|
2003-05-17 20:11:52 +04:00
|
|
|
#define CCDF_UNIFORM 0x002 /* use LCCD of sizes for uniform interleave */
|
2003-10-17 09:16:15 +04:00
|
|
|
#define CCDF_NOLABEL 0x004 /* ignore on-disk (raw) disklabel */
|
|
|
|
|
2003-05-17 20:11:52 +04:00
|
|
|
#define CCDF_INITED 0x010 /* unit has been initialized */
|
|
|
|
#define CCDF_WLABEL 0x020 /* label area is writable */
|
|
|
|
#define CCDF_LABELLING 0x040 /* unit is currently being labelled */
|
|
|
|
#define CCDF_KLABEL 0x080 /* keep label on close */
|
|
|
|
#define CCDF_VLABEL 0x100 /* label is valid */
|
1999-01-12 03:21:47 +03:00
|
|
|
|
|
|
|
/* Mask of user-settable ccd flags. */
|
2003-10-17 09:16:15 +04:00
|
|
|
#define CCDF_USERMASK (CCDF_UNIFORM|CCDF_NOLABEL)
|
1995-08-17 20:31:30 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Before you can use a unit, it must be configured with CCDIOCSET.
|
|
|
|
* The configuration persists across opens and closes of the device;
|
1995-08-23 05:08:10 +04:00
|
|
|
* a CCDIOCCLR must be used to reset a configuration. An attempt to
|
1995-08-17 20:31:30 +04:00
|
|
|
* CCDIOCSET an already active unit will return EBUSY. Attempts to
|
|
|
|
* CCDIOCCLR an inactive unit will return ENXIO.
|
|
|
|
*/
|
|
|
|
#define CCDIOCSET _IOWR('F', 16, struct ccd_ioctl) /* enable ccd */
|
|
|
|
#define CCDIOCCLR _IOW('F', 17, struct ccd_ioctl) /* disable ccd */
|
2004-08-23 08:30:28 +04:00
|
|
|
|
|
|
|
#endif /* _DEV_CCDVAR_H_ */
|