Plan 9 from Bell Labs’s /usr/web/sources/contrib/quanstro/sossd

Copyright © 2009 Alcatel-Lucent.
Distributed under the Lucent Public License version 1.02.
Download the Plan 9 distribution.


#!/bin/rc
rfork e

fn aze{
	echo $*(2-) '|' atazz $1
	echo $*(2-) | atazz $1 >[2]/dev/null
}

fn dtype0{
	switch($1){
	case iahci ahci ata sd50c mv50xx
		echo ata
	case mylex 53c8xx
		echo scsi
	case orion
		t=`{sed -n 's:^type	([^ ]+).*$:\1:p' < $2}
		switch($t){
		case sas
			echo scsi
		case sata
			echo ata
		}
	}
}

fn dtype {
	dtype0 `{sed -n 's:^' ^ $1 ^ ' ([^ ]+).*:\1:p' </dev/sdctl} /dev/$1$2/ctl
}
		
echo pci
pci | grep disk
echo

echo sdctl
cat /dev/sdctl
echo

l = `{cat /dev/sdctl | sed 's/ .*//g'}
for(i in $l){
	for(j in 0 1 2 3 4 5 6 7 8 9 a b c d e f)
	if(test -d /dev/$i$j){
		echo $i$j
		echo
		cat /dev/$i$j/ctl
		echo
		if(~ `{dtype $i $j} ata){
			echo
			switch(aze /dev/$i$j){
			case eb14*
				aze /dev/$i$j identify device
			case *
				# bug; assume ata drive
				aze /dev/$i$j identify device
			}
			echo
		}
	}
}


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2009 Alcatel-Lucent. All Rights Reserved.
Comments to webmaster@plan9.bell-labs.com.