#!/bin/ksh -p
# $Id: //depot/stable/explorer/tools/vxfs#2 $
#
# Explorer Version:
EXP_VERSION=4.0
#

# Source tools functions
. ${EXP_LIB}/exp_tools

# Run if specified to do so
script=${0##*/}
which_gate_exit storage $script default all

TEXT=`gettext "VxFS not installed"`
require "pkginfo -q VRTSvxfs" "${TEXT}"

#
# VxFS info
#
get_file /etc/vx/tunefstab etc/vx
get_dir  /etc/vx/elm       etc/vx/elm

# Use df - convert parens to ':' and get 1st and 2nd args (filesystem and device)
df -lFvxfs | sed -e "s/(/:/" -e "s/)/:/" | nawk -F: '{print $1,$2}' | while read fs dev
do
    bdev=`echo $dev | awk -F: '{ print $1 }' | sed 's/[\(\)]//g'`
    rdev=`echo $bdev | sed 's/dsk/rdsk/'`
    FS=`echo $fs | sed 's/\//_/g'`

    get_cmd "/usr/sbin/vxtunefs -p $bdev"    disks/vxfs/vxtunefs_-p=${FS}
    get_cmd "/usr/lib/fs/vxfs/fsadm -ED $fs" disks/vxfs/fsadm_-ED=${FS}
    get_cmd "/usr/sbin/fstyp -v $bdev"       disks/vxfs/fstyp_-v=${FS}
done
