#!/bin/sh 
# print out the drive name - ssd? - given the /dev/entry
# 

vxdisk list > /tmp/vxdisk.out
plex_vol.lst > /tmp/plex_vol.out
vol_sym.lst > /tmp/vol_sym.out
#
# Main program - cycle over all devices that have been defined.
#
for i in ${1:-/dev/rdsk/*s2}
do 
#
# Save the raw device, get its block name and get the whole disk name (Assumption s2 is the whole disk)
#
raw=`echo $i`
base_raw=`basename $i`
#
# Now get what the device is linked to to figure out and format it a little
# first get something like "/iommu/.../.../.../ssd@0,0"
#
dev=`/bin/ls -l $raw | nawk '{ n = split($11, a, "/"); split(a[n],b,":"); for (i=4;i<n;i++) printf("/%s",a[i]); printf("/%s\n",b[1])}'`
# If format fails to give anything then leave
#
# then get the instance number and concatenate with the "ssd"
#
nawk -v dev=$dev '$1 ~ dev { n = split(dev, a, "/"); split(a[n], b, "@"); printf("%s%s ", b[1], $2); wwn=substr(a[5],length(a[5])-3,4); if(wwn !~ /^@/)  printf("%s", wwn) }' /etc/path_to_inst
#
# Print it and reset some variables
#
echo "	$raw	\c"
#vmdisk=`grep $base_raw /tmp/vxdisk.out|nawk '{print $3}'`
grep $base_raw /tmp/vxdisk.out|nawk '{print $3}'
echo $vmdisk
done 
