linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
	James Bottomley <james.bottomley@hansenpartnership.com>,
	linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>
Subject: [PATCH 08/24] sg: use SAM status definitions and avoid using masked_status
Date: Thu, 31 Oct 2019 12:04:36 +0100	[thread overview]
Message-ID: <20191031110452.73463-9-hare@suse.de> (raw)
In-Reply-To: <20191031110452.73463-1-hare@suse.de>

Use standard SAM status definitions and avoid using masked status
values.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/sg.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index e88fb3daebcc..60ff388d04b9 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -503,7 +503,7 @@ sg_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
 	old_hdr->target_status = hp->masked_status;
 	old_hdr->host_status = hp->host_status;
 	old_hdr->driver_status = hp->driver_status;
-	if ((CHECK_CONDITION & hp->masked_status) ||
+	if ((SAM_STAT_CHECK_CONDITION & hp->status) ||
 	    (DRIVER_SENSE & hp->driver_status))
 		memcpy(old_hdr->sense_buffer, srp->sense_b,
 		       sizeof (old_hdr->sense_buffer));
@@ -529,7 +529,7 @@ sg_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
 		break;
 	case DID_ERROR:
 		old_hdr->result = (srp->sense_b[0] == 0 && 
-				  hp->masked_status == GOOD) ? 0 : EIO;
+				  hp->status == SAM_STAT_GOOD) ? 0 : EIO;
 		break;
 	default:
 		old_hdr->result = EIO;
@@ -574,7 +574,7 @@ sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp)
 	}
 	hp->sb_len_wr = 0;
 	if ((hp->mx_sb_len > 0) && hp->sbp) {
-		if ((CHECK_CONDITION & hp->masked_status) ||
+		if ((SAM_STAT_CHECK_CONDITION & hp->status) ||
 		    (DRIVER_SENSE & hp->driver_status)) {
 			int sb_len = SCSI_SENSE_BUFFERSIZE;
 			sb_len = (hp->mx_sb_len > sb_len) ? sb_len : hp->mx_sb_len;
@@ -587,7 +587,7 @@ sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp)
 			hp->sb_len_wr = len;
 		}
 	}
-	if (hp->masked_status || hp->host_status || hp->driver_status)
+	if (hp->status || hp->host_status || hp->driver_status)
 		hp->info |= SG_INFO_CHECK;
 	if (copy_to_user(buf, hp, SZ_SG_IO_HDR)) {
 		err = -EFAULT;
@@ -873,7 +873,7 @@ sg_fill_request_table(Sg_fd *sfp, sg_req_info_t *rinfo)
 			break;
 		rinfo[val].req_state = srp->done + 1;
 		rinfo[val].problem =
-			srp->header.masked_status &
+			srp->header.status &
 			srp->header.host_status &
 			srp->header.driver_status;
 		if (srp->done)
@@ -1355,8 +1355,8 @@ sg_rq_end_io(struct request *rq, blk_status_t status)
 		srp->header.host_status = host_byte(result);
 		srp->header.driver_status = driver_byte(result);
 		if ((sdp->sgdebug > 0) &&
-		    ((CHECK_CONDITION == srp->header.masked_status) ||
-		     (COMMAND_TERMINATED == srp->header.masked_status)))
+		    ((SAM_STAT_CHECK_CONDITION == srp->header.status) ||
+		     (SAM_STAT_COMMAND_TERMINATED == srp->header.status)))
 			__scsi_print_sense(sdp->device, __func__, sense,
 					   SCSI_SENSE_BUFFERSIZE);
 
-- 
2.16.4


  parent reply	other threads:[~2019-10-31 11:05 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-31 11:04 [PATCHv2 00/24] Revamp SCSI result values Hannes Reinecke
2019-10-31 11:04 ` [PATCH 01/24] aic7xxx,aic79xxx: remove driver-defined SAM status definitions Hannes Reinecke
2019-11-01 16:14   ` Bart Van Assche
2019-10-31 11:04 ` [PATCH 02/24] bfa: drop driver-defined SCSI status codes Hannes Reinecke
2019-11-01 16:15   ` Bart Van Assche
2019-10-31 11:04 ` [PATCH 03/24] wd33c93: use SCSI status Hannes Reinecke
2019-11-01 16:16   ` Bart Van Assche
2019-10-31 11:04 ` [PATCH 04/24] acornscsi: use standard defines Hannes Reinecke
2019-11-01 16:18   ` Bart Van Assche
2019-11-01 16:40     ` Hannes Reinecke
2019-10-31 11:04 ` [PATCH 05/24] scsi: use standard SAM status codes Hannes Reinecke
2019-11-01 16:26   ` Bart Van Assche
2019-11-01 16:54     ` Hannes Reinecke
2019-11-01 18:10       ` Bart Van Assche
2019-10-31 11:04 ` [PATCH 06/24] scsi: change status_byte() to return the standard SCSI status Hannes Reinecke
2019-10-31 11:04 ` [PATCH 07/24] target_core: Fixup target_complete_cmd() usage Hannes Reinecke
2019-11-01 16:29   ` Bart Van Assche
2019-10-31 11:04 ` Hannes Reinecke [this message]
2019-10-31 11:04 ` [PATCH 09/24] scsi: Kill obsolete linux-specific status codes Hannes Reinecke
2019-11-02 13:14   ` kbuild test robot
2019-10-31 11:04 ` [PATCH 10/24] scsi: introduce set_status_byte() Hannes Reinecke
2019-11-01 16:36   ` Bart Van Assche
2019-10-31 11:04 ` [PATCH 11/24] advansys: kill driver_defined status byte accessors Hannes Reinecke
2019-10-31 11:04 ` [PATCH 12/24] scsi: introduce scsi_build_sense() Hannes Reinecke
2019-11-01 16:35   ` Bart Van Assche
2019-10-31 11:04 ` [PATCH 13/24] scsi: Kill DRIVER_SENSE Hannes Reinecke
2019-10-31 11:04 ` [PATCH 14/24] scsi: Kill DRIVER_HARD Hannes Reinecke
2019-10-31 11:04 ` [PATCH 15/24] scsi_error: use DID_TIME_OUT instead of DRIVER_TIMEOUT Hannes Reinecke
2019-10-31 11:04 ` [PATCH 16/24] scsi: Kill DRIVER_TIMEOUT Hannes Reinecke
2019-10-31 11:04 ` [PATCH 17/24] scsi: do not use DRIVER_INVALID Hannes Reinecke
2019-11-02  3:28   ` Finn Thain
2019-10-31 11:04 ` [PATCH 18/24] st: return error code in st_scsi_execute() Hannes Reinecke
2019-10-31 11:04 ` [PATCH 19/24] scsi_ioctl: return error code when blk_rq_map_kern() fails Hannes Reinecke
2019-10-31 11:04 ` [PATCH 20/24] scsi_dh_alua: do not interpret DRIVER_ERROR Hannes Reinecke
2019-10-31 11:04 ` [PATCH 21/24] xen-scsiback: stop using DRIVER_ERROR Hannes Reinecke
2019-10-31 11:04 ` [PATCH 22/24] scsi: " Hannes Reinecke
2019-10-31 11:04 ` [PATCH 23/24] scsi: Kill DRIVER_MEDIA, DRIVER_SOFT, and DRIVER_BUSY Hannes Reinecke
2019-10-31 11:04 ` [PATCH 24/24] scsi: Drop the now obsolete driver_byte definitions Hannes Reinecke
  -- strict thread matches above, loose matches on Subject: below --
2019-10-21  9:52 [PATCH RFC 00/24] scsi: Revamp result values Hannes Reinecke
2019-10-21  9:53 ` [PATCH 08/24] sg: use SAM status definitions and avoid using masked_status Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191031110452.73463-9-hare@suse.de \
    --to=hare@suse.de \
    --cc=hch@lst.de \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).