Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Enumerations | Functions | Variables
scsi_priv.h File Reference
#include <linux/device.h>
#include <linux/async.h>
#include <scsi/scsi_device.h>

Go to the source code of this file.

Macros

#define SCSI_EH_CANCEL_CMD   0x0001 /* Cancel this cmd */
 
#define SCSI_SENSE_VALID(scmd)   (((scmd)->sense_buffer[0] & 0x70) == 0x70)
 
#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)
 
#define scsi_init_sysctl()   (0)
 
#define scsi_exit_sysctl()   do { } while (0)
 
#define SCSI_DEVICE_BLOCK_MAX_TIMEOUT   600 /* units in seconds */
 

Enumerations

enum  { SCSI_DEVINFO_GLOBAL = 0, SCSI_DEVINFO_SPI }
 

Functions

int scsi_init_hosts (void)
 
void scsi_exit_hosts (void)
 
int scsi_dispatch_cmd (struct scsi_cmnd *cmd)
 
int scsi_setup_command_freelist (struct Scsi_Host *shost)
 
void scsi_destroy_command_freelist (struct Scsi_Host *shost)
 
int scsi_get_device_flags (struct scsi_device *sdev, const unsigned char *vendor, const unsigned char *model)
 
int scsi_get_device_flags_keyed (struct scsi_device *sdev, const unsigned char *vendor, const unsigned char *model, int key)
 
int scsi_dev_info_list_add_keyed (int compatible, char *vendor, char *model, char *strflags, int flags, int key)
 
int scsi_dev_info_list_del_keyed (char *vendor, char *model, int key)
 
int scsi_dev_info_add_list (int key, const char *name)
 
int scsi_dev_info_remove_list (int key)
 
int __init scsi_init_devinfo (void)
 
void scsi_exit_devinfo (void)
 
enum blk_eh_timer_return scsi_times_out (struct request *req)
 
int scsi_error_handler (void *host)
 
int scsi_decide_disposition (struct scsi_cmnd *cmd)
 
void scsi_eh_wakeup (struct Scsi_Host *shost)
 
int scsi_eh_scmd_add (struct scsi_cmnd *, int)
 
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)
 
int scsi_noretry_cmd (struct scsi_cmnd *scmd)
 
int scsi_maybe_unblock_host (struct scsi_device *sdev)
 
void scsi_device_unbusy (struct scsi_device *sdev)
 
void scsi_queue_insert (struct scsi_cmnd *cmd, int reason)
 
void scsi_next_command (struct scsi_cmnd *cmd)
 
void scsi_io_completion (struct scsi_cmnd *, unsigned int)
 
void scsi_run_host_queues (struct Scsi_Host *shost)
 
struct request_queuescsi_alloc_queue (struct scsi_device *sdev)
 
int scsi_init_queue (void)
 
void scsi_exit_queue (void)
 
int scsi_complete_async_scans (void)
 
int scsi_scan_host_selected (struct Scsi_Host *, unsigned int, unsigned int, unsigned int, int)
 
void scsi_forget_host (struct Scsi_Host *)
 
void scsi_rescan_device (struct device *)
 
int scsi_sysfs_add_sdev (struct scsi_device *)
 
int scsi_sysfs_add_host (struct Scsi_Host *)
 
int scsi_sysfs_register (void)
 
void scsi_sysfs_unregister (void)
 
void scsi_sysfs_device_initialize (struct scsi_device *)
 
int scsi_sysfs_target_initialize (struct scsi_device *)
 
void __scsi_remove_device (struct scsi_device *)
 
int scsi_internal_device_block (struct scsi_device *sdev)
 
int scsi_internal_device_unblock (struct scsi_device *sdev, enum scsi_device_state new_state)
 

Variables

struct kmem_cachescsi_sdb_cache
 
struct scsi_transport_template blank_transport_template
 
struct bus_type scsi_bus_type
 
struct attribute_groupscsi_sysfs_shost_attr_groups []
 
struct async_domain scsi_sd_probe_domain
 

Macro Definition Documentation

#define SCSI_DEVICE_BLOCK_MAX_TIMEOUT   600 /* units in seconds */

Definition at line 174 of file scsi_priv.h.

#define SCSI_EH_CANCEL_CMD   0x0001 /* Cancel this cmd */

Definition at line 21 of file scsi_priv.h.

#define scsi_exit_procfs (   void)    do { } while (0)

Definition at line 109 of file scsi_priv.h.

#define scsi_exit_sysctl (   void)    do { } while (0)

Definition at line 125 of file scsi_priv.h.

#define scsi_init_procfs (   void)    (0)

Definition at line 108 of file scsi_priv.h.

#define scsi_init_sysctl (   void)    (0)

Definition at line 124 of file scsi_priv.h.

#define scsi_proc_host_add (   shost)    do { } while (0)

Definition at line 106 of file scsi_priv.h.

#define scsi_proc_host_rm (   shost)    do { } while (0)

Definition at line 107 of file scsi_priv.h.

#define scsi_proc_hostdir_add (   sht)    do { } while (0)

Definition at line 104 of file scsi_priv.h.

#define scsi_proc_hostdir_rm (   sht)    do { } while (0)

Definition at line 105 of file scsi_priv.h.

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

Definition at line 23 of file scsi_priv.h.

Enumeration Type Documentation

anonymous enum
Enumerator:
SCSI_DEVINFO_GLOBAL 
SCSI_DEVINFO_SPI 

Definition at line 47 of file scsi_priv.h.

Function Documentation

void __scsi_remove_device ( struct scsi_device )

Definition at line 956 of file scsi_sysfs.c.

struct request_queue* scsi_alloc_queue ( struct scsi_device sdev)
read

Definition at line 1718 of file scsi_lib.c.

int scsi_complete_async_scans ( void  )

scsi_complete_async_scans - Wait for asynchronous scans to complete

When this function returns, any host which started scanning before this function was called will have finished its scan. Hosts which started scanning after this function was called may or may not have finished.

Definition at line 144 of file scsi_scan.c.

int scsi_decide_disposition ( struct scsi_cmnd scmd)

scsi_decide_disposition - Disposition a cmd on return from LLD. : SCSI cmd to examine.

Notes: This is only called when we are examining the status after sending out the actual data command. any commands that are queued for error recovery (e.g. test_unit_ready) do not come through here.

When this routine returns failed, it means the error handler thread is woken. In cases where the error code indicates an error that doesn't require the error handler read (i.e. we don't need to abort/reset), this function should return SUCCESS.

Definition at line 1427 of file scsi_error.c.

void scsi_destroy_command_freelist ( struct Scsi_Host shost)

scsi_destroy_command_freelist - Release the command freelist for a scsi host. : host whose freelist is going to be destroyed

Definition at line 515 of file scsi.c.

int scsi_dev_info_add_list ( int  key,
const char name 
)

Definition at line 795 of file scsi_devinfo.c.

int scsi_dev_info_list_add_keyed ( int  compatible,
char vendor,
char model,
char strflags,
int  flags,
int  key 
)

scsi_dev_info_list_add_keyed - add one dev_info list entry. : if true, null terminate short strings. Otherwise space pad. : vendor string : model (product) string : integer string : if strflags NULL, use this flag value : specify list to use

Description: Create and add one dev_info entry for , , or in list specified by . If , add to the tail of the list, do not space pad, and set devinfo->compatible. The scsi_static_device_list entries are added with 1 and NULL.

Returns: 0 OK, -error on failure.

Definition at line 348 of file scsi_devinfo.c.

int scsi_dev_info_list_del_keyed ( char vendor,
char model,
int  key 
)

scsi_dev_info_list_del_keyed - remove one dev_info list entry. : vendor string : model (product) string : specify list to use

Description: Remove and destroy one dev_info entry for , in list specified by .

Returns: 0 OK, -error on failure.

Definition at line 399 of file scsi_devinfo.c.

int scsi_dev_info_remove_list ( int  key)

scsi_dev_info_remove_list - destroy an added devinfo list : key of the list to destroy

Iterates over the entire list first, freeing all the values, then frees the list itself. Returns 0 on success or -EINVAL if the key can't be found.

Definition at line 827 of file scsi_devinfo.c.

void scsi_device_unbusy ( struct scsi_device sdev)

Definition at line 318 of file scsi_lib.c.

int scsi_dispatch_cmd ( struct scsi_cmnd cmd)

scsi_dispatch_command - Dispatch a command to the low-level driver. : command block we are dispatching.

Return: nonzero return request was rejected and device's queue needs to be plugged.

Definition at line 658 of file scsi.c.

int scsi_eh_get_sense ( struct list_head work_q,
struct list_head done_q 
)

scsi_eh_get_sense - Get device sense data. : Queue of commands to process. : Queue of processed commands.

Description: See if we need to request sense information. if so, then get it now, so we have a better idea of what to do.

Notes: This has the unfortunate side effect that if a shost adapter does not automatically request sense information, we end up shutting it down before we request it.

All drivers should request sense information internally these days, so for now all I have to say is tough noogies if you end up in here.

XXX: Long term this code should go away, but that needs an audit of all LLDDs first.

Definition at line 910 of file scsi_error.c.

void scsi_eh_ready_devs ( struct Scsi_Host shost,
struct list_head work_q,
struct list_head done_q 
)

scsi_eh_ready_devs - check device ready state and recover if not. : host to be recovered. : &list_head for pending commands. : &list_head for processed commands.

Definition at line 1724 of file scsi_error.c.

int scsi_eh_scmd_add ( struct scsi_cmnd scmd,
int  eh_flag 
)

scsi_eh_scmd_add - add scsi cmd to error handling. : scmd to run eh on. : optional SCSI_EH flag.

Return value: 0 on failure.

Definition at line 99 of file scsi_error.c.

void scsi_eh_wakeup ( struct Scsi_Host shost)

Definition at line 59 of file scsi_error.c.

int scsi_error_handler ( void data)

scsi_error_handler - SCSI error handler thread : Host for which we are running.

Notes: This is the main error handling loop. This is run as a kernel thread for every SCSI host and handles all error handling activity.

Definition at line 1823 of file scsi_error.c.

void scsi_exit_devinfo ( void  )

scsi_exit_devinfo - remove /proc/scsi/device_info & the scsi_dev_info_list

Definition at line 778 of file scsi_devinfo.c.

void scsi_exit_hosts ( void  )

Definition at line 534 of file hosts.c.

void scsi_exit_queue ( void  )

Definition at line 1830 of file scsi_lib.c.

void scsi_forget_host ( struct Scsi_Host )

Definition at line 1884 of file scsi_scan.c.

int scsi_get_device_flags ( struct scsi_device sdev,
const unsigned char vendor,
const unsigned char model 
)

get_device_flags - get device specific flags from the dynamic device list. : &scsi_device to get flags for : vendor name : model name

Description: Search the global scsi_dev_info_list (specified by list zero) for an entry matching and , if found, return the matching flags value, else return the host or global default settings. Called during scan time.

Definition at line 535 of file scsi_devinfo.c.

int scsi_get_device_flags_keyed ( struct scsi_device sdev,
const unsigned char vendor,
const unsigned char model,
int  key 
)

scsi_get_device_flags_keyed - get device specific flags from the dynamic device list : &scsi_device to get flags for : vendor name : model name : list to look up

Description: Search the scsi_dev_info_list specified by for an entry matching and , if found, return the matching flags value, else return the host or global default settings. Called during scan time.

Definition at line 557 of file scsi_devinfo.c.

int __init scsi_init_devinfo ( void  )

scsi_init_devinfo - set up the dynamic device list.

Description: Add command line entries from scsi_dev_flags, then add scsi_static_device_list entries to the scsi device info list.

Definition at line 860 of file scsi_devinfo.c.

int scsi_init_hosts ( void  )

Definition at line 529 of file hosts.c.

int scsi_init_queue ( void  )

Definition at line 1782 of file scsi_lib.c.

int scsi_internal_device_block ( struct scsi_device sdev)

scsi_internal_device_block - internal function to put a device temporarily into the SDEV_BLOCK state : device to block

Block request made by scsi lld's to temporarily stop all scsi commands on the specified device. Called from interrupt or normal process context.

Returns zero if successful or error if not

Notes: This routine transitions the device to the SDEV_BLOCK state (which must be a legal transition). When the device is in this state, all commands are deferred until the scsi lld reenables the device with scsi_device_unblock or device_block_tmo fires.

Definition at line 2434 of file scsi_lib.c.

int scsi_internal_device_unblock ( struct scsi_device sdev,
enum scsi_device_state  new_state 
)

scsi_internal_device_unblock - resume a device after a block request : device to resume : state to set devices to after unblocking

Called by scsi lld's or the midlayer to restart the device queue for the previously suspended scsi device. Called from interrupt or normal process context.

Returns zero if successful or error if not.

Notes: This routine transitions the device to the SDEV_RUNNING state or to one of the offline states (which must be a legal transition) allowing the midlayer to goose the queue for this device.

Definition at line 2478 of file scsi_lib.c.

void scsi_io_completion ( struct scsi_cmnd ,
unsigned  int 
)

Definition at line 759 of file scsi_lib.c.

int scsi_maybe_unblock_host ( struct scsi_device sdev)
void scsi_next_command ( struct scsi_cmnd cmd)

Definition at line 520 of file scsi_lib.c.

int scsi_noretry_cmd ( struct scsi_cmnd scmd)

scsi_noretry_cmd - determinte if command should be failed fast : SCSI cmd to examine.

Definition at line 1381 of file scsi_error.c.

void scsi_queue_insert ( struct scsi_cmnd cmd,
int  reason 
)

Definition at line 204 of file scsi_lib.c.

void scsi_rescan_device ( struct device )

Definition at line 1550 of file scsi_scan.c.

void scsi_run_host_queues ( struct Scsi_Host shost)

Definition at line 535 of file scsi_lib.c.

int scsi_scan_host_selected ( struct Scsi_Host ,
unsigned  int,
unsigned  int,
unsigned  int,
int   
)

Definition at line 1683 of file scsi_scan.c.

int scsi_setup_command_freelist ( struct Scsi_Host shost)

scsi_setup_command_freelist - Setup the command freelist for a scsi host. : host to allocate the freelist for.

Description: The command freelist protects against system-wide out of memory deadlock by preallocating one SCSI command structure for each host, so the system can always write to a swap file on a device associated with that host.

Returns: Nothing.

Definition at line 485 of file scsi.c.

int scsi_sysfs_add_host ( struct Scsi_Host shost)

scsi_sysfs_add_host - add scsi host to subsystem : scsi host struct to add to subsystem

Definition at line 1082 of file scsi_sysfs.c.

int scsi_sysfs_add_sdev ( struct scsi_device sdev)

scsi_sysfs_add_sdev - add scsi device to sysfs : scsi_device to add

Return value: 0 on Success / non-zero on Failure

Definition at line 870 of file scsi_sysfs.c.

void scsi_sysfs_device_initialize ( struct scsi_device )

Definition at line 1107 of file scsi_sysfs.c.

int scsi_sysfs_register ( void  )

Definition at line 426 of file scsi_sysfs.c.

int scsi_sysfs_target_initialize ( struct scsi_device )
void scsi_sysfs_unregister ( void  )

Definition at line 440 of file scsi_sysfs.c.

enum blk_eh_timer_return scsi_times_out ( struct request req)

scsi_times_out - Timeout function for normal scsi commands. : request that is timing out.

Notes: We do not need to lock this. There is the potential for a race only in that the normal completion handling might run, but if the normal completion function determines that the timer has already fired, then it mustn't do anything.

Definition at line 133 of file scsi_error.c.

Variable Documentation

struct scsi_transport_template blank_transport_template

Definition at line 1140 of file scsi_sysfs.c.

struct bus_type scsi_bus_type

Definition at line 416 of file scsi_sysfs.c.

struct async_domain scsi_sd_probe_domain
struct kmem_cache* scsi_sdb_cache

Definition at line 69 of file scsi_lib.c.

struct attribute_group* scsi_sysfs_shost_attr_groups[]

Definition at line 321 of file scsi_sysfs.c.