From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
To: James.Bottomley@HansenPartnership.com
Cc: fujita.tomonori@lab.ntt.co.jp, linux-scsi@vger.kernel.org, tomof@acm.org
Subject: Re: [PATCH 1/5] add scsi_build_sense_buffer helper function
Date: Tue, 25 Mar 2008 09:48:32 +0900 [thread overview]
Message-ID: <20080325094740F.tomof@acm.org> (raw)
In-Reply-To: <1206378609.3494.50.camel@localhost.localdomain>
On Mon, 24 Mar 2008 12:10:09 -0500
James Bottomley <James.Bottomley@HansenPartnership.com> wrote:
> 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.
Fixed. I just thought that someone (likely scsi_debug) would build
more complicated sense data but probably nobody will do that (and LLDs
can overwrite the value if necessary).
> Also, the libata piece needs to go to linux-ide@vger.kernel.org as well.
I CC'ed this time.
prev parent reply other threads:[~2008-03-25 0:52 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 ` [PATCH 1/5] add scsi_build_sense_buffer helper function James Bottomley
2008-03-25 0:48 ` FUJITA Tomonori [this message]
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=20080325094740F.tomof@acm.org \
--to=fujita.tomonori@lab.ntt.co.jp \
--cc=James.Bottomley@HansenPartnership.com \
--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.