From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: linux-scsi@vger.kernel.org, tomof@acm.org
Subject: Re: [PATCH 1/5] add scsi_build_sense_buffer helper function
Date: Mon, 24 Mar 2008 12:10:09 -0500 [thread overview]
Message-ID: <1206378609.3494.50.camel@localhost.localdomain> (raw)
In-Reply-To: <1206377695-26084-2-git-send-email-fujita.tomonori@lab.ntt.co.jp>
On Tue, 2008-03-25 at 01:54 +0900, FUJITA Tomonori wrote:
> This adds scsi_build_sense_buffer, a simple helper function to build
> sense data in a buffer.
>
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
> ---
> drivers/scsi/scsi_error.c | 30 ++++++++++++++++++++++++++++++
> include/scsi/scsi_eh.h | 5 ++++-
> 2 files changed, 34 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> index 1221d2c..85add5b 100644
> --- a/drivers/scsi/scsi_error.c
> +++ b/drivers/scsi/scsi_error.c
> @@ -1993,3 +1993,33 @@ int scsi_get_sense_info_fld(const u8 * sense_buffer, int sb_len,
> }
> }
> EXPORT_SYMBOL(scsi_get_sense_info_fld);
> +
> +/**
> + * scsi_build_sense_buffer - build sense data in a buffer
> + * @desc: Sense format (non zero == descriptor format,
> + * 0 == fixed format
> + * @buf: Where to build sense data
> + * @key: Sense key
> + * @asc: Additional sense code
> + * @ascq: Additional sense code qualifier
> + * @addlen: Additional sense length
> + *
> + **/
> +void scsi_build_sense_buffer(int desc, u8 *buf, u8 key, u8 asc, u8 ascq,
> + int addlen)
> +{
> + if (desc) {
> + buf[0] = 0x72; /* descriptor, current */
> + buf[1] = key;
> + buf[2] = asc;
> + buf[3] = ascq;
> + buf[7] = addlen;
> + } else {
> + buf[0] = 0x70; /* fixed, current */
> + buf[2] = key;
> + buf[7] = addlen;
> + buf[12] = asc;
> + buf[13] = ascq;
> + }
This doesn't look quite right ... if you're using this call to
manufacture sense data, you're always doing it at a fixed size, aren't
you (i.e. addlen is always 0 for descriptor format and 10 for fixed
format, isn't it)? So we should just hard code that rather than
requiring it to be passed in.
Also, the libata piece needs to go to linux-ide@vger.kernel.org as well.
James
next prev parent reply other threads:[~2008-03-24 17:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-24 16:54 [PATCH 0/5] sweep up functions to build sense data FUJITA Tomonori
2008-03-24 16:54 ` [PATCH 1/5] add scsi_build_sense_buffer helper function FUJITA Tomonori
2008-03-24 16:54 ` [PATCH 2/5] scsi_debug: use scsi_build_sense_buffer FUJITA Tomonori
2008-03-24 16:54 ` [PATCH 3/5] libata: " FUJITA Tomonori
2008-03-24 16:54 ` [PATCH 4/5] stex: " FUJITA Tomonori
2008-03-24 16:54 ` [PATCH 5/5] ps3rom: " FUJITA Tomonori
2008-03-24 17:10 ` James Bottomley [this message]
2008-03-25 0:48 ` [PATCH 1/5] add scsi_build_sense_buffer helper function FUJITA Tomonori
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=1206378609.3494.50.camel@localhost.localdomain \
--to=james.bottomley@hansenpartnership.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=linux-scsi@vger.kernel.org \
--cc=tomof@acm.org \
/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