1 /*	$OpenBSD: rf_evenodd_dagfuncs.h,v 1.3 2002/12/16 07:01:04 tdeval Exp $	*/
2 /*	$NetBSD: rf_evenodd_dagfuncs.h,v 1.2 1999/02/05 00:06:11 oster Exp $	*/
3 
4 /*
5  * rf_evenodd_dagfuncs.h
6  */
7 /*
8  * Copyright (c) 1996 Carnegie-Mellon University.
9  * All rights reserved.
10  *
11  * Author: Chang-Ming Wu
12  *
13  * Permission to use, copy, modify and distribute this software and
14  * its documentation is hereby granted, provided that both the copyright
15  * notice and this permission notice appear in all copies of the
16  * software, derivative works or modified versions, and any portions
17  * thereof, and that both notices appear in supporting documentation.
18  *
19  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
20  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
21  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
22  *
23  * Carnegie Mellon requests users of this software to return to
24  *
25  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
26  *  School of Computer Science
27  *  Carnegie Mellon University
28  *  Pittsburgh PA 15213-3890
29  *
30  * any improvements or extensions that they make and grant Carnegie the
31  * rights to redistribute these changes.
32  */
33 
34 #ifndef	_RF__RF_EVENODD_DAGFUNCS_H_
35 #define	_RF__RF_EVENODD_DAGFUNCS_H_
36 
37 extern RF_RedFuncs_t rf_EOSmallWriteEFuncs;
38 extern RF_RedFuncs_t rf_EOSmallWritePFuncs;
39 extern RF_RedFuncs_t rf_eoERecoveryFuncs;
40 extern RF_RedFuncs_t rf_eoPRecoveryFuncs;
41 extern RF_RedFuncs_t rf_eoERecoveryFuncs;
42 
43 int  rf_RegularPEFunc(RF_DagNode_t *);
44 int  rf_RegularONEFunc(RF_DagNode_t *);
45 int  rf_SimpleONEFunc(RF_DagNode_t *);
46 void rf_RegularESubroutine(RF_DagNode_t *, char *);
47 int  rf_RegularEFunc(RF_DagNode_t *);
48 void rf_DegrESubroutine(RF_DagNode_t *, char *);
49 int  rf_Degraded_100_EOFunc(RF_DagNode_t *);
50 void rf_e_EncOneSect(RF_RowCol_t, char *, RF_RowCol_t, char *, int);
51 void rf_e_encToBuf(RF_Raid_t *, RF_RowCol_t, char *, RF_RowCol_t, char *, int);
52 int  rf_RecoveryEFunc(RF_DagNode_t *);
53 int  rf_EO_DegradedWriteEFunc(RF_DagNode_t *);
54 void rf_doubleEOdecode(RF_Raid_t *, char **, char **, RF_RowCol_t *,
55 	char *, char *);
56 int  rf_EvenOddDoubleRecoveryFunc(RF_DagNode_t *);
57 int  rf_EOWriteDoubleRecoveryFunc(RF_DagNode_t *);
58 
59 #define	rf_EUCol(_layoutPtr_,_addr_)					\
60 	((_addr_) % ((_layoutPtr_)->dataSectorsPerStripe)) /		\
61 	((_layoutPtr_)->sectorsPerStripeUnit)
62 
63 #define	rf_EO_Mod(_int1_,_int2_)					\
64 	(((_int1_) < 0) ? (((_int1_) + (_int2_)) % (_int2_))		\
65 			: ((_int1_) % (_int2_)))
66 
67 #define	rf_OffsetOfNextEUBoundary(_offset_, sec_per_eu)			\
68 	((_offset_) / (sec_per_eu) + 1) * (sec_per_eu)
69 
70 #define	RF_EO_MATRIX_DIM	17
71 
72 /*
73  * RF_EO_MATRIX_DIM should be a prime number: and "bytesPerSector" should be
74  * divisible by (RF_EO_MATRIX_DIM - 1) to fully encode and utilize the space
75  * in a sector, this number could also be 17. That later case doesn't apply
76  * for disk array larger than 17 columns totally.
77  */
78 
79 #endif	/* !_RF__RF_EVENODD_DAGFUNCS_H_ */
80