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