Marc SCHAEFER wrote:
> 
> The question of the differences between /dev/sg write()/read() interface
> and SCSI_IOCTL_SEND_COMMAND was raised in the amanda-users mailing-list.
> 
> I answered with the following. Any comments ?  I will do a summary
> to the amanda-users mailing-list.

The big difference is that SCSI_IOCTL_SEND_COMMAND has a PAGE_SIZE limit (2048
bytes on i386), which means it cannot be used for large tape changers and
large optical juke boxes because the results of a READ_ELEMENT_STATUS SCSI
command would exceed 2048 bytes. That's why I moved away from the
SCSI_IOCTL_SEND_COMMAND to the /dev/sg interface for the version of 'mtx' that
I did for large tape changers and libraries (see:
ftp://ftp.estinc.com/pub/unsupported/mtxl.README.html ). 

The upside is that SCSI_IOCTL_SEND_COMMAND appears to be more reliable than
the /dev/sg interface at handling the case of "shit happens". If my program
segfaults between the write and the read with the /dev/sg interface, for
example, half the time I appear to have hosed my entire SCSI subsystem and end
up rebooting because the Adaptec driver is stuck in a reset loop ("trying....
trying again... failed."). In production use (as vs me hacking on it and
breaking it :-) this should never happen, but as the saying goes, the best
laid plans ...

> The LINUX_CHG one uses the generic interface (/dev/sg), but it seems
> it only works in 2.0.x (sg was changed, theoretically in a
> backwards-compatible way in 2.2.x ...)

http://www.torque.net/sg/

Especially see the 'sgtools' package at that site, which has a large amount of
sample code using both SCSI_IOCTL_SEND_COMMAND and equivalent code that uses
the /dev/sg interface.


-- 
Eric Lee Green                         [EMAIL PROTECTED]
Software Engineer                      Visit our Web page:
Enhanced Software Technologies, Inc.   http://www.estinc.com/
(602) 470-1115 voice                   (602) 470-1116 fax

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]

Reply via email to