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