Commit ed092cbc authored by Mike Christie's avatar Mike Christie Committed by James Bottomley

[PATCH] export print_sense_internal

Currently, we have scsi_print_sense and scsi_print_req_sense, but the
linux-iscsi driver receives async messages from a target that may
contain SCSI sense data and these messages are not tied to any
specific command. So that we can use the scsi-ml sense printing
capabilities the attached patch exports exports print_sense_internal
and renames it to __scsi_print_sense.
Signed-off-by: default avatarMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 86d429db
...@@ -1156,17 +1156,14 @@ scsi_show_extd_sense(unsigned char asc, unsigned char ascq) ...@@ -1156,17 +1156,14 @@ scsi_show_extd_sense(unsigned char asc, unsigned char ascq)
} }
/* Print sense information */ /* Print sense information */
static void void
print_sense_internal(const char *devclass, __scsi_print_sense(const char *name, const unsigned char *sense_buffer,
const unsigned char *sense_buffer, int sense_len)
int sense_len,
struct request *req)
{ {
int k, num, res; int k, num, res;
unsigned int info; unsigned int info;
const char *error; const char *error;
const char *sense_txt; const char *sense_txt;
const char *name = req->rq_disk ? req->rq_disk->disk_name : devclass;
struct scsi_sense_hdr ssh; struct scsi_sense_hdr ssh;
res = scsi_normalize_sense(sense_buffer, sense_len, &ssh); res = scsi_normalize_sense(sense_buffer, sense_len, &ssh);
...@@ -1254,18 +1251,25 @@ print_sense_internal(const char *devclass, ...@@ -1254,18 +1251,25 @@ print_sense_internal(const char *devclass,
printk("\n"); printk("\n");
} }
} }
EXPORT_SYMBOL(__scsi_print_sense);
void scsi_print_sense(const char *devclass, struct scsi_cmnd *cmd) void scsi_print_sense(const char *devclass, struct scsi_cmnd *cmd)
{ {
print_sense_internal(devclass, cmd->sense_buffer, const char *name = devclass;
SCSI_SENSE_BUFFERSIZE, cmd->request);
if (cmd->request->rq_disk)
name = cmd->request->rq_disk->disk_name;
__scsi_print_sense(name, cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE);
} }
EXPORT_SYMBOL(scsi_print_sense); EXPORT_SYMBOL(scsi_print_sense);
void scsi_print_req_sense(const char *devclass, struct scsi_request *sreq) void scsi_print_req_sense(const char *devclass, struct scsi_request *sreq)
{ {
print_sense_internal(devclass, sreq->sr_sense_buffer, const char *name = devclass;
SCSI_SENSE_BUFFERSIZE, sreq->sr_request);
if (sreq->sr_request->rq_disk)
name = sreq->sr_request->rq_disk->disk_name;
__scsi_print_sense(name, sreq->sr_sense_buffer, SCSI_SENSE_BUFFERSIZE);
} }
EXPORT_SYMBOL(scsi_print_req_sense); EXPORT_SYMBOL(scsi_print_req_sense);
......
...@@ -8,6 +8,9 @@ extern void scsi_print_command(struct scsi_cmnd *); ...@@ -8,6 +8,9 @@ extern void scsi_print_command(struct scsi_cmnd *);
extern void __scsi_print_command(unsigned char *); extern void __scsi_print_command(unsigned char *);
extern void scsi_print_sense(const char *, struct scsi_cmnd *); extern void scsi_print_sense(const char *, struct scsi_cmnd *);
extern void scsi_print_req_sense(const char *, struct scsi_request *); extern void scsi_print_req_sense(const char *, struct scsi_request *);
extern void __scsi_print_sense(const char *name,
const unsigned char *sense_buffer,
int sense_len);
extern void scsi_print_driverbyte(int); extern void scsi_print_driverbyte(int);
extern void scsi_print_hostbyte(int); extern void scsi_print_hostbyte(int);
extern void scsi_print_status(unsigned char); extern void scsi_print_status(unsigned char);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment