Subject: Re: nore on disk stats
To: None <perry@piermont.com>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-kern
Date: 11/10/1995 11:17:54
[ probably belongs on tech-install, but oh well :-) ]

On Fri, 10 Nov 1995 09:10:16 -0500 
 "Perry E. Metzger" <perry@piermont.com> wrote:

 > BTW, I know it isn't directly related, but while pondering improving
 > the automation of installs recently, I noticed how inconsistent kernel
 > probe messages for various disks and network controllers were, which
 > makes it hard to extract the information you need by awking
 > /kern/msgbuf -- which is going to be the method of choice on the i386
 > at least.

Well, for ports that use MI SCSI, finding the SCSI disk devices should be 
easy:

md_get_diskdevs() {
	# return available disk devices
	grep "^sd.*bus.*:*cyl," /kern/msgbuf | awk '{print $1}' | sort -u
}

md_get_cddevs() {
	# return available cdrom devices
	grep "^cd.*bus" /kern/msgbuf | awk '{print $1}' | sort -u
}

md_get_ifdefs() {
	# return available network interfaces
	for _netifname in ed el eg ep ie le; do
		grep "^${netifname}.* " | awk '{print $1}' | sort -u
	done
}

This is similar to the approach Paul and I took with the hp300/sparc (and 
sun3, too) install.sh.  Eventually, most (all?) ports might be able to 
use this script after .'ing in a machine-dependent module that defines 
certain functions.

--------------------------------------------------------------------------
Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939