blob: eeec7baae57a8f3db9a0da1583c0e3c8e0e8408d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#! /bin/sh
2# collate and present sysfs information about AoE storage
Ed Cashin5b8c4be2012-10-04 17:16:49 -07003#
4# A more complete version of this script is aoe-stat, in the
5# aoetools.
Linus Torvalds1da177e2005-04-16 15:20:36 -07006
7set -e
8format="%8s\t%8s\t%8s\n"
9me=`basename $0`
10sysd=${sysfs_dir:-/sys}
11
12# printf "$format" device mac netif state
13
14# Suse 9.1 Pro doesn't put /sys in /etc/mtab
15#test -z "`mount | grep sysfs`" && {
16test ! -d "$sysd/block" && {
17 echo "$me Error: sysfs is not mounted" 1>&2
18 exit 1
19}
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
21for d in `ls -d $sysd/block/etherd* 2>/dev/null | grep -v p` end; do
22 # maybe ls comes up empty, so we use "end"
23 test $d = end && continue
24
25 dev=`echo "$d" | sed 's/.*!//'`
26 printf "$format" \
27 "$dev" \
28 "`cat \"$d/netif\"`" \
29 "`cat \"$d/state\"`"
30done | sort