|
@@ -188,9 +188,13 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)
|
|
|
struct scsi_device *SDev;
|
|
|
struct scsi_sense_hdr sshdr;
|
|
|
int result, err = 0, retries = 0;
|
|
|
+ unsigned char sense_buffer[SCSI_SENSE_BUFFERSIZE], *senseptr = NULL;
|
|
|
|
|
|
SDev = cd->device;
|
|
|
|
|
|
+ if (cgc->sense)
|
|
|
+ senseptr = sense_buffer;
|
|
|
+
|
|
|
retry:
|
|
|
if (!scsi_block_when_processing_errors(SDev)) {
|
|
|
err = -ENODEV;
|
|
@@ -198,10 +202,12 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)
|
|
|
}
|
|
|
|
|
|
result = scsi_execute(SDev, cgc->cmd, cgc->data_direction,
|
|
|
- cgc->buffer, cgc->buflen,
|
|
|
- (unsigned char *)cgc->sense, &sshdr,
|
|
|
+ cgc->buffer, cgc->buflen, senseptr, &sshdr,
|
|
|
cgc->timeout, IOCTL_RETRIES, 0, 0, NULL);
|
|
|
|
|
|
+ if (cgc->sense)
|
|
|
+ memcpy(cgc->sense, sense_buffer, sizeof(*cgc->sense));
|
|
|
+
|
|
|
/* Minimal error checking. Ignore cases we know about, and report the rest. */
|
|
|
if (driver_byte(result) != 0) {
|
|
|
switch (sshdr.sense_key) {
|