aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_error.c
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2008-03-24 20:26:49 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-04-07 13:19:01 -0400
commit3bc6a26192d2548397a3e721d786cf8345ee54e1 (patch)
tree03d14e2549a306c932bed0ee619bc67066631912 /drivers/scsi/scsi_error.c
parentbe3cb3d84bb8dffecb7c5570355866075caa7e95 (diff)
[SCSI] add scsi_build_sense_buffer helper function
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> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/scsi_error.c')
-rw-r--r--drivers/scsi/scsi_error.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 1221d2ca0c64..221f31e36d26 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,
1993 } 1993 }
1994} 1994}
1995EXPORT_SYMBOL(scsi_get_sense_info_fld); 1995EXPORT_SYMBOL(scsi_get_sense_info_fld);
1996
1997/**
1998 * scsi_build_sense_buffer - build sense data in a buffer
1999 * @desc: Sense format (non zero == descriptor format,
2000 * 0 == fixed format)
2001 * @buf: Where to build sense data
2002 * @key: Sense key
2003 * @asc: Additional sense code
2004 * @ascq: Additional sense code qualifier
2005 *
2006 **/
2007void scsi_build_sense_buffer(int desc, u8 *buf, u8 key, u8 asc, u8 ascq)
2008{
2009 if (desc) {
2010 buf[0] = 0x72; /* descriptor, current */
2011 buf[1] = key;
2012 buf[2] = asc;
2013 buf[3] = ascq;
2014 buf[7] = 0;
2015 } else {
2016 buf[0] = 0x70; /* fixed, current */
2017 buf[2] = key;
2018 buf[7] = 0xa;
2019 buf[12] = asc;
2020 buf[13] = ascq;
2021 }
2022}
2023EXPORT_SYMBOL(scsi_build_sense_buffer);