Home | History | Annotate | Line # | Download | only in raidframe
raidframevar.h revision 1.1.4.4
      1  1.1.4.4  nathanw /*	$NetBSD: raidframevar.h,v 1.1.4.4 2002/07/12 01:40:10 nathanw Exp $ */
      2  1.1.4.2  nathanw /*-
      3  1.1.4.2  nathanw  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
      4  1.1.4.2  nathanw  * All rights reserved.
      5  1.1.4.2  nathanw  *
      6  1.1.4.2  nathanw  * This code is derived from software contributed to The NetBSD Foundation
      7  1.1.4.2  nathanw  * by Greg Oster
      8  1.1.4.2  nathanw  *
      9  1.1.4.2  nathanw  * Redistribution and use in source and binary forms, with or without
     10  1.1.4.2  nathanw  * modification, are permitted provided that the following conditions
     11  1.1.4.2  nathanw  * are met:
     12  1.1.4.2  nathanw  * 1. Redistributions of source code must retain the above copyright
     13  1.1.4.2  nathanw  *    notice, this list of conditions and the following disclaimer.
     14  1.1.4.2  nathanw  * 2. Redistributions in binary form must reproduce the above copyright
     15  1.1.4.2  nathanw  *    notice, this list of conditions and the following disclaimer in the
     16  1.1.4.2  nathanw  *    documentation and/or other materials provided with the distribution.
     17  1.1.4.2  nathanw  * 3. All advertising materials mentioning features or use of this software
     18  1.1.4.2  nathanw  *    must display the following acknowledgement:
     19  1.1.4.2  nathanw  *        This product includes software developed by the NetBSD
     20  1.1.4.2  nathanw  *        Foundation, Inc. and its contributors.
     21  1.1.4.2  nathanw  * 4. Neither the name of The NetBSD Foundation nor the names of its
     22  1.1.4.2  nathanw  *    contributors may be used to endorse or promote products derived
     23  1.1.4.2  nathanw  *    from this software without specific prior written permission.
     24  1.1.4.2  nathanw  *
     25  1.1.4.2  nathanw  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     26  1.1.4.2  nathanw  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     27  1.1.4.2  nathanw  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     28  1.1.4.2  nathanw  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     29  1.1.4.2  nathanw  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     30  1.1.4.2  nathanw  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     31  1.1.4.2  nathanw  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     32  1.1.4.2  nathanw  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     33  1.1.4.2  nathanw  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     34  1.1.4.2  nathanw  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     35  1.1.4.2  nathanw  * POSSIBILITY OF SUCH DAMAGE.
     36  1.1.4.2  nathanw  */
     37  1.1.4.2  nathanw /*
     38  1.1.4.2  nathanw  * Copyright (c) 1995 Carnegie-Mellon University.
     39  1.1.4.2  nathanw  * All rights reserved.
     40  1.1.4.2  nathanw  *
     41  1.1.4.2  nathanw  * Author: Mark Holland
     42  1.1.4.2  nathanw  *
     43  1.1.4.2  nathanw  * Permission to use, copy, modify and distribute this software and
     44  1.1.4.2  nathanw  * its documentation is hereby granted, provided that both the copyright
     45  1.1.4.2  nathanw  * notice and this permission notice appear in all copies of the
     46  1.1.4.2  nathanw  * software, derivative works or modified versions, and any portions
     47  1.1.4.2  nathanw  * thereof, and that both notices appear in supporting documentation.
     48  1.1.4.2  nathanw  *
     49  1.1.4.2  nathanw  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     50  1.1.4.2  nathanw  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     51  1.1.4.2  nathanw  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     52  1.1.4.2  nathanw  *
     53  1.1.4.2  nathanw  * Carnegie Mellon requests users of this software to return to
     54  1.1.4.2  nathanw  *
     55  1.1.4.2  nathanw  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     56  1.1.4.2  nathanw  *  School of Computer Science
     57  1.1.4.2  nathanw  *  Carnegie Mellon University
     58  1.1.4.2  nathanw  *  Pittsburgh PA 15213-3890
     59  1.1.4.2  nathanw  *
     60  1.1.4.2  nathanw  * any improvements or extensions that they make and grant Carnegie the
     61  1.1.4.2  nathanw  * rights to redistribute these changes.
     62  1.1.4.2  nathanw  */
     63  1.1.4.2  nathanw 
     64  1.1.4.2  nathanw /*
     65  1.1.4.2  nathanw  * Copyright (c) 1995 Carnegie-Mellon University.
     66  1.1.4.2  nathanw  * All rights reserved.
     67  1.1.4.2  nathanw  *
     68  1.1.4.2  nathanw  * Author: Jim Zelenka
     69  1.1.4.2  nathanw  *
     70  1.1.4.2  nathanw  * Permission to use, copy, modify and distribute this software and
     71  1.1.4.2  nathanw  * its documentation is hereby granted, provided that both the copyright
     72  1.1.4.2  nathanw  * notice and this permission notice appear in all copies of the
     73  1.1.4.2  nathanw  * software, derivative works or modified versions, and any portions
     74  1.1.4.2  nathanw  * thereof, and that both notices appear in supporting documentation.
     75  1.1.4.2  nathanw  *
     76  1.1.4.2  nathanw  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     77  1.1.4.2  nathanw  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     78  1.1.4.2  nathanw  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     79  1.1.4.2  nathanw  *
     80  1.1.4.2  nathanw  * Carnegie Mellon requests users of this software to return to
     81  1.1.4.2  nathanw  *
     82  1.1.4.2  nathanw  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     83  1.1.4.2  nathanw  *  School of Computer Science
     84  1.1.4.2  nathanw  *  Carnegie Mellon University
     85  1.1.4.2  nathanw  *  Pittsburgh PA 15213-3890
     86  1.1.4.2  nathanw  *
     87  1.1.4.2  nathanw  * any improvements or extensions that they make and grant Carnegie the
     88  1.1.4.2  nathanw  * rights to redistribute these changes.
     89  1.1.4.2  nathanw  */
     90  1.1.4.2  nathanw 
     91  1.1.4.2  nathanw /*****************************************************
     92  1.1.4.2  nathanw  *
     93  1.1.4.2  nathanw  * raidframevar.h
     94  1.1.4.2  nathanw  *
     95  1.1.4.2  nathanw  * main header file for using raidframe in the kernel.
     96  1.1.4.2  nathanw  *
     97  1.1.4.2  nathanw  *****************************************************/
     98  1.1.4.2  nathanw 
     99  1.1.4.2  nathanw 
    100  1.1.4.2  nathanw #ifndef _RF_RAIDFRAMEVAR_H_
    101  1.1.4.2  nathanw #define _RF_RAIDFRAMEVAR_H_
    102  1.1.4.2  nathanw 
    103  1.1.4.2  nathanw 
    104  1.1.4.2  nathanw #include <sys/ioctl.h>
    105  1.1.4.2  nathanw 
    106  1.1.4.2  nathanw #include <sys/errno.h>
    107  1.1.4.2  nathanw #include <sys/types.h>
    108  1.1.4.2  nathanw 
    109  1.1.4.2  nathanw #include <sys/uio.h>
    110  1.1.4.2  nathanw #include <sys/param.h>
    111  1.1.4.2  nathanw #include <sys/proc.h>
    112  1.1.4.2  nathanw #include <sys/lock.h>
    113  1.1.4.2  nathanw 
    114  1.1.4.2  nathanw /*
    115  1.1.4.2  nathanw  * First, define system-dependent types and constants.
    116  1.1.4.2  nathanw  *
    117  1.1.4.2  nathanw  * If the machine is big-endian, RF_BIG_ENDIAN should be 1.
    118  1.1.4.2  nathanw  * Otherwise, it should be 0.
    119  1.1.4.2  nathanw  *
    120  1.1.4.2  nathanw  * The various integer types should be self-explanatory; we
    121  1.1.4.2  nathanw  * use these elsewhere to avoid size confusion.
    122  1.1.4.2  nathanw  *
    123  1.1.4.2  nathanw  * LONGSHIFT is lg(sizeof(long)) (that is, log base two of sizeof(long)
    124  1.1.4.2  nathanw  *
    125  1.1.4.2  nathanw  */
    126  1.1.4.2  nathanw 
    127  1.1.4.2  nathanw #include <sys/types.h>
    128  1.1.4.2  nathanw #include <machine/endian.h>
    129  1.1.4.2  nathanw #include <machine/limits.h>
    130  1.1.4.2  nathanw 
    131  1.1.4.2  nathanw #if BYTE_ORDER == BIG_ENDIAN
    132  1.1.4.2  nathanw #define RF_IS_BIG_ENDIAN    1
    133  1.1.4.2  nathanw #elif BYTE_ORDER == LITTLE_ENDIAN
    134  1.1.4.2  nathanw #define RF_IS_BIG_ENDIAN    0
    135  1.1.4.2  nathanw #else
    136  1.1.4.2  nathanw #error byte order not defined
    137  1.1.4.2  nathanw #endif
    138  1.1.4.2  nathanw typedef int8_t RF_int8;
    139  1.1.4.2  nathanw typedef u_int8_t RF_uint8;
    140  1.1.4.2  nathanw typedef int16_t RF_int16;
    141  1.1.4.2  nathanw typedef u_int16_t RF_uint16;
    142  1.1.4.2  nathanw typedef int32_t RF_int32;
    143  1.1.4.2  nathanw typedef u_int32_t RF_uint32;
    144  1.1.4.2  nathanw typedef int64_t RF_int64;
    145  1.1.4.2  nathanw typedef u_int64_t RF_uint64;
    146  1.1.4.2  nathanw #if LONG_BIT == 32
    147  1.1.4.2  nathanw #define RF_LONGSHIFT        2
    148  1.1.4.2  nathanw #elif LONG_BIT == 64
    149  1.1.4.2  nathanw #define RF_LONGSHIFT        3
    150  1.1.4.2  nathanw #else
    151  1.1.4.2  nathanw #error word size not defined
    152  1.1.4.2  nathanw #endif
    153  1.1.4.2  nathanw 
    154  1.1.4.2  nathanw /*
    155  1.1.4.2  nathanw  * These are just zero and non-zero. We don't use "TRUE"
    156  1.1.4.2  nathanw  * and "FALSE" because there's too much nonsense trying
    157  1.1.4.2  nathanw  * to get them defined exactly once on every platform, given
    158  1.1.4.2  nathanw  * the different places they may be defined in system header
    159  1.1.4.2  nathanw  * files.
    160  1.1.4.2  nathanw  */
    161  1.1.4.2  nathanw #define RF_TRUE  1
    162  1.1.4.2  nathanw #define RF_FALSE 0
    163  1.1.4.2  nathanw 
    164  1.1.4.2  nathanw /*
    165  1.1.4.2  nathanw  * Now, some generic types
    166  1.1.4.2  nathanw  */
    167  1.1.4.2  nathanw typedef RF_uint64 RF_IoCount_t;
    168  1.1.4.2  nathanw typedef RF_uint64 RF_Offset_t;
    169  1.1.4.2  nathanw typedef RF_uint32 RF_PSSFlags_t;
    170  1.1.4.2  nathanw typedef RF_uint64 RF_SectorCount_t;
    171  1.1.4.2  nathanw typedef RF_uint64 RF_StripeCount_t;
    172  1.1.4.2  nathanw typedef RF_int64 RF_SectorNum_t;/* these are unsigned so we can set them to
    173  1.1.4.2  nathanw 				 * (-1) for "uninitialized" */
    174  1.1.4.2  nathanw typedef RF_int64 RF_StripeNum_t;
    175  1.1.4.2  nathanw typedef RF_int64 RF_RaidAddr_t;
    176  1.1.4.2  nathanw typedef int RF_RowCol_t;	/* unsigned so it can be (-1) */
    177  1.1.4.2  nathanw typedef RF_int64 RF_HeadSepLimit_t;
    178  1.1.4.2  nathanw typedef RF_int64 RF_ReconUnitCount_t;
    179  1.1.4.2  nathanw typedef int RF_ReconUnitNum_t;
    180  1.1.4.2  nathanw 
    181  1.1.4.2  nathanw typedef char RF_ParityConfig_t;
    182  1.1.4.2  nathanw 
    183  1.1.4.2  nathanw typedef char RF_DiskQueueType_t[1024];
    184  1.1.4.2  nathanw #define RF_DISK_QUEUE_TYPE_NONE ""
    185  1.1.4.2  nathanw 
    186  1.1.4.2  nathanw /* values for the 'type' field in a reconstruction buffer */
    187  1.1.4.2  nathanw typedef int RF_RbufType_t;
    188  1.1.4.2  nathanw #define RF_RBUF_TYPE_EXCLUSIVE   0	/* this buf assigned exclusively to
    189  1.1.4.2  nathanw 					 * one disk */
    190  1.1.4.2  nathanw #define RF_RBUF_TYPE_FLOATING    1	/* this is a floating recon buf */
    191  1.1.4.2  nathanw #define RF_RBUF_TYPE_FORCED      2	/* this rbuf was allocated to complete
    192  1.1.4.2  nathanw 					 * a forced recon */
    193  1.1.4.2  nathanw 
    194  1.1.4.2  nathanw typedef char RF_IoType_t;
    195  1.1.4.2  nathanw #define RF_IO_TYPE_READ          'r'
    196  1.1.4.2  nathanw #define RF_IO_TYPE_WRITE         'w'
    197  1.1.4.2  nathanw #define RF_IO_TYPE_NOP           'n'
    198  1.1.4.2  nathanw #define RF_IO_IS_R_OR_W(_type_) (((_type_) == RF_IO_TYPE_READ) \
    199  1.1.4.2  nathanw                                 || ((_type_) == RF_IO_TYPE_WRITE))
    200  1.1.4.2  nathanw 
    201  1.1.4.2  nathanw typedef void (*RF_VoidFuncPtr) (void *,...);
    202  1.1.4.2  nathanw 
    203  1.1.4.2  nathanw typedef RF_uint32 RF_AccessStripeMapFlags_t;
    204  1.1.4.2  nathanw typedef RF_uint32 RF_DiskQueueDataFlags_t;
    205  1.1.4.2  nathanw typedef RF_uint32 RF_DiskQueueFlags_t;
    206  1.1.4.2  nathanw typedef RF_uint32 RF_RaidAccessFlags_t;
    207  1.1.4.2  nathanw 
    208  1.1.4.2  nathanw #define RF_DISKQUEUE_DATA_FLAGS_NONE ((RF_DiskQueueDataFlags_t)0)
    209  1.1.4.2  nathanw 
    210  1.1.4.2  nathanw typedef struct RF_AccessStripeMap_s RF_AccessStripeMap_t;
    211  1.1.4.2  nathanw typedef struct RF_AccessStripeMapHeader_s RF_AccessStripeMapHeader_t;
    212  1.1.4.2  nathanw typedef struct RF_AllocListElem_s RF_AllocListElem_t;
    213  1.1.4.2  nathanw typedef struct RF_CallbackDesc_s RF_CallbackDesc_t;
    214  1.1.4.2  nathanw typedef struct RF_ChunkDesc_s RF_ChunkDesc_t;
    215  1.1.4.2  nathanw typedef struct RF_CommonLogData_s RF_CommonLogData_t;
    216  1.1.4.2  nathanw typedef struct RF_Config_s RF_Config_t;
    217  1.1.4.2  nathanw typedef struct RF_CumulativeStats_s RF_CumulativeStats_t;
    218  1.1.4.2  nathanw typedef struct RF_DagHeader_s RF_DagHeader_t;
    219  1.1.4.2  nathanw typedef struct RF_DagList_s RF_DagList_t;
    220  1.1.4.2  nathanw typedef struct RF_DagNode_s RF_DagNode_t;
    221  1.1.4.2  nathanw typedef struct RF_DeclusteredConfigInfo_s RF_DeclusteredConfigInfo_t;
    222  1.1.4.2  nathanw typedef struct RF_DiskId_s RF_DiskId_t;
    223  1.1.4.2  nathanw typedef struct RF_DiskMap_s RF_DiskMap_t;
    224  1.1.4.2  nathanw typedef struct RF_DiskQueue_s RF_DiskQueue_t;
    225  1.1.4.2  nathanw typedef struct RF_DiskQueueData_s RF_DiskQueueData_t;
    226  1.1.4.2  nathanw typedef struct RF_DiskQueueSW_s RF_DiskQueueSW_t;
    227  1.1.4.2  nathanw typedef struct RF_Etimer_s RF_Etimer_t;
    228  1.1.4.2  nathanw typedef struct RF_EventCreate_s RF_EventCreate_t;
    229  1.1.4.2  nathanw typedef struct RF_FreeList_s RF_FreeList_t;
    230  1.1.4.2  nathanw typedef struct RF_LockReqDesc_s RF_LockReqDesc_t;
    231  1.1.4.2  nathanw typedef struct RF_LockTableEntry_s RF_LockTableEntry_t;
    232  1.1.4.2  nathanw typedef struct RF_MCPair_s RF_MCPair_t;
    233  1.1.4.2  nathanw typedef struct RF_OwnerInfo_s RF_OwnerInfo_t;
    234  1.1.4.2  nathanw typedef struct RF_ParityLog_s RF_ParityLog_t;
    235  1.1.4.2  nathanw typedef struct RF_ParityLogAppendQueue_s RF_ParityLogAppendQueue_t;
    236  1.1.4.2  nathanw typedef struct RF_ParityLogData_s RF_ParityLogData_t;
    237  1.1.4.2  nathanw typedef struct RF_ParityLogDiskQueue_s RF_ParityLogDiskQueue_t;
    238  1.1.4.2  nathanw typedef struct RF_ParityLogQueue_s RF_ParityLogQueue_t;
    239  1.1.4.2  nathanw typedef struct RF_ParityLogRecord_s RF_ParityLogRecord_t;
    240  1.1.4.2  nathanw typedef struct RF_PerDiskReconCtrl_s RF_PerDiskReconCtrl_t;
    241  1.1.4.2  nathanw typedef struct RF_PSStatusHeader_s RF_PSStatusHeader_t;
    242  1.1.4.2  nathanw typedef struct RF_PhysDiskAddr_s RF_PhysDiskAddr_t;
    243  1.1.4.2  nathanw typedef struct RF_PropHeader_s RF_PropHeader_t;
    244  1.1.4.2  nathanw typedef struct RF_Raid_s RF_Raid_t;
    245  1.1.4.2  nathanw typedef struct RF_RaidAccessDesc_s RF_RaidAccessDesc_t;
    246  1.1.4.2  nathanw typedef struct RF_RaidDisk_s RF_RaidDisk_t;
    247  1.1.4.2  nathanw typedef struct RF_RaidLayout_s RF_RaidLayout_t;
    248  1.1.4.2  nathanw typedef struct RF_RaidReconDesc_s RF_RaidReconDesc_t;
    249  1.1.4.2  nathanw typedef struct RF_ReconBuffer_s RF_ReconBuffer_t;
    250  1.1.4.2  nathanw typedef struct RF_ReconConfig_s RF_ReconConfig_t;
    251  1.1.4.2  nathanw typedef struct RF_ReconCtrl_s RF_ReconCtrl_t;
    252  1.1.4.2  nathanw typedef struct RF_ReconDoneProc_s RF_ReconDoneProc_t;
    253  1.1.4.2  nathanw typedef struct RF_ReconEvent_s RF_ReconEvent_t;
    254  1.1.4.2  nathanw typedef struct RF_ReconMap_s RF_ReconMap_t;
    255  1.1.4.2  nathanw typedef struct RF_ReconMapListElem_s RF_ReconMapListElem_t;
    256  1.1.4.2  nathanw typedef struct RF_ReconParityStripeStatus_s RF_ReconParityStripeStatus_t;
    257  1.1.4.2  nathanw typedef struct RF_RedFuncs_s RF_RedFuncs_t;
    258  1.1.4.2  nathanw typedef struct RF_RegionBufferQueue_s RF_RegionBufferQueue_t;
    259  1.1.4.2  nathanw typedef struct RF_RegionInfo_s RF_RegionInfo_t;
    260  1.1.4.2  nathanw typedef struct RF_ShutdownList_s RF_ShutdownList_t;
    261  1.1.4.2  nathanw typedef struct RF_SpareTableEntry_s RF_SpareTableEntry_t;
    262  1.1.4.2  nathanw typedef struct RF_SparetWait_s RF_SparetWait_t;
    263  1.1.4.2  nathanw typedef struct RF_StripeLockDesc_s RF_StripeLockDesc_t;
    264  1.1.4.2  nathanw typedef struct RF_ThreadGroup_s RF_ThreadGroup_t;
    265  1.1.4.2  nathanw typedef struct RF_ThroughputStats_s RF_ThroughputStats_t;
    266  1.1.4.2  nathanw 
    267  1.1.4.2  nathanw /*
    268  1.1.4.2  nathanw  * Important assumptions regarding ordering of the states in this list
    269  1.1.4.2  nathanw  * have been made!!!  Before disturbing this ordering, look at code in
    270  1.1.4.2  nathanw  * sys/dev/raidframe/rf_states.c
    271  1.1.4.2  nathanw  */
    272  1.1.4.2  nathanw typedef enum RF_AccessState_e {
    273  1.1.4.2  nathanw 	/* original states */
    274  1.1.4.2  nathanw 	rf_QuiesceState,	    /* handles queisence for reconstruction */
    275  1.1.4.2  nathanw 	rf_IncrAccessesCountState,  /* count accesses in flight */
    276  1.1.4.2  nathanw 	rf_DecrAccessesCountState,
    277  1.1.4.2  nathanw 	rf_MapState,		    /* map access to disk addresses */
    278  1.1.4.2  nathanw 	rf_LockState,		    /* take stripe locks */
    279  1.1.4.2  nathanw 	rf_CreateDAGState,	    /* create DAGs */
    280  1.1.4.2  nathanw 	rf_ExecuteDAGState,	    /* execute DAGs */
    281  1.1.4.2  nathanw 	rf_ProcessDAGState,	    /* DAGs are completing- check if correct,
    282  1.1.4.2  nathanw 				     * or if we need to retry */
    283  1.1.4.2  nathanw 	rf_CleanupState,	    /* release stripe locks, clean up */
    284  1.1.4.2  nathanw 	rf_LastState		    /* must be the last state */
    285  1.1.4.2  nathanw }       RF_AccessState_t;
    286  1.1.4.2  nathanw 
    287  1.1.4.2  nathanw 
    288  1.1.4.2  nathanw /* Some constants related to RAIDframe.  These are arbitrary and
    289  1.1.4.2  nathanw    can be modified at will. */
    290  1.1.4.2  nathanw 
    291  1.1.4.2  nathanw #define RF_MAXROW    10
    292  1.1.4.2  nathanw #define RF_MAXCOL    40
    293  1.1.4.2  nathanw #define RF_MAXSPARE  10
    294  1.1.4.2  nathanw #define RF_MAXDBGV   75		    /* max number of debug variables */
    295  1.1.4.2  nathanw #define RF_MAX_DISKS 128	    /* max disks per array */
    296  1.1.4.2  nathanw #define RF_SPAREMAP_NAME_LEN 128
    297  1.1.4.2  nathanw #define RF_PROTECTED_SECTORS 64L    /* # of sectors at start of disk to
    298  1.1.4.2  nathanw 				       exclude from RAID address space */
    299  1.1.4.2  nathanw 
    300  1.1.4.2  nathanw struct RF_SpareTableEntry_s {
    301  1.1.4.2  nathanw         u_int   spareDisk;          /* disk to which this block is spared */
    302  1.1.4.2  nathanw         u_int   spareBlockOffsetInSUs;  /* offset into spare table for that
    303  1.1.4.2  nathanw                                          * disk */
    304  1.1.4.2  nathanw };
    305  1.1.4.2  nathanw 
    306  1.1.4.2  nathanw union RF_GenericParam_u {
    307  1.1.4.2  nathanw 	void   *p;
    308  1.1.4.2  nathanw 	RF_uint64 v;
    309  1.1.4.2  nathanw };
    310  1.1.4.2  nathanw typedef union RF_GenericParam_u RF_DagParam_t;
    311  1.1.4.2  nathanw typedef union RF_GenericParam_u RF_CBParam_t;
    312  1.1.4.2  nathanw 
    313  1.1.4.2  nathanw /* the raidframe configuration, passed down through an ioctl.
    314  1.1.4.2  nathanw  * the driver can be reconfigured (with total loss of data) at any time,
    315  1.1.4.2  nathanw  * but it must be shut down first.
    316  1.1.4.2  nathanw  */
    317  1.1.4.2  nathanw struct RF_Config_s {
    318  1.1.4.2  nathanw 	RF_RowCol_t numRow, numCol, numSpare;	/* number of rows, columns,
    319  1.1.4.2  nathanw 						 * and spare disks */
    320  1.1.4.2  nathanw 	dev_t   devs[RF_MAXROW][RF_MAXCOL];	/* device numbers for disks
    321  1.1.4.2  nathanw 						 * comprising array */
    322  1.1.4.2  nathanw 	char    devnames[RF_MAXROW][RF_MAXCOL][50];	/* device names */
    323  1.1.4.2  nathanw 	dev_t   spare_devs[RF_MAXSPARE];	/* device numbers for spare
    324  1.1.4.2  nathanw 						 * disks */
    325  1.1.4.2  nathanw 	char    spare_names[RF_MAXSPARE][50];	/* device names */
    326  1.1.4.2  nathanw 	RF_SectorNum_t sectPerSU;	/* sectors per stripe unit */
    327  1.1.4.2  nathanw 	RF_StripeNum_t SUsPerPU;/* stripe units per parity unit */
    328  1.1.4.2  nathanw 	RF_StripeNum_t SUsPerRU;/* stripe units per reconstruction unit */
    329  1.1.4.2  nathanw 	RF_ParityConfig_t parityConfig;	/* identifies the RAID architecture to
    330  1.1.4.2  nathanw 					 * be used */
    331  1.1.4.2  nathanw 	RF_DiskQueueType_t diskQueueType;	/* 'f' = fifo, 'c' = cvscan,
    332  1.1.4.2  nathanw 						 * not used in kernel */
    333  1.1.4.2  nathanw 	char    maxOutstandingDiskReqs;	/* # concurrent reqs to be sent to a
    334  1.1.4.2  nathanw 					 * disk.  not used in kernel. */
    335  1.1.4.2  nathanw 	char    debugVars[RF_MAXDBGV][50];	/* space for specifying debug
    336  1.1.4.2  nathanw 						 * variables & their values */
    337  1.1.4.2  nathanw 	unsigned int layoutSpecificSize;	/* size in bytes of
    338  1.1.4.2  nathanw 						 * layout-specific info */
    339  1.1.4.2  nathanw 	void   *layoutSpecific;	/* a pointer to a layout-specific structure to
    340  1.1.4.2  nathanw 				 * be copied in */
    341  1.1.4.2  nathanw 	int     force;                          /* if !0, ignore many fatal
    342  1.1.4.2  nathanw 						   configuration conditions */
    343  1.1.4.2  nathanw 	/*
    344  1.1.4.2  nathanw 	   "force" is used to override cases where the component labels would
    345  1.1.4.2  nathanw 	   indicate that configuration should not proceed without user
    346  1.1.4.2  nathanw 	   intervention
    347  1.1.4.2  nathanw 	 */
    348  1.1.4.2  nathanw };
    349  1.1.4.2  nathanw 
    350  1.1.4.2  nathanw typedef RF_uint32 RF_ReconReqFlags_t;
    351  1.1.4.2  nathanw /* flags that can be put in the rf_recon_req structure */
    352  1.1.4.2  nathanw #define RF_FDFLAGS_NONE   0x0	/* just fail the disk */
    353  1.1.4.2  nathanw #define RF_FDFLAGS_RECON  0x1	/* fail and initiate recon */
    354  1.1.4.2  nathanw 
    355  1.1.4.2  nathanw struct rf_recon_req {		/* used to tell the kernel to fail a disk */
    356  1.1.4.2  nathanw 	RF_RowCol_t row, col;
    357  1.1.4.2  nathanw 	RF_ReconReqFlags_t flags;
    358  1.1.4.2  nathanw 	void   *raidPtr;	/* used internally; need not be set at ioctl
    359  1.1.4.2  nathanw 				 * time */
    360  1.1.4.2  nathanw 	struct rf_recon_req *next;	/* used internally; need not be set at
    361  1.1.4.2  nathanw 					 * ioctl time */
    362  1.1.4.2  nathanw };
    363  1.1.4.2  nathanw 
    364  1.1.4.2  nathanw struct RF_SparetWait_s {
    365  1.1.4.2  nathanw 	int     C, G, fcol;	/* C = # disks in row, G = # units in stripe,
    366  1.1.4.2  nathanw 				 * fcol = which disk has failed */
    367  1.1.4.2  nathanw 
    368  1.1.4.2  nathanw 	RF_StripeCount_t SUsPerPU;	/* this stuff is the info required to
    369  1.1.4.2  nathanw 					 * create a spare table */
    370  1.1.4.2  nathanw 	int     TablesPerSpareRegion;
    371  1.1.4.2  nathanw 	int     BlocksPerTable;
    372  1.1.4.2  nathanw 	RF_StripeCount_t TableDepthInPUs;
    373  1.1.4.2  nathanw 	RF_StripeCount_t SpareSpaceDepthPerRegionInSUs;
    374  1.1.4.2  nathanw 
    375  1.1.4.2  nathanw 	RF_SparetWait_t *next;	/* used internally; need not be set at ioctl
    376  1.1.4.2  nathanw 				 * time */
    377  1.1.4.2  nathanw };
    378  1.1.4.2  nathanw /*
    379  1.1.4.2  nathanw  * A physical disk can be in one of several states:
    380  1.1.4.2  nathanw  * IF YOU ADD A STATE, CHECK TO SEE IF YOU NEED TO MODIFY RF_DEAD_DISK().
    381  1.1.4.2  nathanw  */
    382  1.1.4.2  nathanw enum RF_DiskStatus_e {
    383  1.1.4.2  nathanw         rf_ds_optimal,          /* no problems */
    384  1.1.4.2  nathanw         rf_ds_failed,           /* reconstruction ongoing */
    385  1.1.4.2  nathanw         rf_ds_reconstructing,   /* reconstruction complete to spare, dead disk
    386  1.1.4.2  nathanw                                  * not yet replaced */
    387  1.1.4.2  nathanw         rf_ds_dist_spared,      /* reconstruction complete to distributed
    388  1.1.4.2  nathanw                                  * spare space, dead disk not yet replaced */
    389  1.1.4.2  nathanw         rf_ds_spared,           /* reconstruction complete to distributed
    390  1.1.4.2  nathanw                                  * spare space, dead disk not yet replaced */
    391  1.1.4.2  nathanw         rf_ds_spare,            /* an available spare disk */
    392  1.1.4.2  nathanw         rf_ds_used_spare        /* a spare which has been used, and hence is
    393  1.1.4.2  nathanw                                  * not available */
    394  1.1.4.2  nathanw };
    395  1.1.4.2  nathanw typedef enum RF_DiskStatus_e RF_DiskStatus_t;
    396  1.1.4.2  nathanw 
    397  1.1.4.2  nathanw struct RF_RaidDisk_s {
    398  1.1.4.2  nathanw         char    devname[56];    /* name of device file */
    399  1.1.4.2  nathanw         RF_DiskStatus_t status; /* whether it is up or down */
    400  1.1.4.2  nathanw         RF_RowCol_t spareRow;   /* if in status "spared", this identifies the
    401  1.1.4.2  nathanw                                  * spare disk */
    402  1.1.4.2  nathanw         RF_RowCol_t spareCol;   /* if in status "spared", this identifies the
    403  1.1.4.2  nathanw                                  * spare disk */
    404  1.1.4.2  nathanw         RF_SectorCount_t numBlocks;     /* number of blocks, obtained via READ
    405  1.1.4.2  nathanw                                          * CAPACITY */
    406  1.1.4.2  nathanw         int     blockSize;
    407  1.1.4.2  nathanw         RF_SectorCount_t partitionSize; /* The *actual* and *full* size of
    408  1.1.4.2  nathanw                                            the partition, from the disklabel */
    409  1.1.4.2  nathanw         int     auto_configured;/* 1 if this component was autoconfigured.
    410  1.1.4.2  nathanw                                    0 otherwise. */
    411  1.1.4.2  nathanw         dev_t   dev;
    412  1.1.4.2  nathanw };
    413  1.1.4.2  nathanw /* The per-component label information that the user can set */
    414  1.1.4.2  nathanw typedef struct RF_ComponentInfo_s {
    415  1.1.4.2  nathanw 	int row;              /* the row number of this component */
    416  1.1.4.2  nathanw 	int column;           /* the column number of this component */
    417  1.1.4.2  nathanw 	int serial_number;    /* a user-specified serial number for this
    418  1.1.4.2  nathanw 				 RAID set */
    419  1.1.4.2  nathanw } RF_ComponentInfo_t;
    420  1.1.4.2  nathanw 
    421  1.1.4.2  nathanw /* The per-component label information */
    422  1.1.4.2  nathanw typedef struct RF_ComponentLabel_s {
    423  1.1.4.2  nathanw 	int version;          /* The version of this label. */
    424  1.1.4.2  nathanw 	int serial_number;    /* a user-specified serial number for this
    425  1.1.4.2  nathanw 				 RAID set */
    426  1.1.4.2  nathanw 	int mod_counter;      /* modification counter.  Changed (usually
    427  1.1.4.2  nathanw 				 by incrementing) every time the label
    428  1.1.4.2  nathanw 				 is changed */
    429  1.1.4.2  nathanw 	int row;              /* the row number of this component */
    430  1.1.4.2  nathanw 	int column;           /* the column number of this component */
    431  1.1.4.2  nathanw 	int num_rows;         /* number of rows in this RAID set */
    432  1.1.4.2  nathanw 	int num_columns;      /* number of columns in this RAID set */
    433  1.1.4.2  nathanw 	int clean;            /* 1 when clean, 0 when dirty */
    434  1.1.4.2  nathanw 	int status;           /* rf_ds_optimal, rf_ds_dist_spared, whatever. */
    435  1.1.4.2  nathanw 	/* stuff that will be in version 2 of the label */
    436  1.1.4.2  nathanw 	int sectPerSU;        /* Sectors per Stripe Unit */
    437  1.1.4.2  nathanw 	int SUsPerPU;         /* Stripe Units per Parity Units */
    438  1.1.4.2  nathanw 	int SUsPerRU;         /* Stripe Units per Reconstruction Units */
    439  1.1.4.2  nathanw 	int parityConfig;     /* '0' == RAID0, '1' == RAID1, etc. */
    440  1.1.4.2  nathanw 	int maxOutstanding;   /* maxOutstanding disk requests */
    441  1.1.4.2  nathanw 	int blockSize;        /* size of component block.
    442  1.1.4.2  nathanw 				 (disklabel->d_secsize) */
    443  1.1.4.2  nathanw 	int numBlocks;        /* number of blocks on this component.  May
    444  1.1.4.2  nathanw 			         be smaller than the partition size. */
    445  1.1.4.2  nathanw 	int partitionSize;    /* number of blocks on this *partition*.
    446  1.1.4.2  nathanw 				 Must exactly match the partition size
    447  1.1.4.2  nathanw 				 from the disklabel. */
    448  1.1.4.2  nathanw 	int future_use[33];   /* Future expansion */
    449  1.1.4.2  nathanw 	int autoconfigure;    /* automatically configure this RAID set.
    450  1.1.4.2  nathanw 				 0 == no, 1 == yes */
    451  1.1.4.2  nathanw 	int root_partition;   /* Use this set as /
    452  1.1.4.2  nathanw 				 0 == no, 1 == yes*/
    453  1.1.4.2  nathanw 	int last_unit;        /* last unit number (e.g. 0 for /dev/raid0)
    454  1.1.4.2  nathanw 				 of this component.  Used for autoconfigure
    455  1.1.4.2  nathanw 				 only. */
    456  1.1.4.2  nathanw 	int config_order;     /* 0 .. n.  The order in which the component
    457  1.1.4.2  nathanw 				 should be auto-configured.  E.g. 0 is will
    458  1.1.4.2  nathanw 				 done first, (and would become raid0).
    459  1.1.4.2  nathanw 				 This may be in conflict with last_unit!!?! */
    460  1.1.4.2  nathanw 	                      /* Not currently used. */
    461  1.1.4.2  nathanw 	int future_use2[44];  /* More future expansion */
    462  1.1.4.2  nathanw } RF_ComponentLabel_t;
    463  1.1.4.2  nathanw 
    464  1.1.4.2  nathanw typedef struct RF_SingleComponent_s {
    465  1.1.4.2  nathanw 	int row;
    466  1.1.4.2  nathanw 	int column;
    467  1.1.4.2  nathanw 	char component_name[50]; /* name of the component */
    468  1.1.4.2  nathanw } RF_SingleComponent_t;
    469  1.1.4.2  nathanw 
    470  1.1.4.2  nathanw typedef struct RF_DeviceConfig_s {
    471  1.1.4.2  nathanw 	u_int   rows;
    472  1.1.4.2  nathanw 	u_int   cols;
    473  1.1.4.2  nathanw 	u_int   maxqdepth;
    474  1.1.4.2  nathanw 	int     ndevs;
    475  1.1.4.2  nathanw 	RF_RaidDisk_t devs[RF_MAX_DISKS];
    476  1.1.4.2  nathanw 	int     nspares;
    477  1.1.4.2  nathanw 	RF_RaidDisk_t spares[RF_MAX_DISKS];
    478  1.1.4.2  nathanw }       RF_DeviceConfig_t;
    479  1.1.4.2  nathanw 
    480  1.1.4.2  nathanw typedef struct RF_ProgressInfo_s {
    481  1.1.4.2  nathanw 	RF_uint64 remaining;
    482  1.1.4.2  nathanw 	RF_uint64 completed;
    483  1.1.4.2  nathanw 	RF_uint64 total;
    484  1.1.4.2  nathanw } RF_ProgressInfo_t;
    485  1.1.4.2  nathanw 
    486  1.1.4.2  nathanw typedef struct RF_LayoutSW_s {
    487  1.1.4.2  nathanw 	RF_ParityConfig_t parityConfig;
    488  1.1.4.2  nathanw 	const char *configName;
    489  1.1.4.2  nathanw 
    490  1.1.4.2  nathanw #ifndef _KERNEL
    491  1.1.4.2  nathanw 	/* layout-specific parsing */
    492  1.1.4.2  nathanw 	int     (*MakeLayoutSpecific) (FILE * fp, RF_Config_t * cfgPtr,
    493  1.1.4.2  nathanw 				       void *arg);
    494  1.1.4.2  nathanw 	void   *makeLayoutSpecificArg;
    495  1.1.4.2  nathanw #else				/* !KERNEL */
    496  1.1.4.2  nathanw 
    497  1.1.4.2  nathanw 	/* initialization routine */
    498  1.1.4.2  nathanw 	int     (*Configure) (RF_ShutdownList_t ** shutdownListp,
    499  1.1.4.2  nathanw 			      RF_Raid_t * raidPtr, RF_Config_t * cfgPtr);
    500  1.1.4.2  nathanw 
    501  1.1.4.2  nathanw 	/* routine to map RAID sector address -> physical (row, col, offset) */
    502  1.1.4.2  nathanw 	void    (*MapSector) (RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector,
    503  1.1.4.2  nathanw 			      RF_RowCol_t * row, RF_RowCol_t * col,
    504  1.1.4.2  nathanw 			      RF_SectorNum_t * diskSector, int remap);
    505  1.1.4.2  nathanw 
    506  1.1.4.2  nathanw 	/* routine to map RAID sector address -> physical (r,c,o) of parity
    507  1.1.4.2  nathanw 	 * unit */
    508  1.1.4.2  nathanw 	void    (*MapParity) (RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector,
    509  1.1.4.2  nathanw 			      RF_RowCol_t * row, RF_RowCol_t * col,
    510  1.1.4.2  nathanw 			      RF_SectorNum_t * diskSector, int remap);
    511  1.1.4.2  nathanw 
    512  1.1.4.2  nathanw 	/* routine to map RAID sector address -> physical (r,c,o) of Q unit */
    513  1.1.4.2  nathanw 	void    (*MapQ) (RF_Raid_t * raidPtr, RF_RaidAddr_t raidSector,
    514  1.1.4.2  nathanw 			 RF_RowCol_t * row, RF_RowCol_t * col,
    515  1.1.4.2  nathanw 			 RF_SectorNum_t * diskSector, int remap);
    516  1.1.4.2  nathanw 
    517  1.1.4.2  nathanw 	/* routine to identify the disks comprising a stripe */
    518  1.1.4.2  nathanw 	void    (*IdentifyStripe) (RF_Raid_t * raidPtr, RF_RaidAddr_t addr,
    519  1.1.4.2  nathanw 				   RF_RowCol_t ** diskids,
    520  1.1.4.2  nathanw 				   RF_RowCol_t * outRow);
    521  1.1.4.2  nathanw 
    522  1.1.4.2  nathanw 	/* routine to select a dag */
    523  1.1.4.2  nathanw 	void    (*SelectionFunc) (RF_Raid_t * raidPtr, RF_IoType_t type,
    524  1.1.4.2  nathanw 				  RF_AccessStripeMap_t * asmap,
    525  1.1.4.2  nathanw 				  RF_VoidFuncPtr *);
    526  1.1.4.2  nathanw 
    527  1.1.4.2  nathanw 	/* map a stripe ID to a parity stripe ID.  This is typically the
    528  1.1.4.2  nathanw 	 * identity mapping */
    529  1.1.4.2  nathanw 	void    (*MapSIDToPSID) (RF_RaidLayout_t * layoutPtr,
    530  1.1.4.2  nathanw 				 RF_StripeNum_t stripeID,
    531  1.1.4.2  nathanw 				 RF_StripeNum_t * psID,
    532  1.1.4.2  nathanw 				 RF_ReconUnitNum_t * which_ru);
    533  1.1.4.2  nathanw 
    534  1.1.4.2  nathanw 	/* get default head separation limit (may be NULL) */
    535  1.1.4.2  nathanw 	RF_HeadSepLimit_t(*GetDefaultHeadSepLimit) (RF_Raid_t * raidPtr);
    536  1.1.4.2  nathanw 
    537  1.1.4.2  nathanw 	/* get default num recon buffers (may be NULL) */
    538  1.1.4.2  nathanw 	int     (*GetDefaultNumFloatingReconBuffers) (RF_Raid_t * raidPtr);
    539  1.1.4.2  nathanw 
    540  1.1.4.2  nathanw 	/* get number of spare recon units (may be NULL) */
    541  1.1.4.2  nathanw 	RF_ReconUnitCount_t(*GetNumSpareRUs) (RF_Raid_t * raidPtr);
    542  1.1.4.2  nathanw 
    543  1.1.4.2  nathanw 	/* spare table installation (may be NULL) */
    544  1.1.4.2  nathanw 	int     (*InstallSpareTable) (RF_Raid_t * raidPtr, RF_RowCol_t frow,
    545  1.1.4.2  nathanw 				      RF_RowCol_t fcol);
    546  1.1.4.2  nathanw 
    547  1.1.4.2  nathanw 	/* recon buffer submission function */
    548  1.1.4.2  nathanw 	int     (*SubmitReconBuffer) (RF_ReconBuffer_t * rbuf, int keep_it,
    549  1.1.4.2  nathanw 				      int use_committed);
    550  1.1.4.2  nathanw 
    551  1.1.4.2  nathanw 	/*
    552  1.1.4.2  nathanw          * verify that parity information for a stripe is correct
    553  1.1.4.2  nathanw          * see rf_parityscan.h for return vals
    554  1.1.4.2  nathanw          */
    555  1.1.4.2  nathanw 	int     (*VerifyParity) (RF_Raid_t * raidPtr, RF_RaidAddr_t raidAddr,
    556  1.1.4.2  nathanw 				 RF_PhysDiskAddr_t * parityPDA,
    557  1.1.4.2  nathanw 				 int correct_it, RF_RaidAccessFlags_t flags);
    558  1.1.4.2  nathanw 
    559  1.1.4.2  nathanw 	/* number of faults tolerated by this mapping */
    560  1.1.4.2  nathanw 	int     faultsTolerated;
    561  1.1.4.2  nathanw 
    562  1.1.4.2  nathanw 	/* states to step through in an access. Must end with "LastState". The
    563  1.1.4.2  nathanw 	 * default is DefaultStates in rf_layout.c */
    564  1.1.4.2  nathanw 	RF_AccessState_t *states;
    565  1.1.4.2  nathanw 
    566  1.1.4.2  nathanw 	RF_AccessStripeMapFlags_t flags;
    567  1.1.4.2  nathanw #endif				/* !KERNEL */
    568  1.1.4.2  nathanw }       RF_LayoutSW_t;
    569  1.1.4.2  nathanw 
    570  1.1.4.2  nathanw #endif				/* !_RF_RAIDFRAMEVAR_H_ */
    571