Re: proc_name in sysfs

Patrick Mansfield
2005-04-06T18:36:22Z

On Wed, Apr 06, 2005 at 01:40:04PM +0200, Frederic TEMPORELLI wrote:

> 2/ now, how can we get the adapter module name from sysfs ?

Why do you need it?

Anyway, try lsscsi, it walks the sysfs tree:

[elm3b79 patman]$ lsscsi -H
[0] qla1280
[1] qla1280
[2] qla2xxx
[3] qla2xxx

Or, script it:

[elm3b79 tmp]$ more xx.sh
#! /bin/sh

hdir=/sys/class/scsi_host

for i in ${hdir}/host*
do
host_dir=$(cd ${i}/device;/bin/pwd)
driver_dir=$(cd ${host_dir}/../driver;/bin/pwd)
module=$(basename ${driver_dir})
# echo ${i} is in: ${host_dir}
echo "${i} module (driver) is: ${module}"
done

[elm3b79 tmp]$ sh ./xx.sh
/sys/class/scsi_host/host0 module (driver) is: qla1280
/sys/class/scsi_host/host1 module (driver) is: qla1280
/sys/class/scsi_host/host2 module (driver) is: qla2300
/sys/class/scsi_host/host3 module (driver) is: qla2300

-- Patrick Mansfield