#! /usr/bin/sh
#
#ident	"@(#)dd.sh	1.10	04/12/08 SMI"
#
# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

#count initialized for dd
count_value=600

if [ $# -ne 1 ]
then
	echo "!ERROR: usage: $0 [disk slice]"
	exit 1
elif [ ! -c "/dev/rdsk/$1" ]
then
        echo "!ERROR: $1 is not a character device."
        exit 1
fi

for size in 512 1k 2k 4k 8k 16k 32k 64k 128k 256k 512k 1024k 
do
	date
	dd if=/dev/rdsk/$1 of=/dev/null bs=$size count=$count_value 2>&1

	# check for errors
	if [ $? -ne 0 ]
	then
        	echo "!ERROR: dd if=/dev/rdsk/$1 of=/dev/null failed!"
        	exit 1
	fi
done

for size in 512 1k 2k 4k 8k 16k 32k 64k 128k 256k 512k 1024k 
do
	date
	dd if=/dev/dsk/$1 of=/dev/null bs=$size count=$count_value 2>&1

	# check for errors
	if [ $? -ne 0 ]
	then
        	echo "!ERROR: dd if=/dev/dsk/$1 of=/dev/null failed!"
        	exit 1
	fi
done

for size in 512 1k 2k 4k 8k 16k 32k 64k 128k 256k 512k 1024k 
do
	date
	dd if=/dev/zero of=/dev/rdsk/$1 bs=$size count=$count_value 2>&1

	# check for errors
	if [ $? -ne 0 ]
	then
        	echo "!ERROR: dd if=/dev/zero of=/dev/rdsk/$1 failed!"
        	exit 1
	fi
done

for size in 512 1k 2k 4k 8k 16k 32k 64k 128k 256k 512k 1024k 
do
	date
	dd if=/dev/zero of=/dev/dsk/$1 bs=$size count=$count_value 2>&1

	# check for errors
	if [ $? -ne 0 ]
	then
        	echo "!ERROR: dd if=/dev/zero of=/dev/dsk/$1 failed!"
        	exit 1
	fi
done

