From owner-freebsd-scsi Sun Jun 21 04:19:21 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id EAA07949 for freebsd-scsi-outgoing; Sun, 21 Jun 1998 04:19:21 -0700 (PDT) (envelope-from owner-freebsd-scsi@FreeBSD.ORG) Received: from hda.hda.com (hda-bicnet.bicnet.net [208.220.66.37]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id EAA07936 for ; Sun, 21 Jun 1998 04:19:12 -0700 (PDT) (envelope-from dufault@hda.hda.com) Received: (from dufault@localhost) by hda.hda.com (8.8.5/8.8.5) id GAA27439; Sun, 21 Jun 1998 06:52:33 -0400 (EDT) From: Peter Dufault Message-Id: <199806211052.GAA27439@hda.hda.com> Subject: Re: Rolling CAM in, what is still needed? In-Reply-To: <199806210307.VAA20507@panzer.plutotech.com> from "Kenneth D. Merry" at "Jun 20, 98 09:07:42 pm" To: ken@plutotech.com (Kenneth D. Merry) Date: Sun, 21 Jun 1998 06:52:33 -0400 (EDT) Cc: darrylo@sr.hp.com, ken@plutotech.com, freebsd-scsi@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL25 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-scsi@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > Darryl Okahata wrote... > > "Kenneth D. Merry" 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