From: Boaz Harrosh <bharrosh@panasas.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: linux-scsi@vger.kernel.org, tomof@acm.org,
James Bottomley <James.Bottomley@HansenPartnership.com>
Subject: Re: [PATCH v2 1/5] add scsi_build_sense_buffer helper function
Date: Tue, 25 Mar 2008 11:45:27 +0200 [thread overview]
Message-ID: <47E8C9B7.1040406@panasas.com> (raw)
In-Reply-To: <1206404816-21710-1-git-send-email-fujita.tomonori@lab.ntt.co.jp>
On Tue, Mar 25 2008 at 2:26 +0200, FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> 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 | 28 ++++++++++++++++++++++++++++
> include/scsi/scsi_eh.h | 4 +++-
> 2 files changed, 31 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> index 1221d2c..221f31e 100644
> --- a/drivers/scsi/scsi_error.c
> +++ b/drivers/scsi/scsi_error.c
> @@ -1993,3 +1993,31 @@ 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
> + *
> + **/
> +void scsi_build_sense_buffer(int desc, u8 *buf, u8 key, u8 asc, u8 ascq)
> +{
> + if (desc) {
> + buf[0] = 0x72; /* descriptor, current */
> + buf[1] = key;
> + buf[2] = asc;
> + buf[3] = ascq;
> + buf[7] = 0;
> + } else {
> + buf[0] = 0x70; /* fixed, current */
> + buf[2] = key;
> + buf[7] = 0xa;
> + buf[12] = asc;
> + buf[13] = ascq;
> + }
> +}
> +EXPORT_SYMBOL(scsi_build_sense_buffer);
> diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
> index 37a7614..d3a133b 100644
> --- a/include/scsi/scsi_eh.h
> +++ b/include/scsi/scsi_eh.h
> @@ -57,7 +57,9 @@ extern const u8 * scsi_sense_desc_find(const u8 * sense_buffer, int sb_len,
>
> extern int scsi_get_sense_info_fld(const u8 * sense_buffer, int sb_len,
> u64 * info_out);
> -
> +
> +extern void scsi_build_sense_buffer(int desc, u8 *buf, u8 key, u8 asc, u8 ascq);
> +
> /*
> * Reset request from external source
> */
Tomo Hi.
Thanks for doing this. It was requested before by few people.
I have one small request please? This is to help me with my "sense" effort.
(See here: http://git.open-osd.org/gitweb.cgi?p=open-osd.git;a=shortlog;h=boaz_sense_effort)
Could you change it that a struct scsi_cmnd * is passed to the new API, instead of the
u8 * directly. This is because I'm removing the buffer at scsi_cmnd. Something like:
extern void scsi_build_sense_buffer(struct scsi_cmnd *, int desc, u8 key, u8 asc, u8 ascq);
If you do this then my patches get that much smaller.
Thanks
Boaz
next prev parent reply other threads:[~2008-03-25 9:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-25 0:26 [PATCH v2 1/5] add scsi_build_sense_buffer helper function FUJITA Tomonori
2008-03-25 0:26 ` [PATCH v2 2/5] scsi_debug: use scsi_build_sense_buffer FUJITA Tomonori
2008-03-25 0:26 ` [PATCH v2 3/5] libata: " FUJITA Tomonori
2008-03-25 0:26 ` [PATCH v2 4/5] stex: " FUJITA Tomonori
2008-03-25 0:26 ` [PATCH v2 5/5] ps3rom: " FUJITA Tomonori
2008-03-25 12:17 ` Geert Uytterhoeven
2008-03-25 22:44 ` [PATCH v2 4/5] stex: " Ed Lin
2008-03-25 9:45 ` Boaz Harrosh [this message]
2008-03-25 10:01 ` [PATCH v2 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=47E8C9B7.1040406@panasas.com \
--to=bharrosh@panasas.com \
--cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.