The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/ccdvar.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* $FreeBSD: releng/5.0/sys/sys/ccdvar.h 83291 2001-09-10 11:28:07Z kris $ */
    2 
    3 /*      $NetBSD: ccdvar.h,v 1.7.2.1 1995/10/12 21:30:18 thorpej Exp $   */
    4 
    5 /*
    6  * Copyright (c) 1995 Jason R. Thorpe.
    7  * All rights reserved.
    8  *
    9  * Redistribution and use in source and binary forms, with or without
   10  * modification, are permitted provided that the following conditions
   11  * are met:
   12  * 1. Redistributions of source code must retain the above copyright
   13  *    notice, this list of conditions and the following disclaimer.
   14  * 2. Redistributions in binary form must reproduce the above copyright
   15  *    notice, this list of conditions and the following disclaimer in the
   16  *    documentation and/or other materials provided with the distribution.
   17  * 3. All advertising materials mentioning features or use of this software
   18  *    must display the following acknowledgement:
   19  *      This product includes software developed for the NetBSD Project
   20  *      by Jason R. Thorpe.
   21  * 4. The name of the author may not be used to endorse or promote products
   22  *    derived from this software without specific prior written permission.
   23  *
   24  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   25  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   26  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   27  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
   31  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   32  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   34  * SUCH DAMAGE.
   35  */
   36 
   37 /*
   38  * Copyright (c) 1988 University of Utah.
   39  * Copyright (c) 1990, 1993
   40  *      The Regents of the University of California.  All rights reserved.
   41  *
   42  * This code is derived from software contributed to Berkeley by
   43  * the Systems Programming Group of the University of Utah Computer
   44  * Science Department.
   45  *
   46  * Redistribution and use in source and binary forms, with or without
   47  * modification, are permitted provided that the following conditions
   48  * are met:
   49  * 1. Redistributions of source code must retain the above copyright
   50  *    notice, this list of conditions and the following disclaimer.
   51  * 2. Redistributions in binary form must reproduce the above copyright
   52  *    notice, this list of conditions and the following disclaimer in the
   53  *    documentation and/or other materials provided with the distribution.
   54  * 3. All advertising materials mentioning features or use of this software
   55  *    must display the following acknowledgement:
   56  *      This product includes software developed by the University of
   57  *      California, Berkeley and its contributors.
   58  * 4. Neither the name of the University nor the names of its contributors
   59  *    may be used to endorse or promote products derived from this software
   60  *    without specific prior written permission.
   61  *
   62  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   63  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   64  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   65  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   66  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   67  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   68  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   69  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   70  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   71  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   72  * SUCH DAMAGE.
   73  *
   74  * from: Utah $Hdr: cdvar.h 1.1 90/07/09$
   75  *
   76  *      @(#)cdvar.h     8.1 (Berkeley) 6/10/93
   77  */
   78 
   79 /*
   80  * Dynamic configuration and disklabel support by:
   81  *      Jason R. Thorpe <thorpej@nas.nasa.gov>
   82  *      Numerical Aerodynamic Simulation Facility
   83  *      Mail Stop 258-6
   84  *      NASA Ames Research Center
   85  *      Moffett Field, CA 94035
   86  */
   87 
   88 /*
   89  * This structure is used to configure a ccd via ioctl(2).
   90  */
   91 struct ccd_ioctl {
   92         char    **ccio_disks;           /* pointer to component paths */
   93         u_int   ccio_ndisks;            /* number of disks to concatenate */
   94         int     ccio_ileave;            /* interleave (DEV_BSIZE blocks) */
   95         int     ccio_flags;             /* misc. information */
   96         int     ccio_unit;              /* unit number: use varies */
   97         size_t  ccio_size;              /* (returned) size of ccd */
   98 };
   99 
  100 /* Mask of user-settable ccd flags. */
  101 #define CCDF_USERMASK   (CCDF_SWAP|CCDF_UNIFORM|CCDF_MIRROR|CCDF_PARITY)
  102 
  103 /*
  104  * Component info table.
  105  * Describes a single component of a concatenated disk.
  106  */
  107 struct ccdcinfo {
  108         struct vnode    *ci_vp;                 /* device's vnode */
  109         dev_t           ci_dev;                 /* XXX: device's dev_t */
  110         size_t          ci_size;                /* size */
  111         char            *ci_path;               /* path to component */
  112         size_t          ci_pathlen;             /* length of component path */
  113 };
  114 
  115 /*
  116  * Interleave description table.
  117  * Computed at boot time to speed irregular-interleave lookups.
  118  * The idea is that we interleave in "groups".  First we interleave
  119  * evenly over all component disks up to the size of the smallest
  120  * component (the first group), then we interleave evenly over all
  121  * remaining disks up to the size of the next-smallest (second group),
  122  * and so on.
  123  *
  124  * Each table entry describes the interleave characteristics of one
  125  * of these groups.  For example if a concatenated disk consisted of
  126  * three components of 5, 3, and 7 DEV_BSIZE blocks interleaved at
  127  * DEV_BSIZE (1), the table would have three entries:
  128  *
  129  *      ndisk   startblk        startoff        dev
  130  *      3       0               0               0, 1, 2
  131  *      2       9               3               0, 2
  132  *      1       13              5               2
  133  *      0       -               -               -
  134  *
  135  * which says that the first nine blocks (0-8) are interleaved over
  136  * 3 disks (0, 1, 2) starting at block offset 0 on any component disk,
  137  * the next 4 blocks (9-12) are interleaved over 2 disks (0, 2) starting
  138  * at component block 3, and the remaining blocks (13-14) are on disk
  139  * 2 starting at offset 5.
  140  */
  141 struct ccdiinfo {
  142         int     ii_ndisk;       /* # of disks range is interleaved over */
  143         daddr_t ii_startblk;    /* starting scaled block # for range */
  144         daddr_t ii_startoff;    /* starting component offset (block #) */
  145         int     *ii_index;      /* ordered list of components in range */
  146 };
  147 
  148 /*
  149  * Concatenated disk pseudo-geometry information.
  150  */
  151 struct ccdgeom {
  152         u_int32_t       ccg_secsize;    /* # bytes per sector */
  153         u_int32_t       ccg_nsectors;   /* # data sectors per track */
  154         u_int32_t       ccg_ntracks;    /* # tracks per cylinder */
  155         u_int32_t       ccg_ncylinders; /* # cylinders per unit */
  156 };
  157 
  158 /*
  159  * A concatenated disk is described by this structure.
  160  */
  161 struct ccd_s {
  162         LIST_ENTRY(ccd_s) list;
  163 
  164         int              sc_unit;               /* logical unit number */
  165         struct vnode     **sc_vpp;              /* array of component vnodes */
  166         int              sc_flags;              /* flags */
  167         int              sc_cflags;             /* configuration flags */
  168         size_t           sc_size;               /* size of ccd */
  169         int              sc_ileave;             /* interleave */
  170         u_int            sc_nccdisks;           /* number of components */
  171 #define CCD_MAXNDISKS    65536
  172         struct ccdcinfo  *sc_cinfo;             /* component info */
  173         struct ccdiinfo  *sc_itable;            /* interleave table */
  174         struct devstat   device_stats;          /* device statistics */
  175         struct ccdgeom   sc_geom;               /* pseudo geometry info */
  176         struct disklabel sc_label;              /* generic disk device info */
  177         int              sc_openmask;
  178         int              sc_pick;               /* side of mirror picked */
  179         daddr_t          sc_blk[2];             /* mirror localization */
  180 };
  181 
  182 /* sc_flags */
  183 #define CCDF_SWAP       0x01    /* interleave should be dmmax */
  184 #define CCDF_UNIFORM    0x02    /* use LCCD of sizes for uniform interleave */
  185 #define CCDF_MIRROR     0x04    /* use mirroring */
  186 #define CCDF_PARITY     0x08    /* use parity (RAID level 5) */
  187 #define CCDF_INITED     0x10    /* unit has been initialized */
  188 #define CCDF_WLABEL     0x20    /* label area is writable */
  189 #define CCDF_LABELLING  0x40    /* unit is currently being labelled */
  190 #define CCDF_WANTED     0x60    /* someone is waiting to obtain a lock */
  191 #define CCDF_LOCKED     0x80    /* unit is locked */
  192 
  193 /*
  194  * Before you can use a unit, it must be configured with CCDIOCSET.
  195  * The configuration persists across opens and closes of the device;
  196  * a CCDIOCCLR must be used to reset a configuration.  An attempt to
  197  * CCDIOCSET an already active unit will return EBUSY.  Attempts to
  198  * CCDIOCCLR an inactive unit will return ENXIO.
  199  */
  200 #define CCDIOCSET       _IOWR('F', 16, struct ccd_ioctl)   /* enable ccd */
  201 #define CCDIOCCLR       _IOW('F', 17, struct ccd_ioctl)    /* disable ccd */
  202 
  203 struct ccdconf {
  204         int              size;          /* sizeof of buffer below */
  205         struct ccd_s     *buffer;       /* pointer to a configuration array */
  206 };
  207 #define CCDCONFINFO     _IOWR('F', 19, struct ccdconf)     /* get config */
  208 
  209 struct ccdcpps {
  210         int             size;
  211         char            *buffer;
  212 };
  213 #define CCDCPPINFO      _IOWR('F', 20, struct ccdcpps)     /* get components */

Cache object: 8a901a42316ebb84074dd17e58088452


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.