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