Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Jun 1998 06:52:33 -0400 (EDT)
From:      Peter Dufault <dufault@hda.com>
To:        ken@plutotech.com (Kenneth D. Merry)
Cc:        darrylo@sr.hp.com, ken@plutotech.com, freebsd-scsi@FreeBSD.ORG
Subject:   Re: Rolling CAM in, what is still needed?
Message-ID:  <199806211052.GAA27439@hda.hda.com>
In-Reply-To: <199806210307.VAA20507@panzer.plutotech.com> from "Kenneth D. Merry" at "Jun 20, 98 09:07:42 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
> Darryl Okahata wrote...
> > "Kenneth D. Merry" <ken@plutotech.com> wrote:
> > 
> > > 	- How many more programs use this (scsireq) interface?
> > 
> >      Does /sbin/scsi work (or has it been ported)?  If so, great.  I've
> > got some perl scripts that fdisk/disklabel/newfs arbitrary disks, and
> > they rely upon scsi(8).
> 
> 	Well, scsi(8) has not been ported, it has been replaced by
> camcontrol.  camcontrol should be able to do everything that scsi(8) did,
> and more.

People can also dig up "scsinew.tgz" which is a slicing-dicing version
of scsi(8) that is a superset but can run as a server, generate
Tcl data structures, and has better abilities for command scripts,
can generate code stubs from the ascii CDB description, etc:

> # 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)"

This lets scsi(8) recognize commands such as this when set to Tcl
output mode:

> rt# ./scsinew -f sd0 -S tcl -C caps -I
> scsi> ndefects 1 1
> 0 {80}
> scsi> defects 84 1 1 84
> 0 {{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 8} }
> scsi>

Or this for code output:

> scsi> ndefects
> errval dev_ndefects(struct scsi_link *sc_link, const int input_arg0,
> const int input_arg1, int *output_arg0)
> {
>    int ret;
>   static const u_char cdb_tmplt[] =
>   {0x37,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x04,0x00,};
>   u_char cdb[sizeof(cdb_tmplt)];
>   u_char data[4];
>   memcpy(cdb, cdb_tmplt, sizeof(cdb));
>   scsi_bits_set(cdb + 2, input_arg0, 1, 3);    /* "plist" get b1 */
>   scsi_bits_set(cdb + 2, input_arg1, 1, 4);    /* "vlist" get b1 */
>   if ( (ret = scsi_scsi_cmd(sc_link,
>      (const struct scsi_generic *)cdb,
>      sizeof(cdb),
>      data,
>      4,
>      dev_retries,
>      2000,
>      NULL,
>      SCSI_DATA_IN)) == 0)
>   {
>      *output_arg0=scsi_2_byte(data + 2);    /* "Defect list length" put i2 */
>
>   }
>   return ret;
>}

I don't know where it is archived now.  There wasn't much interest
in this the last time I showed it around.

As I've said in the past, IMHO programs are better than libraries.

Peter

-- 
Peter Dufault (dufault@hda.com)   Realtime development, Machine control,
HD Associates, Inc.               Safety critical systems, Agency approval

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-scsi" in the body of the message



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