xref: /netbsd-src/sys/dev/raidframe/rf_map.h (revision 3b01aba77a7a698587faaae455bbfe740923c1f5)
1 /*	$NetBSD: rf_map.h,v 1.3 1999/02/05 00:06:12 oster Exp $	*/
2 /*
3  * Copyright (c) 1995 Carnegie-Mellon University.
4  * All rights reserved.
5  *
6  * Author: Mark Holland
7  *
8  * Permission to use, copy, modify and distribute this software and
9  * its documentation is hereby granted, provided that both the copyright
10  * notice and this permission notice appear in all copies of the
11  * software, derivative works or modified versions, and any portions
12  * thereof, and that both notices appear in supporting documentation.
13  *
14  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
15  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
16  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17  *
18  * Carnegie Mellon requests users of this software to return to
19  *
20  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
21  *  School of Computer Science
22  *  Carnegie Mellon University
23  *  Pittsburgh PA 15213-3890
24  *
25  * any improvements or extensions that they make and grant Carnegie the
26  * rights to redistribute these changes.
27  */
28 
29 /* rf_map.h */
30 
31 #ifndef _RF__RF_MAP_H_
32 #define _RF__RF_MAP_H_
33 
34 #include "rf_types.h"
35 #include "rf_alloclist.h"
36 #include "rf_raid.h"
37 
38 /* mapping structure allocation and free routines */
39 RF_AccessStripeMapHeader_t *
40 rf_MapAccess(RF_Raid_t * raidPtr,
41     RF_RaidAddr_t raidAddress, RF_SectorCount_t numBlocks,
42     caddr_t buffer, int remap);
43 
44 void
45 rf_MarkFailuresInASMList(RF_Raid_t * raidPtr,
46     RF_AccessStripeMapHeader_t * asm_h);
47 
48 RF_AccessStripeMap_t *rf_DuplicateASM(RF_AccessStripeMap_t * asmap);
49 
50 RF_PhysDiskAddr_t *rf_DuplicatePDA(RF_PhysDiskAddr_t * pda);
51 
52 int     rf_ConfigureMapModule(RF_ShutdownList_t ** listp);
53 
54 RF_AccessStripeMapHeader_t *rf_AllocAccessStripeMapHeader(void);
55 
56 void    rf_FreeAccessStripeMapHeader(RF_AccessStripeMapHeader_t * p);
57 
58 RF_PhysDiskAddr_t *rf_AllocPhysDiskAddr(void);
59 
60 RF_PhysDiskAddr_t *rf_AllocPDAList(int count);
61 
62 void    rf_FreePhysDiskAddr(RF_PhysDiskAddr_t * p);
63 
64 RF_AccessStripeMap_t *rf_AllocAccessStripeMapComponent(void);
65 
66 RF_AccessStripeMap_t *rf_AllocASMList(int count);
67 
68 void    rf_FreeAccessStripeMapComponent(RF_AccessStripeMap_t * p);
69 
70 void    rf_FreeAccessStripeMap(RF_AccessStripeMapHeader_t * hdr);
71 
72 int     rf_CheckStripeForFailures(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap);
73 
74 int     rf_NumFailedDataUnitsInStripe(RF_Raid_t * raidPtr, RF_AccessStripeMap_t * asmap);
75 
76 void    rf_PrintAccessStripeMap(RF_AccessStripeMapHeader_t * asm_h);
77 
78 void    rf_PrintFullAccessStripeMap(RF_AccessStripeMapHeader_t * asm_h, int prbuf);
79 
80 void
81 rf_PrintRaidAddressInfo(RF_Raid_t * raidPtr, RF_RaidAddr_t raidAddr,
82     RF_SectorCount_t numBlocks);
83 
84 void
85 rf_ASMParityAdjust(RF_PhysDiskAddr_t * toAdjust,
86     RF_StripeNum_t startAddrWithinStripe, RF_SectorNum_t endAddress,
87     RF_RaidLayout_t * layoutPtr, RF_AccessStripeMap_t * asm_p);
88 
89 void
90 rf_ASMCheckStatus(RF_Raid_t * raidPtr, RF_PhysDiskAddr_t * pda_p,
91     RF_AccessStripeMap_t * asm_p, RF_RaidDisk_t ** disks, int parity);
92 
93 #endif				/* !_RF__RF_MAP_H_ */
94