December 29th, 1999 by Robin T. Miller

	The following are the recent changes made to 'scu':

     o	Added scanning of the device directory to locate SCSI devices
	when doing a "show edt" command.  Notes on this support:
	- device scanning enabled by default on Linux and NT.
	- new options: -S to enable scanning, -N to disable scanning.
	- environment variable SCU_DEVICE_SCANNING also contrrols scan.
	  For example: "# export SCU_DEVICE_SCANNING=Yes" enables scan.

	The reasons device scanning isn't enabled by default on Tru64 Unix:
	- breaks compatability with prior 'scu' releases.
	- very slow due to device driver open processing (esp. tapes).
	- even slower on Cluster systems due to executing 'hwmgr'
	  command to determine if the device entry is local or not.
	  [ sadly, there's no callable API for faster execution ]

	The main reson this feature was added is to make it easier for
our test scripts to locate SCSI devices, and to avoid confusion on Linux
where logical devices are not persistent (change if new devices added).


	Implementation Notes:
	---------------------
	Locating the SCSI devices is accomplished by searching the device
directory, i.e. /dev or /dev/{changer,ntape,rdisk), and issuing a system
dependent IOCTL to obatin the SCSI bus, target, and lun.  Device scanning
only occurs when a "show edt" command is executed, so single device access
does not incur the directory search/device IOCTL overhead.

	Since the device is actually openned to obatin this information,
it is possible the open could block or be slow if no media is present.
Note: If not running as 'root', you must have read access to the device.
In this case, no errors are reported, but no device name will be reported.

	For tape devices, the no-rewind device is used to avoid rewinding
the tape when it is closed.  For disk devices, the open is done only on the
major disk name, i.e., Linux: /dev/sda, Tru64 Unix: /dev/rrz0c, etc, so you
will only see these device names listed in the "show edt" display.

	On Tru64 Unix, the tagged queuing depth is reported (if supported).
This information may be useful for saturating tagged requests with AIO.

	On TruClusters, only local devices are reported, and 'scu' now
ensures remote devices are not selected to avoid operations to the wrong
SCSI device (a very nasty problem).  The remote check is performed using
the hardware manager 'hwmgr', which requires 'root' privileges to run.

	If you have problems with this new feature, please report it to
myself, and then use one of the methods described above to disable it.

	Updated versions of 'scu' are available via the following URL's:

		http://www.zk3.dec.com/~rmiller/scu.html
		http://www.zk3.dec.com/~rmiller/linux.html

	Note: Only the Tru64 and Linux Intel 'scu' are currently upto date.

	NOTE:  This work is provided by the Data Products Group, managed by
Charlie Newfell.  These changes are not currently part of the Tru64 release.

Cheers,
Robin
================================================================================
Linux V6.1 Example:
-------------------

linux% scu show edt

Equipment Device Table (EDT) Information:

    Bus/Target/Lun Device Type  ANSI  Vendor ID    Product ID    Revision N/W
    -------------- ----------- ------ --------- ---------------- -------- ---
/dev/sda /dev/sga
     0    0    0   Direct      SCSI-2 COMPAQ    DDRS-39130W        S99C    W
/dev/nst0 /dev/sgb
     0    3    0   Sequential  SCSI-2 HP        C1557A             U709    N
/dev/sgc
     0    3    1   Changer     SCSI-2 HP        C1557A             U709    N
/dev/sdb /dev/sgd
     1    1    0   Direct      SCSI-2 DEC       RZ29B    (C) DEC   0016    N
/dev/sdc /dev/sge
     1    2    0   Direct      SCSI-2 DEC       RZ29B    (C) DEC   0016    N
/dev/cdrom1 /dev/scd0 /dev/sgf
     1    5    0   CD-ROM      SCSI-2 DEC       RRD46   (C) DEC    1337    N

linux% ls -ls /dev/sd[a-d]
   0 brw-rw-r--   1 root     disk       8,   0 May  5  1998 /dev/sda
   0 brw-rw-rw-   1 root     disk       8,  16 May  5  1998 /dev/sdb
   0 brw-rw-rw-   1 root     disk       8,  32 May  5  1998 /dev/sdc
   0 brw-rw-r--   1 root     disk       8,  48 May  5  1998 /dev/sdd
linux% 

================================================================================
Tru64 Unix V4.0F Example:
-------------------------

tru64% export SCU_DEVICE_SCANNING=Yes
tru64% scu show edt    

CAM Equipment Device Table (EDT) Information:

    Bus/Target/Lun Device Type  ANSI  Vendor ID    Product ID    Revision N/W
    -------------- ----------- ------ --------- ---------------- -------- ---
/dev/rrz0c (tags 32)
     0    0    0   Direct      SCSI-2 DEC       RZ1CF-CF (C) DEC   1614    W
/dev/rrz1c (tags 32)
     0    1    0   Direct      SCSI-2 COMPAQ    BB01811C9C         3B05    W
/dev/rrz2c (tags 32)
     0    2    0   Direct      SCSI-2 COMPAQ    BB01811C9C         3B05    W
/dev/rrz4c
     0    4    0   CD-ROM      SCSI-2 DEC       RRD47   (C) DEC    1206    N
/dev/mc8a
     1    0    0   Changer     SCSI-2 DEC       TL800    (C) DEC   0506    W
/dev/nrmt1h
     1    4    0   Sequential  SCSI-2 DEC       TZ89     (C) DEC   2150    W
/dev/nrmt0h /dev/nrmt2h
     1    5    0   Sequential  SCSI-2 DEC       TZ89     (C) DEC   2150    W

tru64% 

================================================================================
TruCluster V5.0 Example:
------------------------

Cluster# export SCU_DEVICE_SCANNING=Yes
Cluster# PATH=".:$PATH"
Cluster# time scu show edt

CAM Equipment Device Table (EDT) Information:

    Bus/Target/Lun Device Type  ANSI  Vendor ID    Product ID    Revision N/W
    -------------- ----------- ------ --------- ---------------- -------- ---
/dev/rdisk/dsk0c (tags 74)
     0    0    0   Direct      SCSI-2 DEC       RZ28     (C) DEC   D41C    N
/dev/rdisk/dsk1c (tags 74)
     0    1    0   Direct      SCSI-2 DEC       RZ28     (C) DEC   D41C    N
/dev/rdisk/dsk2c (tags 74)
     0    2    0   Direct      SCSI-2 DEC       RZ28     (C) DEC   D41C    N
/dev/rdisk/cdrom0c
     0    6    0   CD-ROM      SCSI-2 DEC       RRD43   (C) DEC    1084    N
/dev/rdisk/dsk3c (tags 74)
     1    0    0   Direct      SCSI-2 DEC       HSZ40              V32Z    W
/dev/rdisk/dsk4c (tags 74)
     1    0    1   Direct      SCSI-2 DEC       HSZ40              V32Z    W
/dev/rdisk/dsk5c (tags 74)
     1    0    2   Direct      SCSI-2 DEC       HSZ40              V32Z    W
/dev/rdisk/dsk6c (tags 74)
     1    0    3   Direct      SCSI-2 DEC       HSZ40              V32Z    W
/dev/rdisk/dsk7c (tags 74)
     1    0    4   Direct      SCSI-2 DEC       HSZ40              V32Z    W
/dev/rdisk/dsk8c (tags 74)
     1    0    5   Direct      SCSI-2 DEC       HSZ40              V32Z    W
/dev/rdisk/dsk9c (tags 74)
     1    0    6   Direct      SCSI-2 DEC       HSZ40              V32Z    W
/dev/rdisk/dsk10c (tags 74)
     1    0    7   Direct      SCSI-2 DEC       HSZ40              V32Z    W
/dev/rdisk/dsk11c (tags 74)
     1    1    0   Direct      SCSI-2 DEC       HSZ40              V32Z    W
/dev/rdisk/dsk12c (tags 74)
     1    1    1   Direct      SCSI-2 DEC       HSZ40              V32Z    W
/dev/rdisk/dsk13c (tags 74)
     1    1    2   Direct      SCSI-2 DEC       HSZ40              V32Z    W
/dev/rdisk/dsk14c (tags 74)
     1    1    3   Direct      SCSI-2 DEC       HSZ40              V32Z    W
/dev/rdisk/dsk15c (tags 74)
     1    1    4   Direct      SCSI-2 DEC       HSZ40              V32Z    W
/dev/rdisk/dsk16c (tags 74)
     1    2    0   Direct      SCSI-2 DEC       HSZ40              V32Z    W
/dev/rdisk/dsk17c (tags 74)
     1    2    1   Direct      SCSI-2 DEC       HSZ40              V32Z    W
/dev/rdisk/dsk18c (tags 74)
     1    2    2   Direct      SCSI-2 DEC       HSZ40              V32Z    W
/dev/rdisk/dsk19c (tags 74)
     1    2    3   Direct      SCSI-2 DEC       HSZ40              V32Z    W
/dev/rdisk/dsk20c (tags 74)
     1    2    4   Direct      SCSI-2 DEC       HSZ40              V32Z    W
/dev/rdisk/dsk21c (tags 74)
     1    2    5   Direct      SCSI-2 DEC       HSZ40              V32Z    W
/dev/rdisk/dsk22c (tags 74)
     1    2    6   Direct      SCSI-2 DEC       HSZ40              V32Z    W
/dev/rdisk/dsk23c (tags 74)
     1    2    7   Direct      SCSI-2 DEC       HSZ40              V32Z    W
/dev/changer/mc0
     2    0    0   Changer     SCSI-2 DEC       TL800    (C) DEC   0420    W
/dev/ntape/tape0c
     2    4    0   Sequential  SCSI-2 DEC       TZ89     (C) DEC   1837    W


real    1m18.70s
user    0m16.40s
sys     0m3.00s
Cluster# 
Cluster# ./scu -f /dev/rdisk/cdrom1c
scu: Sorry, device '/dev/rdisk/cdrom1c' is NOT a local device!
Cluster# 
