FreeBSD/Linux Kernel Cross Reference
sys/dev/hptrr/array.h
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) HighPoint Technologies, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD: releng/12.0/sys/dev/hptrr/array.h 326255 2017-11-27 14:52:40Z pfg $
29 */
30 #include <dev/hptrr/hptrr_config.h>
31 /*
32 * $Id: array.h,v 1.44 2007/11/01 03:05:27 gmm Exp $
33 * Copyright (C) 2004-2005 HighPoint Technologies, Inc. All rights reserved.
34 */
35 #ifndef _HPT_ARRAY_H_
36 #define _HPT_ARRAY_H_
37
38 #define VERMAGIC_ARRAY 43
39
40 #if defined(__cplusplus)
41 extern "C" {
42 #endif
43
44 #define MAX_ARRAY_NAME 16
45
46 #ifndef MAX_MEMBERS
47 #define MAX_MEMBERS 16
48 #endif
49
50 #if MAX_MEMBERS<=16
51 typedef HPT_U16 HPT_MMASK;
52 #elif MAX_MEMBERS<=32
53 typedef HPT_U32 HPT_MMASK;
54 #elif MAX_MEMBERS<=64
55 typedef HPT_U64 HPT_MMASK;
56 #else
57 #error "MAX_MEMBERS too large"
58 #endif
59
60 #define HPT_MMASK_VALUE(x) (HPT_MMASK)((HPT_MMASK)1<<(x))
61
62 #if MAX_MEMBERS<32
63 #define HPT_MMASK_VALUE_SAFE(x) HPT_MMASK_VALUE(x)
64 #else
65 #define HPT_MMASK_VALUE_SAFE(x) ((x)>=MAX_MEMBERS? (HPT_MMASK)0 : HPT_MMASK_VALUE(x))
66 #endif
67
68 #define MAX_REBUILD_SECTORS 128
69
70 typedef struct _RAID_FLAGS {
71 HPT_UINT rf_need_initialize : 1;
72 HPT_UINT rf_need_rebuild: 1;
73 HPT_UINT rf_need_sync: 1;
74 /* ioctl flags */
75 HPT_UINT rf_auto_rebuild: 1;
76 HPT_UINT rf_rebuilding: 1;
77 HPT_UINT rf_verifying: 1;
78 HPT_UINT rf_initializing: 1;
79 HPT_UINT rf_abort_verifying: 1;
80 HPT_UINT rf_raid15: 1;
81 HPT_UINT rf_v3_format : 1;
82 HPT_UINT rf_need_transform : 1;
83 HPT_UINT rf_transforming : 1;
84 HPT_UINT rf_abort_transform : 1;
85 HPT_UINT rf_log_write: 1;
86 } RAID_FLAGS;
87
88 typedef struct transform_cmd_ext
89 {
90 HPT_LBA lba;
91 HPT_U16 total_sectors;
92 HPT_U16 finished_sectors;
93 } TRANSFORM_CMD_EXT , *PTRANSFORM_CMD_EXT;
94
95
96 #define TO_MOVE_DATA 0
97 #define TO_INITIALIZE 1
98 #define TO_INITIALIZE_ONLY 2
99 #define TO_MOVE_DATA_ONLY 3
100 typedef struct hpt_transform
101 {
102 HPT_U32 stamp;
103 PVDEV source;
104 PVDEV target;
105 struct list_head link;
106 HPT_U8 transform_from_tail;
107 struct tq_item task;
108
109 struct lock_request lock;
110 TRANSFORM_CMD_EXT cmdext;
111
112 HPT_U64 transform_point;
113 HPT_U16 transform_sectors_per_step;
114 HPT_U8 operation;
115 HPT_U8 disabled;
116 } HPT_TRANSFORM, *PHPT_TRANSFORM;
117
118 typedef struct hpt_array
119 {
120 HPT_U32 array_stamp;
121 HPT_U32 data_stamp;
122
123 HPT_U8 ndisk;
124 HPT_U8 block_size_shift;
125 HPT_U16 strip_width;
126 HPT_U8 sector_size_shift; /*sector size = 512B<<sector_size_shift*/
127 HPT_U8 jid;
128 HPT_U8 reserved[2];
129
130
131 HPT_MMASK outdated_members;
132 HPT_MMASK offline_members;
133
134 PVDEV member[MAX_MEMBERS];
135
136 RAID_FLAGS flags;
137
138 HPT_U64 rebuilt_sectors;
139
140
141 HPT_U8 name[MAX_ARRAY_NAME];
142 PHPT_TRANSFORM transform;
143
144 TIME_RECORD create_time;
145 HPT_U8 description[64];
146 HPT_U8 create_manager[16];
147
148 #ifdef OS_SUPPORT_TASK
149 int floating_priority;
150 OSM_TASK ioctl_task;
151 IOCTL_ARG ioctl_arg;
152
153 char ioctl_inbuf[sizeof(PVDEV)+sizeof(HPT_U64)+sizeof(HPT_U16)];
154 char ioctl_outbuf[sizeof(HPT_UINT)];
155 #endif
156
157 } HPT_ARRAY, *PHPT_ARRAY;
158
159 #ifdef OS_SUPPORT_TASK
160 void ldm_start_rebuild(struct _VDEV *pArray);
161 #else
162 #define ldm_start_rebuild(pArray)
163 #endif
164
165 typedef struct _raw_partition{
166 struct _raw_partition * next;
167 __HPT_RAW_LBA start;
168 __HPT_RAW_LBA capacity;
169 PVDEV vd_part;
170 } RAW_PARTITION, *PRAW_PARTITION;
171
172 typedef struct hpt_partiton
173 {
174 PVDEV raw_disk;
175 __HPT_RAW_LBA des_location;
176 PRAW_PARTITION raw_part;
177 HPT_U8 del_mbr;
178 HPT_U8 reserved[3];
179 } HPT_PARTITION, *PHPT_PARTITION;
180
181 HPT_U16 get_strip_size(PVDEV vd);
182
183 void ldm_check_array_online(PVDEV pArray);
184 void ldm_generic_member_failed(PVDEV member);
185 void ldm_sync_array_info(PVDEV pArray);
186 void ldm_sync_array_stamp(PVDEV pArray);
187 void ldm_add_spare_to_array(PVDEV pArray, PVDEV spare_partition);
188
189 #if defined(__cplusplus)
190 }
191 #endif
192 #endif
Cache object: ae9535c9cc3c1da4a15be8260d07c816
|