aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/constants.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/constants.c')
-rw-r--r--drivers/scsi/constants.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index 0d58d3538bdf..f6be2c1c3942 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -1156,6 +1156,31 @@ scsi_show_extd_sense(unsigned char asc, unsigned char ascq)
1156 } 1156 }
1157} 1157}
1158 1158
1159void
1160scsi_print_sense_hdr(const char *name, struct scsi_sense_hdr *sshdr)
1161{
1162 const char *sense_txt;
1163 /* An example of deferred is when an earlier write to disk cache
1164 * succeeded, but now the disk discovers that it cannot write the
1165 * data to the magnetic media.
1166 */
1167 const char *error = scsi_sense_is_deferred(sshdr) ?
1168 "<<DEFERRED>>" : "Current";
1169 printk(KERN_INFO "%s: %s", name, error);
1170 if (sshdr->response_code >= 0x72)
1171 printk(" [descriptor]");
1172
1173 sense_txt = scsi_sense_key_string(sshdr->sense_key);
1174 if (sense_txt)
1175 printk(": sense key: %s\n", sense_txt);
1176 else
1177 printk(": sense key=0x%x\n", sshdr->sense_key);
1178 printk(KERN_INFO " ");
1179 scsi_show_extd_sense(sshdr->asc, sshdr->ascq);
1180 printk("\n");
1181}
1182EXPORT_SYMBOL(scsi_print_sense_hdr);
1183
1159/* Print sense information */ 1184/* Print sense information */
1160void 1185void
1161__scsi_print_sense(const char *name, const unsigned char *sense_buffer, 1186__scsi_print_sense(const char *name, const unsigned char *sense_buffer,
@@ -1163,8 +1188,6 @@ __scsi_print_sense(const char *name, const unsigned char *sense_buffer,
1163{ 1188{
1164 int k, num, res; 1189 int k, num, res;
1165 unsigned int info; 1190 unsigned int info;
1166 const char *error;
1167 const char *sense_txt;
1168 struct scsi_sense_hdr ssh; 1191 struct scsi_sense_hdr ssh;
1169 1192
1170 res = scsi_normalize_sense(sense_buffer, sense_len, &ssh); 1193 res = scsi_normalize_sense(sense_buffer, sense_len, &ssh);
@@ -1182,26 +1205,7 @@ __scsi_print_sense(const char *name, const unsigned char *sense_buffer,
1182 printk("\n"); 1205 printk("\n");
1183 return; 1206 return;
1184 } 1207 }
1185 1208 scsi_print_sense_hdr(name, &ssh);
1186 /* An example of deferred is when an earlier write to disk cache
1187 * succeeded, but now the disk discovers that it cannot write the
1188 * data to the magnetic media.
1189 */
1190 error = scsi_sense_is_deferred(&ssh) ?
1191 "<<DEFERRED>>" : "Current";
1192 printk(KERN_INFO "%s: %s", name, error);
1193 if (ssh.response_code >= 0x72)
1194 printk(" [descriptor]");
1195
1196 sense_txt = scsi_sense_key_string(ssh.sense_key);
1197 if (sense_txt)
1198 printk(": sense key: %s\n", sense_txt);
1199 else
1200 printk(": sense key=0x%x\n", ssh.sense_key);
1201 printk(KERN_INFO " ");
1202 scsi_show_extd_sense(ssh.asc, ssh.ascq);
1203 printk("\n");
1204
1205 if (ssh.response_code < 0x72) { 1209 if (ssh.response_code < 0x72) {
1206 /* only decode extras for "fixed" format now */ 1210 /* only decode extras for "fixed" format now */
1207 char buff[80]; 1211 char buff[80];