Back to home page

OSCL-LXR

 
 

    


0001 #! /bin/sh
0002 # collate and present sysfs information about AoE storage
0003 #
0004 # A more complete version of this script is aoe-stat, in the
0005 # aoetools.
0006 
0007 set -e
0008 format="%8s\t%8s\t%8s\n"
0009 me=`basename $0`
0010 sysd=${sysfs_dir:-/sys}
0011 
0012 # printf "$format" device mac netif state
0013 
0014 # Suse 9.1 Pro doesn't put /sys in /etc/mtab
0015 #test -z "`mount | grep sysfs`" && {
0016 test ! -d "$sysd/block" && {
0017         echo "$me Error: sysfs is not mounted" 1>&2
0018         exit 1
0019 }
0020 
0021 for d in `ls -d $sysd/block/etherd* 2>/dev/null | grep -v p` end; do
0022         # maybe ls comes up empty, so we use "end"
0023         test $d = end && continue
0024 
0025         dev=`echo "$d" | sed 's/.*!//'`
0026         printf "$format" \
0027                 "$dev" \
0028                 "`cat \"$d/netif\"`" \
0029                 "`cat \"$d/state\"`"
0030 done | sort