1# vim: filetype=sh
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License (the "License").
7# You may not use this file except in compliance with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22
23#
24# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
25# Use is subject to license terms.
26
27. $STF_SUITE/include/libtest.kshlib
28
29set -A disk_array $(find_disks $DISKS)
30case "${#disk_array[*]}" in
310)
32	DISK_COUNT=0
33        ;;
341)
35        # We need to repartition the single disk to two slices
36	DISK_COUNT=1
37        META_DISK0=${disk_array[0]}
38        SINGLE_DISK=$META_DISK0
39        META_DISK1=$META_DISK0
40        ZFS_DISK2=$META_DISK0
41        META_SIDE0=${SINGLE_DISK}s0
42        META_SIDE1=${SINGLE_DISK}s1
43        ZFS_SIDE2=${SINGLE_DISK}s3
44        ;;
452)
46        # We need to repartition the single disk to two slices and allocate
47	# the 2nd disk to ZFS
48	DISK_COUNT=2
49        META_DISK0=${disk_array[0]}
50        SINGLE_DISK=$META_DISK0
51        META_DISK1=$META_DISK0
52        ZFS_DISK2=${disk_array[1]}
53        META_SIDE0=${SINGLE_DISK}s0
54        META_SIDE1=${SINGLE_DISK}s1
55        ZFS_SIDE2=${ZFS_DISK2}s0
56        ;;
57*)
58	# In this case there are at least enough disks to use.
59	DISK_COUNT=3
60        META_DISK0=${disk_array[0]}
61        META_DISK1=${disk_array[1]}
62        ZFS_DISK2=${disk_array[2]}
63        META_SIDE0=${META_DISK0}s0
64        META_SIDE1=${META_DISK1}s0
65        ZFS_SIDE2=${ZFS_DISK2}s0
66        ;;
67esac
68
69export DISK_COUNT META_DISK0 META_DISK1 ZFS_DISK2
70export META_SIDE0 META_SIDE1 ZFS_SIDE2 SINGLE_DISK
71
72export TESTFILE=testfile
73export FS_SIZE=500m
74export META_DEVICE_ID=d99
75export META_DEVICE_PATH=/dev/md/$META_DEVICE_ID
76export FILE_COUNT=20
77export FILE_SIZE=$(( 1024 * 1024 ))
78