]> git.hungrycats.org Git - linux/commitdiff
[PATCH] return full SCSI status byte in SG_IO
authorJens Axboe <axboe@suse.de>
Mon, 18 Oct 2004 16:37:38 +0000 (09:37 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 18 Oct 2004 16:37:38 +0000 (09:37 -0700)
This has been around for a while. Return the full scsi result byte in
rq->errors for SG_IO generated requests.

Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/block/scsi_ioctl.c
drivers/scsi/scsi_lib.c

index f8fb5322febb705772fbc8a3636e212f5b3207c4..b66f16726181c23c417f743e4faeb2b882bff4bd 100644 (file)
@@ -293,11 +293,11 @@ static int sg_io(struct file *file, request_queue_t *q,
        blk_execute_rq(q, bd_disk, rq);
 
        /* write to all output members */
-       hdr->status = rq->errors;       
-       hdr->masked_status = (hdr->status >> 1) & 0x1f;
-       hdr->msg_status = 0;
-       hdr->host_status = 0;
-       hdr->driver_status = 0;
+       hdr->status = 0xff & rq->errors;
+       hdr->masked_status = status_byte(rq->errors);
+       hdr->msg_status = msg_byte(rq->errors);
+       hdr->host_status = host_byte(rq->errors);
+       hdr->driver_status = driver_byte(rq->errors);
        hdr->info = 0;
        if (hdr->masked_status || hdr->host_status || hdr->driver_status)
                hdr->info |= SG_INFO_CHECK;
index b19ff1569e3bc5089a7968f56eb4bd7686e24f57..e908f75adb9e9bc3d9826dde8933b1efb6399094 100644 (file)
@@ -712,8 +712,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes,
        }
 
        if (blk_pc_request(req)) { /* SG_IO ioctl from block level */
-               req->errors = (driver_byte(result) & DRIVER_SENSE) ?
-                             (CHECK_CONDITION << 1) : (result & 0xff);
+               req->errors = result;
                if (result) {
                        clear_errors = 0;
                        if (scsi_command_normalize_sense(cmd, &sshdr)) {