1*83bbf6e1SMauro Carvalho Chehab#! /bin/sh 2*83bbf6e1SMauro Carvalho Chehab# collate and present sysfs information about AoE storage 3*83bbf6e1SMauro Carvalho Chehab# 4*83bbf6e1SMauro Carvalho Chehab# A more complete version of this script is aoe-stat, in the 5*83bbf6e1SMauro Carvalho Chehab# aoetools. 6*83bbf6e1SMauro Carvalho Chehab 7*83bbf6e1SMauro Carvalho Chehabset -e 8*83bbf6e1SMauro Carvalho Chehabformat="%8s\t%8s\t%8s\n" 9*83bbf6e1SMauro Carvalho Chehabme=`basename $0` 10*83bbf6e1SMauro Carvalho Chehabsysd=${sysfs_dir:-/sys} 11*83bbf6e1SMauro Carvalho Chehab 12*83bbf6e1SMauro Carvalho Chehab# printf "$format" device mac netif state 13*83bbf6e1SMauro Carvalho Chehab 14*83bbf6e1SMauro Carvalho Chehab# Suse 9.1 Pro doesn't put /sys in /etc/mtab 15*83bbf6e1SMauro Carvalho Chehab#test -z "`mount | grep sysfs`" && { 16*83bbf6e1SMauro Carvalho Chehabtest ! -d "$sysd/block" && { 17*83bbf6e1SMauro Carvalho Chehab echo "$me Error: sysfs is not mounted" 1>&2 18*83bbf6e1SMauro Carvalho Chehab exit 1 19*83bbf6e1SMauro Carvalho Chehab} 20*83bbf6e1SMauro Carvalho Chehab 21*83bbf6e1SMauro Carvalho Chehabfor d in `ls -d $sysd/block/etherd* 2>/dev/null | grep -v p` end; do 22*83bbf6e1SMauro Carvalho Chehab # maybe ls comes up empty, so we use "end" 23*83bbf6e1SMauro Carvalho Chehab test $d = end && continue 24*83bbf6e1SMauro Carvalho Chehab 25*83bbf6e1SMauro Carvalho Chehab dev=`echo "$d" | sed 's/.*!//'` 26*83bbf6e1SMauro Carvalho Chehab printf "$format" \ 27*83bbf6e1SMauro Carvalho Chehab "$dev" \ 28*83bbf6e1SMauro Carvalho Chehab "`cat \"$d/netif\"`" \ 29*83bbf6e1SMauro Carvalho Chehab "`cat \"$d/state\"`" 30*83bbf6e1SMauro Carvalho Chehabdone | sort 31