Commit 53554c18 authored by Christoph Hellwig's avatar Christoph Hellwig

[PATCH] move scsi debugging helpers and give them sane names

 - give the constants.c prettyprinting helpers proper scsi_ prefixed
   names (and keep compat versions for 2.6.x)
 - move them to include/scsi/scsi_dbg.h so now really only legacy stuff
   is left in drivers/scsi/scsi.h
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent d3751527
...@@ -152,7 +152,7 @@ static void print_opcode(int opcode) { ...@@ -152,7 +152,7 @@ static void print_opcode(int opcode) {
} }
#endif #endif
void print_command (unsigned char *command) { void __scsi_print_command (unsigned char *command) {
int i,s; int i,s;
print_opcode(command[0]); print_opcode(command[0]);
for ( i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) for ( i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
...@@ -171,7 +171,7 @@ void print_command (unsigned char *command) { ...@@ -171,7 +171,7 @@ void print_command (unsigned char *command) {
* (e.g. "0x2" for Check Condition). * (e.g. "0x2" for Check Condition).
**/ **/
void void
print_status(unsigned char scsi_status) { scsi_print_status(unsigned char scsi_status) {
#if (CONSTANTS & CONST_STATUS) #if (CONSTANTS & CONST_STATUS)
const char * ccp; const char * ccp;
...@@ -1012,12 +1012,12 @@ print_sense_internal(const char *devclass, ...@@ -1012,12 +1012,12 @@ print_sense_internal(const char *devclass,
#endif #endif
} }
void 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, cmd->request); print_sense_internal(devclass, cmd->sense_buffer, cmd->request);
} }
void 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, sreq->sr_request); print_sense_internal(devclass, sreq->sr_sense_buffer, sreq->sr_request);
} }
...@@ -1049,7 +1049,7 @@ static const char *extended_msgs[] = { ...@@ -1049,7 +1049,7 @@ static const char *extended_msgs[] = {
#define NO_EXTENDED_MSGS (sizeof(two_byte_msgs) / sizeof (const char *)) #define NO_EXTENDED_MSGS (sizeof(two_byte_msgs) / sizeof (const char *))
#endif /* (CONSTANTS & CONST_MSG) */ #endif /* (CONSTANTS & CONST_MSG) */
int print_msg (const unsigned char *msg) { int scsi_print_msg (const unsigned char *msg) {
int len = 0, i; int len = 0, i;
if (msg[0] == EXTENDED_MESSAGE) { if (msg[0] == EXTENDED_MESSAGE) {
len = 3 + msg[1]; len = 3 + msg[1];
...@@ -1122,13 +1122,13 @@ int print_msg (const unsigned char *msg) { ...@@ -1122,13 +1122,13 @@ int print_msg (const unsigned char *msg) {
return len; return len;
} }
void print_Scsi_Cmnd(struct scsi_cmnd *cmd) { void scsi_print_command(struct scsi_cmnd *cmd) {
printk("scsi%d : destination target %d, lun %d\n", printk("scsi%d : destination target %d, lun %d\n",
cmd->device->host->host_no, cmd->device->host->host_no,
cmd->device->id, cmd->device->id,
cmd->device->lun); cmd->device->lun);
printk(" command = "); printk(" command = ");
print_command(cmd->cmnd); __scsi_print_command(cmd->cmnd);
} }
#if (CONSTANTS & CONST_HOST) #if (CONSTANTS & CONST_HOST)
...@@ -1137,7 +1137,7 @@ static const char * hostbyte_table[]={ ...@@ -1137,7 +1137,7 @@ static const char * hostbyte_table[]={
"DID_ABORT", "DID_PARITY", "DID_ERROR", "DID_RESET", "DID_BAD_INTR", "DID_ABORT", "DID_PARITY", "DID_ERROR", "DID_RESET", "DID_BAD_INTR",
"DID_PASSTHROUGH", "DID_SOFT_ERROR", "DID_IMM_RETRY", NULL}; "DID_PASSTHROUGH", "DID_SOFT_ERROR", "DID_IMM_RETRY", NULL};
void print_hostbyte(int scsiresult) void scsi_print_hostbyte(int scsiresult)
{ static int maxcode=0; { static int maxcode=0;
int i; int i;
...@@ -1153,7 +1153,7 @@ void print_hostbyte(int scsiresult) ...@@ -1153,7 +1153,7 @@ void print_hostbyte(int scsiresult)
printk("(%s) ",hostbyte_table[host_byte(scsiresult)]); printk("(%s) ",hostbyte_table[host_byte(scsiresult)]);
} }
#else #else
void print_hostbyte(int scsiresult) void scsi_print_hostbyte(int scsiresult)
{ printk("Hostbyte=0x%02x ",host_byte(scsiresult)); { printk("Hostbyte=0x%02x ",host_byte(scsiresult));
} }
#endif #endif
...@@ -1168,7 +1168,7 @@ static const char * driversuggest_table[]={"SUGGEST_OK", ...@@ -1168,7 +1168,7 @@ static const char * driversuggest_table[]={"SUGGEST_OK",
unknown,unknown,unknown, "SUGGEST_SENSE",NULL}; unknown,unknown,unknown, "SUGGEST_SENSE",NULL};
void print_driverbyte(int scsiresult) void scsi_print_driverbyte(int scsiresult)
{ static int driver_max=0,suggest_max=0; { static int driver_max=0,suggest_max=0;
int i,dr=driver_byte(scsiresult)&DRIVER_MASK, int i,dr=driver_byte(scsiresult)&DRIVER_MASK,
su=(driver_byte(scsiresult)&SUGGEST_MASK)>>4; su=(driver_byte(scsiresult)&SUGGEST_MASK)>>4;
...@@ -1185,7 +1185,7 @@ void print_driverbyte(int scsiresult) ...@@ -1185,7 +1185,7 @@ void print_driverbyte(int scsiresult)
su<suggest_max ? driversuggest_table[su]:"invalid"); su<suggest_max ? driversuggest_table[su]:"invalid");
} }
#else #else
void print_driverbyte(int scsiresult) void scsi_print_driverbyte(int scsiresult)
{ printk("Driverbyte=0x%02x ",driver_byte(scsiresult)); { printk("Driverbyte=0x%02x ",driver_byte(scsiresult));
} }
#endif #endif
...@@ -11,6 +11,11 @@ ...@@ -11,6 +11,11 @@
* add scatter-gather, multiple outstanding request, and other * add scatter-gather, multiple outstanding request, and other
* enhancements. * enhancements.
*/ */
/*
* NOTE: this file only contains compatibility glue for old drivers. All
* these wrappers will be removed sooner or later. For new code please use
* the interfaces declared in the headers in include/scsi/
*/
#ifndef _SCSI_H #ifndef _SCSI_H
#define _SCSI_H #define _SCSI_H
...@@ -18,6 +23,7 @@ ...@@ -18,6 +23,7 @@
#include <linux/config.h> /* for CONFIG_SCSI_LOGGING */ #include <linux/config.h> /* for CONFIG_SCSI_LOGGING */
#include <scsi/scsi_cmnd.h> #include <scsi/scsi_cmnd.h>
#include <scsi/scsi_dbg.h>
#include <scsi/scsi_device.h> #include <scsi/scsi_device.h>
#include <scsi/scsi_eh.h> #include <scsi/scsi_eh.h>
#include <scsi/scsi_request.h> #include <scsi/scsi_request.h>
...@@ -46,21 +52,6 @@ struct scsi_device; ...@@ -46,21 +52,6 @@ struct scsi_device;
struct scsi_target; struct scsi_target;
struct scatterlist; struct scatterlist;
/*
* Prototypes for functions in constants.c
* Some of these used to live in constants.h
*/
extern void print_Scsi_Cmnd(struct scsi_cmnd *);
extern void print_command(unsigned char *);
extern void print_sense(const char *, struct scsi_cmnd *);
extern void print_req_sense(const char *, struct scsi_request *);
extern void print_driverbyte(int scsiresult);
extern void print_hostbyte(int scsiresult);
extern void print_status(unsigned char status);
extern int print_msg(const unsigned char *);
extern const char *scsi_sense_key_string(unsigned char);
extern const char *scsi_extd_sense_format(unsigned char, unsigned char);
/* /*
* Legacy dma direction interfaces. * Legacy dma direction interfaces.
* *
...@@ -76,6 +67,42 @@ extern const char *scsi_extd_sense_format(unsigned char, unsigned char); ...@@ -76,6 +67,42 @@ extern const char *scsi_extd_sense_format(unsigned char, unsigned char);
#define scsi_to_pci_dma_dir(scsi_dir) ((int)(scsi_dir)) #define scsi_to_pci_dma_dir(scsi_dir) ((int)(scsi_dir))
#define scsi_to_sbus_dma_dir(scsi_dir) ((int)(scsi_dir)) #define scsi_to_sbus_dma_dir(scsi_dir) ((int)(scsi_dir))
/*
* Old names for debug prettyprinting functions.
*/
static inline void print_Scsi_Cmnd(struct scsi_cmnd *cmd)
{
return scsi_print_command(cmd);
}
static inline void print_command(unsigned char *cdb)
{
return __scsi_print_command(cdb);
}
static inline void print_sense(const char *devclass, struct scsi_cmnd *cmd)
{
return scsi_print_sense(devclass, cmd);
}
static inline void print_req_sense(const char *devclass, struct scsi_request *req)
{
return scsi_print_req_sense(devclass, req);
}
static inline void print_driverbyte(int scsiresult)
{
return scsi_print_driverbyte(scsiresult);
}
static inline void print_hostbyte(int scsiresult)
{
return scsi_print_hostbyte(scsiresult);
}
static inline void print_status(unsigned char status)
{
return scsi_print_status(status);
}
static inline int print_msg(const unsigned char *msg)
{
return scsi_print_msg(msg);
}
/* /*
* This is the crap from the old error handling code. We have it in a special * This is the crap from the old error handling code. We have it in a special
* place so that we can more easily delete it later on. * place so that we can more easily delete it later on.
......
...@@ -46,15 +46,15 @@ EXPORT_SYMBOL(scsicam_bios_param); ...@@ -46,15 +46,15 @@ EXPORT_SYMBOL(scsicam_bios_param);
EXPORT_SYMBOL(scsi_partsize); EXPORT_SYMBOL(scsi_partsize);
EXPORT_SYMBOL(scsi_bios_ptable); EXPORT_SYMBOL(scsi_bios_ptable);
EXPORT_SYMBOL(scsi_ioctl); EXPORT_SYMBOL(scsi_ioctl);
EXPORT_SYMBOL(print_command); EXPORT_SYMBOL(scsi_print_command);
EXPORT_SYMBOL(print_sense); EXPORT_SYMBOL(__scsi_print_command);
EXPORT_SYMBOL(print_req_sense); EXPORT_SYMBOL(scsi_print_sense);
EXPORT_SYMBOL(print_msg); EXPORT_SYMBOL(scsi_print_req_sense);
EXPORT_SYMBOL(print_status); EXPORT_SYMBOL(scsi_print_msg);
EXPORT_SYMBOL(scsi_print_status);
EXPORT_SYMBOL(scsi_sense_key_string); EXPORT_SYMBOL(scsi_sense_key_string);
EXPORT_SYMBOL(scsi_extd_sense_format); EXPORT_SYMBOL(scsi_extd_sense_format);
EXPORT_SYMBOL(kernel_scsi_ioctl); EXPORT_SYMBOL(kernel_scsi_ioctl);
EXPORT_SYMBOL(print_Scsi_Cmnd);
EXPORT_SYMBOL(scsi_block_when_processing_errors); EXPORT_SYMBOL(scsi_block_when_processing_errors);
EXPORT_SYMBOL(scsi_ioctl_send_command); EXPORT_SYMBOL(scsi_ioctl_send_command);
EXPORT_SYMBOL(scsi_set_medium_removal); EXPORT_SYMBOL(scsi_set_medium_removal);
......
#ifndef _SCSI_SCSI_DBG_H
#define _SCSI_SCSI_DBG_H
struct scsi_cmnd;
struct scsi_request;
extern void scsi_print_command(struct scsi_cmnd *);
extern void __scsi_print_command(unsigned char *);
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_driverbyte(int);
extern void scsi_print_hostbyte(int);
extern void scsi_print_status(unsigned char);
extern int scsi_print_msg(const unsigned char *);
extern const char *scsi_sense_key_string(unsigned char);
extern const char *scsi_extd_sense_format(unsigned char, unsigned char);
#endif /* _SCSI_SCSI_DBG_H */
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