#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

#
# Copyright (c) 2013 by Delphix. All rights reserved.
#

. $STF_SUITE/include/libtest.shlib

verify_disk_count "$DISKS" 2
set -A disk_array $(find_disks $DISKS)
case "${#disk_array[@]}" in
2)
	FS_DISK0=${disk_array[0]}
	FS_DISK1=${disk_array[1]}
	FS_DISK2=${disk_array[0]}
	FS_DISK3=${disk_array[1]}
	FS_SIDE0=${FS_DISK0}s0
	FS_SIDE1=${FS_DISK0}s1
	FS_SIDE2=${FS_DISK1}s0
	FS_SIDE3=${FS_DISK1}s1
	disk0="/dev/dsk/$FS_SIDE0"
	disk1="/dev/dsk/$FS_SIDE1"
	disk2="/dev/dsk/$FS_SIDE2"
	disk3="/dev/dsk/$FS_SIDE3"
	disktargets="$disk0 $disk2"
	rawdisk0="/dev/rdsk/$FS_SIDE0"
	rawdisk1="/dev/rdsk/$FS_SIDE1"
	rawdisk2="/dev/rdsk/$FS_SIDE2"
	rawdisk3="/dev/rdsk/$FS_SIDE3"
	rawtargets="$rawdisk0 $rawdisk2"
	vdisks="$FS_DISK0"
	sdisks="$FS_DISK1"
	vslices="$FS_SIDE0 $FS_SIDE1 $FS_SIDE2"
	sslices="$FS_SIDE3"
	;;
3)
	FS_DISK0=${disk_array[0]}
	FS_DISK1=${disk_array[1]}
	FS_DISK2=${disk_array[2]}
	FS_DISK3=${disk_array[0]}
	FS_SIDE0=${FS_DISK0}s0
	FS_SIDE1=${FS_DISK0}s1
	FS_SIDE2=${FS_DISK1}s0
	FS_SIDE3=${FS_DISK2}s0
	disk0="/dev/dsk/$FS_SIDE0"
	disk1="/dev/dsk/$FS_SIDE1"
	disk2="/dev/dsk/$FS_SIDE2"
	disk3="/dev/dsk/$FS_SIDE3"
	disktargets="$disk0 $disk2 $disk3"
	rawdisk0="/dev/rdsk/$FS_SIDE0"
	rawdisk1="/dev/rdsk/$FS_SIDE1"
	rawdisk2="/dev/rdsk/$FS_SIDE2"
	rawdisk3="/dev/rdsk/$FS_SIDE3"
	rawtargets="$rawdisk0 $rawdisk2 $rawdisk3"
	vdisks="$FS_DISK0 $FS_DISK1"
	sdisks="$FS_DISK2"
	vslices="$FS_SIDE0 $FS_SIDE2 $FS_SIDE3"
	sslices="$FS_SIDE1"
	;;
*)
	FS_DISK0=${disk_array[0]}
	FS_DISK1=${disk_array[1]}
	FS_DISK2=${disk_array[2]}
	FS_DISK3=${disk_array[3]}
	FS_SIDE0=${FS_DISK0}s0
	FS_SIDE1=${FS_DISK1}s0
	FS_SIDE2=${FS_DISK2}s0
	FS_SIDE3=${FS_DISK3}s0
	disk0="/dev/dsk/$FS_SIDE0"
	disk1="/dev/dsk/$FS_SIDE1"
	disk2="/dev/dsk/$FS_SIDE2"
	disk3="/dev/dsk/$FS_SIDE3"
	disktargets="$disk0 $disk1 $disk2 $disk3"
	rawdisk0="/dev/rdsk/$FS_SIDE0"
	rawdisk1="/dev/rdsk/$FS_SIDE1"
	rawdisk2="/dev/rdsk/$FS_SIDE2"
	rawdisk3="/dev/rdsk/$FS_SIDE3"
	rawtargets="$rawdisk0 $rawdisk1 $rawdisk2 $rawdisk3"
	vdisks="$FS_DISK0 $FS_DISK1 $FS_DISK2"
	sdisks="$FS_DISK3"
	vslices="$FS_SIDE0 $FS_SIDE1 $FS_SIDE2"
	sslices="$FS_SIDE3"
	;;
esac

export FS_DISK0 FS_DISK1 FS_DISK2 FS_DISK3 SINGLE_DISK
export FS_SIDE0 FS_SIDE1 FS_SIDE2 FS_SIDE3
export disk0 disk1 disk2 disk3 disktargets
export rawdisk0 rawdisk1 rawdisk2 rawdisk3 rawtargets
export vdisks sdisks vslices sslices

export UFSMP=$TESTDIR/testinuseufsdump
export FS_SIZE=1g
export PREVDUMPDEV=""
export PIDUFSDUMP=""
export PIDUFSRESTORE=""
# size of block to be written to test file - currently 1mb
export BLOCK_SIZE=$(( 1024 * 1024 ))
# number of blocks to write == size of file
export BLOCK_COUNT=100
export STF_TIMEOUT=1200			# 20 minutes max.