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