Merge branch 'hash' of git://ftp.sciencehorizons.net/linux
[linux-2.6-block.git] / include / scsi / scsi_eh.h
... / ...
CommitLineData
1#ifndef _SCSI_SCSI_EH_H
2#define _SCSI_SCSI_EH_H
3
4#include <linux/scatterlist.h>
5
6#include <scsi/scsi_cmnd.h>
7#include <scsi/scsi_common.h>
8struct scsi_device;
9struct Scsi_Host;
10
11extern void scsi_eh_finish_cmd(struct scsi_cmnd *scmd,
12 struct list_head *done_q);
13extern void scsi_eh_flush_done_q(struct list_head *done_q);
14extern void scsi_report_bus_reset(struct Scsi_Host *, int);
15extern void scsi_report_device_reset(struct Scsi_Host *, int, int);
16extern int scsi_block_when_processing_errors(struct scsi_device *);
17extern bool scsi_command_normalize_sense(const struct scsi_cmnd *cmd,
18 struct scsi_sense_hdr *sshdr);
19extern int scsi_check_sense(struct scsi_cmnd *);
20
21static inline bool scsi_sense_is_deferred(const struct scsi_sense_hdr *sshdr)
22{
23 return ((sshdr->response_code >= 0x70) && (sshdr->response_code & 1));
24}
25
26extern int scsi_get_sense_info_fld(const u8 * sense_buffer, int sb_len,
27 u64 * info_out);
28
29extern int scsi_ioctl_reset(struct scsi_device *, int __user *);
30
31struct scsi_eh_save {
32 /* saved state */
33 int result;
34 enum dma_data_direction data_direction;
35 unsigned underflow;
36 unsigned char cmd_len;
37 unsigned char prot_op;
38 unsigned char *cmnd;
39 struct scsi_data_buffer sdb;
40 struct request *next_rq;
41 /* new command support */
42 unsigned char eh_cmnd[BLK_MAX_CDB];
43 struct scatterlist sense_sgl;
44};
45
46extern void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd,
47 struct scsi_eh_save *ses, unsigned char *cmnd,
48 int cmnd_size, unsigned sense_bytes);
49
50extern void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd,
51 struct scsi_eh_save *ses);
52
53#endif /* _SCSI_SCSI_EH_H */