Hello SCSI tapers, Attached is a patch to add some functionality the st driver so that you can monitor the most recent SCSI command and sense buffer. This info is made available via sysfs attributes. I want to add these attributes in order to do better error processing in some custom tape software which I am writing. This patch has been tested on Linux kernel 2.6.12. The new functionality is as follows: 1) the most recent "relevant" SCSI command and sense are stored in hex format in: /sys/class/scsi_tape/stN/last_cmnd /sys/class/scsi_tape/stN/last_sense When I say "relevant" SCSI command, I mean: occasionally the most recent SCSI command is not the one of interest, e.g. when encountering an ILI, the driver will automatically backspace to the beginning of the block. However, the last_cmnd and last_sense will show the results of the read error, not the backspace. 2) The raw sense data is also decoded into English language for primary sense key, extended sense, and ILI/FM/EOM flags in these sysfs files: /sys/class/scsi_tape/stN/primary_sense /sys/class/scsi_tape/stN/extended_sense /sys/class/scsi_tape/stN/sense_flags Details of implementation: 1) added data fields "last_cmnd" and "last_sense" to struct st_cmdstatus for storage of most recent command and sense data. Removed unused "last_cmnd" and "last_sense" fields from struct scsi_tape. 2) added routine st_record_last_command() to save command and sense data 3) added calls to st_record_last_command() in appropriate locations in the code. 4) added arg to st_int_ioctl() to indicate whether or not to record the SCSI command (necessary so that we can record the "relevant" command) 5) added routines for sysfs attribute files This is my first time submitting a patch to the list, please go easy on me!! Regards, --Andy Stevens Electrical Science, Inc. NY, USA