scsi_priv.h 5.0 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6
#ifndef _SCSI_PRIV_H
#define _SCSI_PRIV_H

#include <linux/device.h>

struct request_queue;
J
Jens Axboe 已提交
7
struct request;
L
Linus Torvalds 已提交
8 9 10 11
struct scsi_cmnd;
struct scsi_device;
struct scsi_host_template;
struct Scsi_Host;
12
struct scsi_nl_hdr;
L
Linus Torvalds 已提交
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41


/*
 * Scsi Error Handler Flags
 */
#define SCSI_EH_CANCEL_CMD	0x0001	/* Cancel this cmd */

#define SCSI_SENSE_VALID(scmd) \
	(((scmd)->sense_buffer[0] & 0x70) == 0x70)

/* hosts.c */
extern int scsi_init_hosts(void);
extern void scsi_exit_hosts(void);

/* scsi.c */
extern int scsi_dispatch_cmd(struct scsi_cmnd *cmd);
extern int scsi_setup_command_freelist(struct Scsi_Host *shost);
extern void scsi_destroy_command_freelist(struct Scsi_Host *shost);
#ifdef CONFIG_SCSI_LOGGING
void scsi_log_send(struct scsi_cmnd *cmd);
void scsi_log_completion(struct scsi_cmnd *cmd, int disposition);
#else
static inline void scsi_log_send(struct scsi_cmnd *cmd) 
	{ };
static inline void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
	{ };
#endif

/* scsi_devinfo.c */
42 43 44 45 46 47

/* list of keys for the lists */
enum {
	SCSI_DEVINFO_GLOBAL = 0,
};

L
Linus Torvalds 已提交
48
extern int scsi_get_device_flags(struct scsi_device *sdev,
49 50
				 const unsigned char *vendor,
				 const unsigned char *model);
51 52 53 54 55 56 57 58 59
extern int scsi_get_device_flags_keyed(struct scsi_device *sdev,
				       const unsigned char *vendor,
				       const unsigned char *model, int key);
extern int scsi_dev_info_list_add_keyed(int compatible, char *vendor,
					char *model, char *strflags,
					int flags, int key);
extern int scsi_dev_info_add_list(int key, const char *name);
extern int scsi_dev_info_remove_list(int key);

L
Linus Torvalds 已提交
60 61 62 63
extern int __init scsi_init_devinfo(void);
extern void scsi_exit_devinfo(void);

/* scsi_error.c */
J
Jens Axboe 已提交
64
extern enum blk_eh_timer_return scsi_times_out(struct request *req);
L
Linus Torvalds 已提交
65 66 67 68
extern int scsi_error_handler(void *host);
extern int scsi_decide_disposition(struct scsi_cmnd *cmd);
extern void scsi_eh_wakeup(struct Scsi_Host *shost);
extern int scsi_eh_scmd_add(struct scsi_cmnd *, int);
69 70 71 72 73
void scsi_eh_ready_devs(struct Scsi_Host *shost,
			struct list_head *work_q,
			struct list_head *done_q);
int scsi_eh_get_sense(struct list_head *work_q,
		      struct list_head *done_q);
74
int scsi_noretry_cmd(struct scsi_cmnd *scmd);
L
Linus Torvalds 已提交
75 76 77 78 79 80

/* scsi_lib.c */
extern int scsi_maybe_unblock_host(struct scsi_device *sdev);
extern void scsi_device_unbusy(struct scsi_device *sdev);
extern int scsi_queue_insert(struct scsi_cmnd *cmd, int reason);
extern void scsi_next_command(struct scsi_cmnd *cmd);
81
extern void scsi_io_completion(struct scsi_cmnd *, unsigned int);
L
Linus Torvalds 已提交
82 83 84 85 86
extern void scsi_run_host_queues(struct Scsi_Host *shost);
extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev);
extern void scsi_free_queue(struct request_queue *q);
extern int scsi_init_queue(void);
extern void scsi_exit_queue(void);
87 88 89
struct request_queue;
struct request;
extern int scsi_prep_fn(struct request_queue *, struct request *);
90
extern struct kmem_cache *scsi_sdb_cache;
L
Linus Torvalds 已提交
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131

/* scsi_proc.c */
#ifdef CONFIG_SCSI_PROC_FS
extern void scsi_proc_hostdir_add(struct scsi_host_template *);
extern void scsi_proc_hostdir_rm(struct scsi_host_template *);
extern void scsi_proc_host_add(struct Scsi_Host *);
extern void scsi_proc_host_rm(struct Scsi_Host *);
extern int scsi_init_procfs(void);
extern void scsi_exit_procfs(void);
#else
# define scsi_proc_hostdir_add(sht)	do { } while (0)
# define scsi_proc_hostdir_rm(sht)	do { } while (0)
# define scsi_proc_host_add(shost)	do { } while (0)
# define scsi_proc_host_rm(shost)	do { } while (0)
# define scsi_init_procfs()		(0)
# define scsi_exit_procfs()		do { } while (0)
#endif /* CONFIG_PROC_FS */

/* scsi_scan.c */
extern int scsi_scan_host_selected(struct Scsi_Host *, unsigned int,
				   unsigned int, unsigned int, int);
extern void scsi_forget_host(struct Scsi_Host *);
extern void scsi_rescan_device(struct device *);

/* scsi_sysctl.c */
#ifdef CONFIG_SYSCTL
extern int scsi_init_sysctl(void);
extern void scsi_exit_sysctl(void);
#else
# define scsi_init_sysctl()		(0)
# define scsi_exit_sysctl()		do { } while (0)
#endif /* CONFIG_SYSCTL */

/* scsi_sysfs.c */
extern int scsi_sysfs_add_sdev(struct scsi_device *);
extern int scsi_sysfs_add_host(struct Scsi_Host *);
extern int scsi_sysfs_register(void);
extern void scsi_sysfs_unregister(void);
extern void scsi_sysfs_device_initialize(struct scsi_device *);
extern int scsi_sysfs_target_initialize(struct scsi_device *);
extern struct scsi_transport_template blank_transport_template;
132
extern void __scsi_remove_device(struct scsi_device *);
L
Linus Torvalds 已提交
133 134

extern struct bus_type scsi_bus_type;
135
extern struct attribute_group *scsi_sysfs_shost_attr_groups[];
L
Linus Torvalds 已提交
136

137 138 139 140 141 142 143 144 145 146
/* scsi_netlink.c */
#ifdef CONFIG_SCSI_NETLINK
extern void scsi_netlink_init(void);
extern void scsi_netlink_exit(void);
extern struct sock *scsi_nl_sock;
#else
static inline void scsi_netlink_init(void) {}
static inline void scsi_netlink_exit(void) {}
#endif

L
Linus Torvalds 已提交
147 148 149 150 151
/* 
 * internal scsi timeout functions: for use by mid-layer and transport
 * classes.
 */

J
James Smart 已提交
152
#define SCSI_DEVICE_BLOCK_MAX_TIMEOUT	600	/* units in seconds */
L
Linus Torvalds 已提交
153 154 155 156
extern int scsi_internal_device_block(struct scsi_device *sdev);
extern int scsi_internal_device_unblock(struct scsi_device *sdev);

#endif /* _SCSI_PRIV_H */