From: Douglas Gilbert <dougg@torque.net>
To: Luben Tuikov <luben@splentec.com>
Cc: linux-scsi <linux-scsi@vger.kernel.org>
Subject: Re: status as in SAM2
Date: Sat, 25 May 2002 18:54:31 -0400 [thread overview]
Message-ID: <3CF01627.3C6866C@torque.net> (raw)
In-Reply-To: 3CEE5837.CECADF71@splentec.com
Luben Tuikov wrote:
>
> Hello there.
>
> Given SCpnt->result and that queuecommand() has
> returned with error or done() was called,
> how can I find out the status byte as per SAM2,
> given SCpnt->result?
>
> Is it just ``status_byte(SCpnt->result)''?
> (macro defined in scsi.h)
Luben,
The actual scsi status (bits as defined in SAM-2 and
elsewhere) is given by the expression:
(0xff & SCpnt->result)
Traditionally linux has used a one bit shifted and masked
version of this called internally the "status_byte" which
is the macro you referred to:
#define status_byte(result) (((result) >> 1) & 0x1f)
It masks "vendor" bits (in SCSI 2) which were bits 0, 6
and 7. This is dangerous since SAM-2 now uses bit 6:
0x40 ----> Task Aborted
and states all bit patterns other than those in Table 22
(Status codes) [SAM-2 draft T10/1157-D revision 23] are
reserved. I guess that stops vendors using bits 0 and
7. Has anyone every seen those bits used?
Perhaps it is time (in lk 2.5) to get rid of the current
status_byte macro "cleverness", change it to:
#define status_byte(result) ((result) & 0xff)
and change the "offset" defines for CHECK_CONDITION and
friends in include/scsi/scsi.h to their SAM-2 values.
Alternatively new defines could be introduced prefixed
with "SCSI_" for the standard values. The sg driver is
the only scsi interface that I'm aware of that exposes
the result of the status_byte() macro to the user space
and it could be set up not to surprise existing applications.
Doug Gilbert
next prev parent reply other threads:[~2002-05-25 22:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-24 15:11 status as in SAM2 Luben Tuikov
2002-05-25 22:54 ` Douglas Gilbert [this message]
2002-05-26 22:33 ` Luben Tuikov
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=3CF01627.3C6866C@torque.net \
--to=dougg@torque.net \
--cc=linux-scsi@vger.kernel.org \
--cc=luben@splentec.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).