@@ -100,7 +100,7 @@ VIRTUAL_MIRROR_DEVICE=
100
100
101
101
function cleanup_lo
102
102
{
103
- L_DEVICE=" $1 "
103
+ typeset L_DEVICE=" $1 "
104
104
105
105
if [[ -e $L_DEVICE ]]; then
106
106
if is_linux; then
@@ -136,9 +136,9 @@ function get_devsize
136
136
137
137
function pick_logop
138
138
{
139
- L_SHOULD_SUCCEED=" $1 "
139
+ typeset L_SHOULD_SUCCEED=" $1 "
140
140
141
- l_logop=" log_mustnot"
141
+ typeset l_logop=" log_mustnot"
142
142
if [ " $L_SHOULD_SUCCEED " == true ]; then
143
143
l_logop=" log_must"
144
144
fi
@@ -148,7 +148,9 @@ function pick_logop
148
148
149
149
function check_dataset
150
150
{
151
- L_SHOULD_SUCCEED=" $1 "
151
+ typeset L_SHOULD_SUCCEED=" $1 "
152
+
153
+ typeset L_LOGOP=
152
154
L_LOGOP=" $( pick_logop " $L_SHOULD_SUCCEED " ) "
153
155
154
156
" $L_LOGOP " mounted " $TESTPOOL " /" $TESTFS "
@@ -175,7 +177,8 @@ function setup_dataset
175
177
176
178
function force_transactions
177
179
{
178
- L_TIMES=" $1 "
180
+ typeset L_TIMES=" $1 "
181
+ typeset i=
179
182
for (( i= 0 ; i < L_TIMES; i++ ))
180
183
do
181
184
touch " $TESTDIR " /" test" || return $?
@@ -186,7 +189,7 @@ function force_transactions
186
189
187
190
function get_practical_size
188
191
{
189
- L_SIZE=" $1 "
192
+ typeset L_SIZE=" $1 "
190
193
191
194
if [ " $(( L_SIZE % LABEL_SIZE)) " -ne 0 ]; then
192
195
echo " $(( (L_SIZE / LABEL_SIZE) * LABEL_SIZE)) "
@@ -197,10 +200,11 @@ function get_practical_size
197
200
198
201
function corrupt_sized_label_checksum
199
202
{
200
- L_SIZE=" $1 "
201
- L_LABEL=" $2 "
202
- L_DEVICE=" $3 "
203
+ typeset L_SIZE=" $1 "
204
+ typeset L_LABEL=" $2 "
205
+ typeset L_DEVICE=" $3 "
203
206
207
+ typeset L_PRACTICAL_SIZE=
204
208
L_PRACTICAL_SIZE=" $( get_practical_size " $L_SIZE " ) "
205
209
206
210
typeset -a L_OFFSETS=(" $LABEL_CKSUM_START " \
@@ -215,8 +219,8 @@ function corrupt_sized_label_checksum
215
219
216
220
function corrupt_labels
217
221
{
218
- L_SIZE=" $1 "
219
- L_DISK=" $2 "
222
+ typeset L_SIZE=" $1 "
223
+ typeset L_DISK=" $2 "
220
224
221
225
corrupt_sized_label_checksum " $L_SIZE " 0 " $L_DISK "
222
226
corrupt_sized_label_checksum " $L_SIZE " 1 " $L_DISK "
@@ -226,11 +230,14 @@ function corrupt_labels
226
230
227
231
function try_import_and_repair
228
232
{
229
- L_REPAIR_SHOULD_SUCCEED=" $1 "
230
- L_IMPORT_SHOULD_SUCCEED=" $2 "
231
- L_OP=" $3 "
232
- L_POOLDISK=" $4 "
233
+ typeset L_REPAIR_SHOULD_SUCCEED=" $1 "
234
+ typeset L_IMPORT_SHOULD_SUCCEED=" $2 "
235
+ typeset L_OP=" $3 "
236
+ typeset L_POOLDISK=" $4 "
237
+
238
+ typeset L_REPAIR_LOGOP=
233
239
L_REPAIR_LOGOP=" $( pick_logop " $L_REPAIR_SHOULD_SUCCEED " ) "
240
+ typeset L_IMPORT_LOGOP=
234
241
L_IMPORT_LOGOP=" $( pick_logop " $L_IMPORT_SHOULD_SUCCEED " ) "
235
242
236
243
log_mustnot zpool import " $TESTPOOL " -d " $L_POOLDISK "
@@ -244,10 +251,10 @@ function try_import_and_repair
244
251
245
252
function prepare_vdev
246
253
{
247
- L_SIZE=" $1 "
248
- L_BACKFILE=" $2 "
254
+ typeset L_SIZE=" $1 "
255
+ typeset L_BACKFILE=" $2 "
249
256
250
- l_devname=
257
+ typeset l_devname=
251
258
if truncate -s " $L_SIZE " " $L_BACKFILE " ; then
252
259
if is_linux; then
253
260
l_devname=" $( losetup -f " $L_BACKFILE " --show) "
@@ -262,7 +269,7 @@ function prepare_vdev
262
269
263
270
function run_test_one
264
271
{
265
- L_SIZE=" $1 "
272
+ typeset L_SIZE=" $1 "
266
273
267
274
VIRTUAL_DEVICE=" $( prepare_vdev " $L_SIZE " " $VIRTUAL_DISK " ) "
268
275
log_must test -e " $VIRTUAL_DEVICE "
@@ -289,7 +296,7 @@ function run_test_one
289
296
290
297
function make_mirrored_pool
291
298
{
292
- L_SIZE=" $1 "
299
+ typeset L_SIZE=" $1 "
293
300
294
301
VIRTUAL_DEVICE=" $( prepare_vdev " $L_SIZE " " $VIRTUAL_DISK " ) "
295
302
log_must test -e " $VIRTUAL_DEVICE "
@@ -313,7 +320,7 @@ function export_and_cleanup_vdisk
313
320
314
321
function run_test_two
315
322
{
316
- L_SIZE=" $1 "
323
+ typeset L_SIZE=" $1 "
317
324
318
325
make_mirrored_pool " $L_SIZE "
319
326
@@ -334,7 +341,7 @@ function run_test_two
334
341
335
342
function run_test_three
336
343
{
337
- L_SIZE=" $1 "
344
+ typeset L_SIZE=" $1 "
338
345
339
346
make_mirrored_pool " $L_SIZE "
340
347
@@ -359,7 +366,7 @@ function run_test_three
359
366
360
367
function run_test_four
361
368
{
362
- L_SIZE=" $1 "
369
+ typeset L_SIZE=" $1 "
363
370
364
371
make_mirrored_pool " $L_SIZE "
365
372
0 commit comments