Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Feb 1997 09:39:32 -0500 (EST)
From:      Peter Dufault <dufault@hda.com>
To:        scsi@freebsd.org
Subject:   new scsi(8)
Message-ID:  <199702061439.JAA00390@hda.hda.com>

next in thread | raw e-mail | index | archive | help
All the talk about defects, etc, convinced me to dust off something
I started way back and release it for comments.  I've put a
new scsi(8) and scsi(3) on freefall in ~ftp/incoming for review
and feedback:

> scsinew.tgz

Here is the README:

This is a feedback release of a rewrite of scsi(8) to add commands
to the equivalent of the modes data base and to be better suited
for being driven by external programs.  It includes a sample Tk
application that attempts to display the cylinder zones and defects
on a disk drive.  Note that Joerg reports the defect reading hangs
one of his drives, so be careful.

The new scsi(8) program adds these switches:

> scsi [-S style] -I               # To enter commands interactively
>     "style" can be "tcl" for tcl list oriented output
> scsi -C capfile                  # To load a cap file
>     "-C capfile" can occur as often as you want.

The program now tries to load both scsi_modes and scsi_caps.  These
files can have entries such as:

> # ndefects plist glist
> ndefects "37 0 0:3 {plist} v:1 {vlist} v:1 5:3 0 0 0 0 4:i2 0" \
> -i 4 "*i2 {Defect list length} i2"
> 
> # defects plist glist size
> defects "37 0 0:3 {plist} v:1 {vlist} v:1 5:3 0 0 0 0 {xfer} v:i2 0" \
> -i v "s4 ( {Cylinder} i3  {Head} i1  {Sector} i4)"

(Note: infinite loops are added in formats with parenthesis that will loop
until data is exhausted)

Using the TCL style these will work like this:
> rt# ./scsinew -f sd0 -S tcl -C caps -I
> scsi> ndefects 1 1
> 80
> scsi> defects 80 1 1 80
> {771 0 18} {771 0 19} {1671 4 87} {1703 3 80} {1704 3 80} {1704 3 81}
{1866 1 95} {1922 0 47} {1932 3 33} {2184 3 0} 
> scsi> 

and the verbose TCL style:
> rt# !! -v
> ./scsinew -f sd0 -S tcl -C caps -I -v
> scsi> ndefects 1 1
> { {Defect list length} 80} 
> scsi> defects 80 1 1 80
> {{ {Cylinder} 771} { {Head} 0} { {Sector} 18} } {{ {Cylinder} 771}
{ {Head} 0} { {Sector} 19} } {{ {Cylinder} 1671} { {Head} 4}
{ {Sector} 87} } {{ {Cylinder} 1703} { {Head} 3} { {Sector} 80} }
{{ {Cylinder} 1704} { {Head} 3} { {Sector} 80} } {{ {Cylinder} 1704}
{ {Head} 3} { {Sector} 81} } {{ {Cylinder} 1866} { {Head} 1}
{ {Sector} 95} } {{ {Cylinder} 1922} { {Head} 0} { {Sector} 47} }
{{ {Cylinder} 1932} { {Head} 3} { {Sector} 33} } {{ {Cylinder} 2184}
{ {Head} 3} { {Sector} 0} } 
> scsi> 

(the line wrap is artificial)

Some things to look at:

1. In cmd.c I turned off the noise that echoed arguments back in verbose
mode.  I don't think this is needed.  Look for "if 0"

2. Loops shouldn't have to be infinite.

3. I should decide how to handle errors in non-default style.
The current setup is not appropriate for begin driven by another
program.  For example, for a TCL style output we may want to go to:

0 { ... }

Where the 0 is the error result and the { ... } is the current decoded
output.  Then on error you may have:

64 { sense }

or something

-- 
Peter Dufault (dufault@hda.com)   Realtime Machine Control and Simulation
HD Associates, Inc.               Voice: 508 433 6936



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702061439.JAA00390>