[PATCH 012/117] block: Convert SCSI and bsg code to the scsi_status union

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



An explanation of the purpose of this patch is available in the patch
"scsi: Introduce the scsi_status union".

Cc: Jens Axboe <axboe@xxxxxxxxx>
Cc: Christoph Hellwig <hch@xxxxxx>
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
---
 block/bsg-lib.c    | 16 ++++++++--------
 block/bsg.c        |  6 +++---
 block/scsi_ioctl.c | 14 +++++++-------
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/block/bsg-lib.c b/block/bsg-lib.c
index 330fede77271..35a01a264816 100644
--- a/block/bsg-lib.c
+++ b/block/bsg-lib.c
@@ -82,18 +82,18 @@ static int bsg_transport_complete_rq(struct request *rq, struct sg_io_v4 *hdr)
 	 * The assignments below don't make much sense, but are kept for
 	 * bug by bug backwards compatibility:
 	 */
-	hdr->device_status = job->result & 0xff;
-	hdr->transport_status = host_byte(job->result);
-	hdr->driver_status = driver_byte(job->result);
+	hdr->device_status = job->status.b.status;
+	hdr->transport_status = host_byte(job->status);
+	hdr->driver_status = driver_byte(job->status);
 	hdr->info = 0;
 	if (hdr->device_status || hdr->transport_status || hdr->driver_status)
 		hdr->info |= SG_INFO_CHECK;
 	hdr->response_len = 0;
 
-	if (job->result < 0) {
+	if (job->status.combined < 0) {
 		/* we're only returning the result field in the reply */
 		job->reply_len = sizeof(u32);
-		ret = job->result;
+		ret = job->status.combined;
 	}
 
 	if (job->reply_len && hdr->response) {
@@ -183,7 +183,7 @@ void bsg_job_done(struct bsg_job *job, int result,
 {
 	struct request *rq = blk_mq_rq_from_pdu(job);
 
-	job->result = result;
+	job->status.combined = result;
 	job->reply_payload_rcv_len = reply_payload_rcv_len;
 	if (likely(!blk_should_fake_timeout(rq->q)))
 		blk_mq_complete_request(rq);
@@ -247,7 +247,7 @@ static bool bsg_prepare_job(struct device *dev, struct request *req)
 failjob_rls_rqst_payload:
 	kfree(job->request_payload.sg_list);
 failjob_rls_job:
-	job->result = -ENOMEM;
+	job->status.combined = -ENOMEM;
 	return false;
 }
 
@@ -257,7 +257,7 @@ static bool bsg_prepare_job(struct device *dev, struct request *req)
  * @bd: queue data
  *
  * On error the create_bsg_job function should return a -Exyz error value
- * that will be set to ->result.
+ * that will be set to ->status.
  *
  * Drivers/subsys should pass this to the queue init function.
  */
diff --git a/block/bsg.c b/block/bsg.c
index bd10922d5cbb..a03d43ed2bcc 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -94,9 +94,9 @@ static int bsg_scsi_complete_rq(struct request *rq, struct sg_io_v4 *hdr)
 	/*
 	 * fill in all the output members
 	 */
-	hdr->device_status = sreq->result & 0xff;
-	hdr->transport_status = host_byte(sreq->result);
-	hdr->driver_status = driver_byte(sreq->result);
+	hdr->device_status = sreq->status.b.status;
+	hdr->transport_status = host_byte(sreq->status);
+	hdr->driver_status = driver_byte(sreq->status);
 	hdr->info = 0;
 	if (hdr->device_status || hdr->transport_status || hdr->driver_status)
 		hdr->info |= SG_INFO_CHECK;
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 6599bac0a78c..3a56dc979df2 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -252,11 +252,11 @@ static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr,
 	/*
 	 * fill in all the output members
 	 */
-	hdr->status = req->result & 0xff;
-	hdr->masked_status = status_byte(req->result);
-	hdr->msg_status = msg_byte(req->result);
-	hdr->host_status = host_byte(req->result);
-	hdr->driver_status = driver_byte(req->result);
+	hdr->status = req->status.b.status;
+	hdr->masked_status = status_byte(req->status);
+	hdr->msg_status = msg_byte(req->status);
+	hdr->host_status = host_byte(req->status);
+	hdr->driver_status = driver_byte(req->status);
 	hdr->info = 0;
 	if (hdr->masked_status || hdr->host_status || hdr->driver_status)
 		hdr->info |= SG_INFO_CHECK;
@@ -495,7 +495,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
 
 	blk_execute_rq(disk, rq, 0);
 
-	err = req->result & 0xff;	/* only 8 bit SCSI status */
+	err = req->status.b.status;	/* only 8 bit SCSI status */
 	if (err) {
 		if (req->sense_len && req->sense) {
 			bytes = (OMAX_SB_LEN > req->sense_len) ?
@@ -533,7 +533,7 @@ static int __blk_send_generic(struct request_queue *q, struct gendisk *bd_disk,
 	scsi_req(rq)->cmd[4] = data;
 	scsi_req(rq)->cmd_len = 6;
 	blk_execute_rq(bd_disk, rq, 0);
-	err = scsi_req(rq)->result ? -EIO : 0;
+	err = scsi_req(rq)->status.combined ? -EIO : 0;
 	blk_put_request(rq);
 
 	return err;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux