File: raid.h

package info (click to toggle)
raidutils 0.0.6-21
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 10,836 kB
  • ctags: 22,075
  • sloc: cpp: 39,795; ansic: 22,774; sh: 8,306; makefile: 21
file content (285 lines) | stat: -rw-r--r-- 8,501 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
/* Copyright (c) 1996-2004, Adaptec Corporation
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * - Redistributions of source code must retain the above copyright notice, this
 *   list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright notice,
 *   this list of conditions and the following disclaimer in the documentation
 *   and/or other materials provided with the distribution.
 * - Neither the name of the Adaptec Corporation nor the names of its
 *   contributors may be used to endorse or promote products derived from this
 *   software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef		__RAID_H
#define		__RAID_H

//File - RAID.H
//***************************************************************************
//
//Description:
//
//    This file contains data structure definitions for use in RAID
//systems.
//
//Author:	Doug Anderson
//Date:		3/25/93
//
//Editors:
//
//Remarks:
//
//
//***************************************************************************


//Definitions - Defines & Constants -----------------------------------------

  // The maximum number of drive size entries supported in the engine
#define		MAX_DRIVE_SIZE_ENTRIES	126

  // Supported Logical Array Pages
#define		LAP_NCR1		0x2b
#define		LAP_DPT1		0x3B
#define		LAP_DPT2		0x30

  // Supported Physical Array Pages
#define		PAP_NCR1		0x2a

  // Mode Page to Get/Set an array's DPT name
#define		DPT_NAME_PAGE		0x3C

  // Logical Array Page Commands
#define		LAP_CMD_ADD		0x80
#define		LAP_CMD_DELETE		0x81
#define		LAP_CMD_MODIFY		0x82
#define		LAP_CMD_REPLACE		0x83
#define		LAP_CMD_ABORT		0x84
#define		LAP_CMD_SEGMENT		0x85
#define		LAP_CMD_BUILD		0x88
#define		LAP_CMD_REBUILD		0x89
#define		LAP_CMD_VERIFY		0x8a
#define		LAP_CMD_VERIFY_FIX	0x8b
#define		LAP_CMD_VERIFY_ABORT	0x8c
#define     LAP_CMD_ASSIGN_MAGIC 0x8c

  // Physical Array Page Commands
#define		PAP_CMD_OPTIMAL		0x00
#define		PAP_CMD_FAIL		0x03
#define		PAP_CMD_WARN		0x05
#define		PAP_CMD_REPLACED	0x24

  // Reserve
#define		RAID_TABLE_SIZE			0x21
#define		GEN5_RAID_TABLE_SIZE	0x11


//Definitions - Structure & Typedef -----------------------------------------


//-------------------------------------------------------------------

#ifdef	__cplusplus
   struct raidRange_S {
#else
   typedef struct {
#endif

   uLONG	startLBA;	// First LBA
   uLONG	stripeSize;	// # blocks per stripe
   uLONG	numStripes;	// total number of stripes

#ifdef	__cplusplus

//---------- Portability Additions ----------- in sp_raid.cpp
#ifdef DPT_PORTABLE
	uSHORT		netInsert(dptBuffer_S *buffer);
	uSHORT		netExtract(dptBuffer_S *buffer);
#endif // DPT PORTABLE
//--------------------------------------------

   };
#else
   } raidRange_S;
#endif  // c++


#ifdef	__cplusplus
//flags - bit definitions
  // 1=This device is redundant
const uSHORT	FLG_PAR_REDUNDANT	= 0x0001;

struct raidParent_S : public raidRange_S
{

// Data...............................................

     // Pointer to the parent RAID device
   dptRAIDdev_C		*dev_P;
     // Miscellaneous flags - see bit definitions above
   uSHORT		flags;

// Constructor/Destructor.............................

			raidParent_S();

// Other Functions....................................

   void			reset();

//---------- Portability Additions ----------- in sp_raid.cpp
#ifdef DPT_PORTABLE
	uSHORT		netInsert(dptBuffer_S *buffer);
	uSHORT		netExtract(dptBuffer_S *buffer);
#endif // DPT PORTABLE
//--------------------------------------------

};
#endif  // c++


//-------------------------------------------------------------------

#ifdef	__cplusplus
   struct raidParentMap_S {
#else
   typedef struct {
#endif

   raidRange_S	range;		// Address range occupied
   DPT_TAG_T	tag;		// Tag of parent device

#ifdef	__cplusplus

//---------- Portability Additions ----------- in sp_raid.cpp
#ifdef DPT_PORTABLE
	uSHORT		netInsert(dptBuffer_S *buffer);
	uSHORT		netExtract(dptBuffer_S *buffer);
#endif // DPT PORTABLE
//--------------------------------------------

   };
#else
   } raidParentMap_S;
#endif  // c++

//-------------------------------------------------------------------

//require - bit definitions
  // An even # of drives are required
#define	FLG_REQ_EVEN_DRIVES	0x0001
  // An odd # of drives are required
#define	FLG_REQ_ODD_DRIVES	0x0002
  // The number of drives must be a power of 2 plus the number
  // of parity drives.
#define	FLG_REQ_POWER_2_PLUS	0x0004
  // 1=Use the channel count field
  // (Allows for unique channel requirement...)
#define	FLG_REQ_CHAN_COUNT	0x0020
  // The first component in the list must be located on the first channel
#define	FLG_REQ_MIN_CHAN	0x0040
  // The component devices must be located on sequential channels
#define	FLG_REQ_SEQ_CHAN	0x0080
  // The components must have the same stripe size
#define	FLG_REQ_SAME_STRIPE_SZ	0x0100
  // The components must have the same number of stripes
#define	FLG_REQ_SAME_NUM_STRIPE	0x0200
  // The component devices must have a stripe size that is an even
  // multiple of the underlying stripe size
#define	FLG_REQ_UNDER_MULTIPLE	0x0400
  // 1=Prevent the RAID device from being a component device
  //   (ex.- Hot Spares)
#define	FLG_REQ_RESTRICT	0x4000
  // 1=Force the RAID device to be suppressed after it is created
  //   (ex.- Hot Spares)
#define	FLG_REQ_SUPPRESS	0x8000

//permit - bit definitions
  // 1=Components can have removable media
#define	FLG_COMP_REMOVABLE	0x0001
  // 1=Components can be emulated drives
#define FLG_COMP_EMULATED	0x0002
  // 1=Components must be from the same vendor
#define FLG_COMP_SAME_VENDOR	0x0008
  // 1=Components must be the same product
#define FLG_COMP_SAME_PRODUCT	0x0010
  // 1=Components must have the same revision level
#define FLG_COMP_SAME_REVISION	0x0020
  // 1=Don't use devType field, 0=Only devType devices permitted
#define FLG_COMP_ANY_TYPE	0x0040
  // 1=Components can have non-512 byte block sizes
#define FLG_COMP_NON_512	0x0100
  // 1=Components can have varying block sizes
#define FLG_COMP_DIFF_BLOCKS	0x0200
  // 1=Components must all have the same capacity
#define FLG_COMP_SAME_CAPACITY	0x0400

#ifdef	__cplusplus
   struct raidDefinition_S {
#else
   typedef struct {
#endif

   uSHORT	refNum;		// RAID reference #
   uSHORT	type;		// RAID Type (Level) (0,1,3,5...)
   uSHORT	minDrives;	// Minimum # of drives required
   uSHORT	maxDrives;	// Maximum # of drives required
   uSHORT	redundants;	// Number of redundant drives
				// (0x82 = 1/2 drives redundant)
   uLONG	minStripe;	// Minimum stripe size (blocks)
   uLONG	maxStripe;	// Maximum stripe size (blocks)
   uSHORT	chanCount;	// Determine the # of times a channel
				// can appear in the component list
   uSHORT	required;	// Additional requirements
				// (see bit definitions above)
   uSHORT	devType;	// Device type supported
   uSHORT	permit;		// Component flags

#ifdef	__cplusplus

//---------- Portability Additions ----------- in sp_raid.cpp
#ifdef DPT_PORTABLE
	uSHORT		netInsert(dptBuffer_S *buffer);
	uSHORT		netExtract(dptBuffer_S *buffer);
#endif // DPT PORTABLE
//--------------------------------------------

   };
#else
   } raidDefinition_S;
#endif  // c++


#ifdef	__cplusplus
struct raidDef_S : public raidDefinition_S
{

// Constructor/Destructor.............................

			raidDef_S();

};
#endif  // c++

//-------------------------------------------------------------------
//-------------------------------------------------------------------
//-------------------------------------------------------------------


#endif  // __RAID_H