Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
scsi_device.h File Reference
#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/workqueue.h>
#include <linux/blkdev.h>
#include <scsi/scsi.h>
#include <linux/atomic.h>

Go to the source code of this file.

Data Structures

struct  scsi_mode_data
 
struct  scsi_event
 
struct  scsi_device
 
struct  scsi_dh_devlist
 
struct  scsi_device_handler
 
struct  scsi_dh_data
 
struct  scsi_target
 

Macros

#define SCSI_DEFAULT_RAMP_UP_PERIOD   (120 * HZ)
 
#define SCSI_DEFAULT_DEVICE_BLOCKED   3
 
#define to_scsi_device(d)   container_of(d, struct scsi_device, sdev_gendev)
 
#define class_to_sdev(d)   container_of(d, struct scsi_device, sdev_dev)
 
#define transport_class_to_sdev(class_dev)   to_scsi_device(class_dev->parent)
 
#define sdev_printk(prefix, sdev, fmt, a...)   dev_printk(prefix, &(sdev)->sdev_gendev, fmt, ##a)
 
#define scmd_printk(prefix, scmd, fmt, a...)
 
#define SCSI_DEFAULT_TARGET_BLOCKED   3
 
#define to_scsi_target(d)   container_of(d, struct scsi_target, dev)
 
#define transport_class_to_starget(class_dev)   to_scsi_target(class_dev->parent)
 
#define starget_printk(prefix, starget, fmt, a...)   dev_printk(prefix, &(starget)->dev, fmt, ##a)
 
#define shost_for_each_device(sdev, shost)
 
#define __shost_for_each_device(sdev, shost)   list_for_each_entry((sdev), &((shost)->__devices), siblings)
 
#define scmd_id(scmd)   sdev_id((scmd)->device)
 
#define scmd_channel(scmd)   sdev_channel((scmd)->device)
 
#define MODULE_ALIAS_SCSI_DEVICE(type)   MODULE_ALIAS("scsi:t-" __stringify(type) "*")
 
#define SCSI_DEVICE_MODALIAS_FMT   "scsi:t-0x%02x"
 

Typedefs

typedef void(* activate_complete )(void *, int)
 

Enumerations

enum  scsi_device_state {
  SDEV_CREATED = 1, SDEV_RUNNING, SDEV_CANCEL, SDEV_DEL,
  SDEV_QUIESCE, SDEV_OFFLINE, SDEV_TRANSPORT_OFFLINE, SDEV_BLOCK,
  SDEV_CREATED_BLOCK
}
 
enum  scsi_device_event { SDEV_EVT_MEDIA_CHANGE = 1, SDEV_EVT_LAST = SDEV_EVT_MEDIA_CHANGE, SDEV_EVT_MAXBITS = SDEV_EVT_LAST + 1 }
 
enum  scsi_target_state { STARGET_CREATED = 1, STARGET_RUNNING, STARGET_DEL }
 

Functions

struct scsi_device __attribute__ ((aligned(sizeof(unsigned long))))
 
 DECLARE_BITMAP (supported_events, SDEV_EVT_MAXBITS)
 
struct scsi_device__scsi_add_device (struct Scsi_Host *, uint, uint, uint, void *hostdata)
 
int scsi_add_device (struct Scsi_Host *host, uint channel, uint target, uint lun)
 
int scsi_register_device_handler (struct scsi_device_handler *scsi_dh)
 
void scsi_remove_device (struct scsi_device *)
 
int scsi_unregister_device_handler (struct scsi_device_handler *scsi_dh)
 
int scsi_device_get (struct scsi_device *)
 
void scsi_device_put (struct scsi_device *)
 
struct scsi_devicescsi_device_lookup (struct Scsi_Host *, uint, uint, uint)
 
struct scsi_device__scsi_device_lookup (struct Scsi_Host *, uint, uint, uint)
 
struct scsi_devicescsi_device_lookup_by_target (struct scsi_target *, uint)
 
struct scsi_device__scsi_device_lookup_by_target (struct scsi_target *, uint)
 
void starget_for_each_device (struct scsi_target *, void *, void(*fn)(struct scsi_device *, void *))
 
void __starget_for_each_device (struct scsi_target *, void *, void(*fn)(struct scsi_device *, void *))
 
struct scsi_device__scsi_iterate_devices (struct Scsi_Host *, struct scsi_device *)
 
void scsi_adjust_queue_depth (struct scsi_device *, int, int)
 
int scsi_track_queue_full (struct scsi_device *, int)
 
int scsi_set_medium_removal (struct scsi_device *, char)
 
int scsi_mode_sense (struct scsi_device *sdev, int dbd, int modepage, unsigned char *buffer, int len, int timeout, int retries, struct scsi_mode_data *data, struct scsi_sense_hdr *)
 
int scsi_mode_select (struct scsi_device *sdev, int pf, int sp, int modepage, unsigned char *buffer, int len, int timeout, int retries, struct scsi_mode_data *data, struct scsi_sense_hdr *)
 
int scsi_test_unit_ready (struct scsi_device *sdev, int timeout, int retries, struct scsi_sense_hdr *sshdr)
 
int scsi_get_vpd_page (struct scsi_device *, u8 page, unsigned char *buf, int buf_len)
 
int scsi_report_opcode (struct scsi_device *sdev, unsigned char *buffer, unsigned int len, unsigned char opcode)
 
int scsi_device_set_state (struct scsi_device *sdev, enum scsi_device_state state)
 
struct scsi_eventsdev_evt_alloc (enum scsi_device_event evt_type, gfp_t gfpflags)
 
void sdev_evt_send (struct scsi_device *sdev, struct scsi_event *evt)
 
void sdev_evt_send_simple (struct scsi_device *sdev, enum scsi_device_event evt_type, gfp_t gfpflags)
 
int scsi_device_quiesce (struct scsi_device *sdev)
 
void scsi_device_resume (struct scsi_device *sdev)
 
void scsi_target_quiesce (struct scsi_target *)
 
void scsi_target_resume (struct scsi_target *)
 
void scsi_scan_target (struct device *parent, unsigned int channel, unsigned int id, unsigned int lun, int rescan)
 
void scsi_target_reap (struct scsi_target *)
 
void scsi_target_block (struct device *)
 
void scsi_target_unblock (struct device *, enum scsi_device_state)
 
void scsi_remove_target (struct device *)
 
void int_to_scsilun (unsigned int, struct scsi_lun *)
 
int scsilun_to_int (struct scsi_lun *)
 
const charscsi_device_state_name (enum scsi_device_state)
 
int scsi_is_sdev_device (const struct device *)
 
int scsi_is_target_device (const struct device *)
 
int scsi_execute (struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, unsigned char *sense, int timeout, int retries, int flag, int *resid)
 
int scsi_execute_req (struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, struct scsi_sense_hdr *, int timeout, int retries, int *resid)
 

Variables

struct Scsi_Hosthost
 
struct request_queue * request_queue
 
struct list_head siblings
 
struct list_head same_target_siblings
 
unsigned int device_busy
 
spinlock_t list_lock
 
struct list_head cmd_list
 
struct list_head starved_entry
 
struct scsi_cmndcurrent_cmnd
 
unsigned short queue_depth
 
unsigned short max_queue_depth
 
unsigned short last_queue_full_depth
 
unsigned short last_queue_full_count
 
unsigned long last_queue_full_time
 
unsigned long queue_ramp_up_period
 
unsigned long last_queue_ramp_up
 
unsigned int id
 
unsigned int lun
 
unsigned int channel
 
unsigned int manufacturer
 
unsigned sector_size
 
voidhostdata
 
char type
 
char scsi_level
 
char inq_periph_qual
 
unsigned char inquiry_len
 
unsigned charinquiry
 
const charvendor
 
const charmodel
 
const charrev
 
unsigned char current_tag
 
struct scsi_targetsdev_target
 
unsigned int sdev_bflags
 
unsigned writeable
 
unsigned removable
 
unsigned changed
 
unsigned busy
 
unsigned lockable
 
unsigned locked
 
unsigned borken
 
unsigned disconnect
 
unsigned soft_reset
 
unsigned sdtr
 
unsigned wdtr
 
unsigned ppr
 
unsigned tagged_supported
 
unsigned simple_tags
 
unsigned ordered_tags
 
unsigned was_reset
 
unsigned expecting_cc_ua
 
unsigned use_10_for_rw
 
unsigned use_10_for_ms
 
unsigned no_report_opcodes
 
unsigned no_write_same
 
unsigned skip_ms_page_8
 
unsigned skip_ms_page_3f
 
unsigned skip_vpd_pages
 
unsigned use_192_bytes_for_3f
 
unsigned no_start_on_add
 
unsigned allow_restart
 
unsigned manage_start_stop
 
unsigned start_stop_pwr_cond
 
unsigned no_uld_attach
 
unsigned select_no_atn
 
unsigned fix_capacity
 
unsigned guess_capacity
 
unsigned retry_hwerror
 
unsigned last_sector_bug
 
unsigned no_read_disc_info
 
unsigned no_read_capacity_16
 
unsigned try_rc_10_first
 
unsigned is_visible
 
unsigned can_power_off
 
unsigned wce_default_on
 
unsigned no_dif
 
struct list_head event_list
 
struct work_struct event_work
 
unsigned int device_blocked
 
unsigned int max_device_blocked
 
atomic_t iorequest_cnt
 
atomic_t iodone_cnt
 
atomic_t ioerr_cnt
 
struct device sdev_gendev sdev_dev
 
struct execute_work ew
 
struct work_struct requeue_work
 
struct scsi_dh_datascsi_dh_data
 
enum scsi_device_state sdev_state
 
unsigned long sdev_data [0]
 
struct scsi_dh_devlist __attribute__
 
struct scsi_devicestarget_sdev_user
 
struct list_head devices
 
struct device dev
 
unsigned int reap_ref
 
unsigned int create
 
unsigned int single_lun
 
unsigned int pdt_1f_for_no_lun
 
unsigned int no_report_luns
 
unsigned int target_busy
 
unsigned int can_queue
 
unsigned int target_blocked
 
unsigned int max_target_blocked
 
enum scsi_target_state state
 
unsigned long starget_data [0]
 

Macro Definition Documentation

#define __shost_for_each_device (   sdev,
  shost 
)    list_for_each_entry((sdev), &((shost)->__devices), siblings)

__shost_for_each_device - iterate over all devices of a host (UNLOCKED) : the &struct scsi_device to use as a cursor : the &struct scsi_host to iterate over

Iterator that returns each device attached to . It does not take a reference on the scsi_device, so the whole loop must be protected by shost->host_lock.

Note: The only reason to use this is because you need to access the device list in interrupt context. Otherwise you really want to use shost_for_each_device instead.

Definition at line 346 of file scsi_device.h.

#define class_to_sdev (   d)    container_of(d, struct scsi_device, sdev_dev)

Definition at line 219 of file scsi_device.h.

#define MODULE_ALIAS_SCSI_DEVICE (   type)    MODULE_ALIAS("scsi:t-" __stringify(type) "*")

Definition at line 495 of file scsi_device.h.

#define scmd_channel (   scmd)    sdev_channel((scmd)->device)

Definition at line 424 of file scsi_device.h.

#define scmd_id (   scmd)    sdev_id((scmd)->device)

Definition at line 423 of file scsi_device.h.

#define scmd_printk (   prefix,
  scmd,
  fmt,
  a... 
)
Value:
(scmd)->request->rq_disk ? \
sdev_printk(prefix, (scmd)->device, "[%s] " fmt, \
(scmd)->request->rq_disk->disk_name, ##a) : \
sdev_printk(prefix, (scmd)->device, fmt, ##a)

Definition at line 227 of file scsi_device.h.

#define SCSI_DEFAULT_DEVICE_BLOCKED   3

Definition at line 286 of file scsi_device.h.

#define SCSI_DEFAULT_RAMP_UP_PERIOD   (120 * HZ)

Definition at line 206 of file scsi_device.h.

#define SCSI_DEFAULT_TARGET_BLOCKED   3

Definition at line 304 of file scsi_device.h.

#define SCSI_DEVICE_MODALIAS_FMT   "scsi:t-0x%02x"

Definition at line 497 of file scsi_device.h.

#define sdev_printk (   prefix,
  sdev,
  fmt,
  a... 
)    dev_printk(prefix, &(sdev)->sdev_gendev, fmt, ##a)

Definition at line 224 of file scsi_device.h.

#define shost_for_each_device (   sdev,
  shost 
)
Value:
for ((sdev) = __scsi_iterate_devices((shost), NULL); \
(sdev); \
(sdev) = __scsi_iterate_devices((shost), (sdev)))

shost_for_each_device - iterate over all devices of a host : the &struct scsi_device to use as a cursor : the &struct scsi_host to iterate over

Iterator that returns each device attached to . This loop takes a reference on each device and releases it at the end. If you break out of the loop, you must call scsi_device_put(sdev).

Definition at line 328 of file scsi_device.h.

#define starget_printk (   prefix,
  starget,
  fmt,
  a... 
)    dev_printk(prefix, &(starget)->dev, fmt, ##a)

Definition at line 288 of file scsi_device.h.

#define to_scsi_device (   d)    container_of(d, struct scsi_device, sdev_gendev)

Definition at line 217 of file scsi_device.h.

#define to_scsi_target (   d)    container_of(d, struct scsi_target, dev)

Definition at line 280 of file scsi_device.h.

#define transport_class_to_sdev (   class_dev)    to_scsi_device(class_dev->parent)

Definition at line 221 of file scsi_device.h.

#define transport_class_to_starget (   class_dev)    to_scsi_target(class_dev->parent)

Definition at line 285 of file scsi_device.h.

Typedef Documentation

typedef void(* activate_complete)(void *, int)

Definition at line 192 of file scsi_device.h.

Enumeration Type Documentation

Enumerator:
SDEV_EVT_MEDIA_CHANGE 
SDEV_EVT_LAST 
SDEV_EVT_MAXBITS 

Definition at line 53 of file scsi_device.h.

Enumerator:
SDEV_CREATED 
SDEV_RUNNING 
SDEV_CANCEL 
SDEV_DEL 
SDEV_QUIESCE 
SDEV_OFFLINE 
SDEV_TRANSPORT_OFFLINE 
SDEV_BLOCK 
SDEV_CREATED_BLOCK 

Definition at line 31 of file scsi_device.h.

Enumerator:
STARGET_CREATED 
STARGET_RUNNING 
STARGET_DEL 

Definition at line 233 of file scsi_device.h.

Function Documentation

struct scsi_device* __scsi_add_device ( struct Scsi_Host ,
uint  ,
uint  ,
uint  ,
void hostdata 
)
read

Definition at line 1505 of file scsi_scan.c.

struct scsi_device* __scsi_device_lookup ( struct Scsi_Host shost,
uint  channel,
uint  id,
uint  lun 
)
read

__scsi_device_lookup - find a device given the host (UNLOCKED) : SCSI host pointer : SCSI channel (zero if only one channel) : SCSI target number (physical unit number) : SCSI Logical Unit Number

Description: Looks up the scsi_device with the specified , , for a given host. The returned scsi_device does not have an additional reference. You must hold the host's host_lock over this call and any access to the returned scsi_device.

Note: The only reason why drivers would want to use this is because they need to access the device list in irq context. Otherwise you really want to use scsi_device_lookup instead.

Definition at line 1303 of file scsi.c.

struct scsi_device* __scsi_device_lookup_by_target ( struct scsi_target starget,
uint  lun 
)
read

__scsi_device_lookup_by_target - find a device given the target (UNLOCKED) : SCSI target pointer : SCSI Logical Unit Number

Description: Looks up the scsi_device with the specified for a given . The returned scsi_device does not have an additional reference. You must hold the host's host_lock over this call and any access to the returned scsi_device. A scsi_device in state SDEV_DEL is skipped.

Note: The only reason why drivers should use this is because they need to access the device list in irq context. Otherwise you really want to use scsi_device_lookup_by_target instead.

Definition at line 1245 of file scsi.c.

struct scsi_device* __scsi_iterate_devices ( struct Scsi_Host ,
struct scsi_device  
)
read

Definition at line 1154 of file scsi.c.

void __starget_for_each_device ( struct scsi_target ,
void ,
void(*)(struct scsi_device *, void *)  fn 
)

Definition at line 1216 of file scsi.c.

__attribute__::DECLARE_BITMAP ( supported_events  ,
SDEV_EVT_MAXBITS   
)
void int_to_scsilun ( unsigned int  lun,
struct scsi_lun scsilun 
)

int_to_scsilun - reverts an int into a scsi_lun : integer to be reverted : struct scsi_lun to be set.

Description: Reverts the functionality of the scsilun_to_int, which packed an 8-byte lun value into an int. This routine unpacks the int back into the lun value. Note: the scsilun_to_int() routine does not truly handle all 8bytes of the lun value. This functions restores only as much as was set by the routine.

Notes: Given an integer : 0x0b030a04, this function returns a scsi_lun of : struct scsi_lun of: 0a 04 0b 03 00 00 00 00

Definition at line 1271 of file scsi_scan.c.

int scsi_add_device ( struct Scsi_Host host,
uint  channel,
uint  target,
uint  lun 
)

Definition at line 1537 of file scsi_scan.c.

void scsi_adjust_queue_depth ( struct scsi_device sdev,
int  tagged,
int  tags 
)

scsi_adjust_queue_depth - Let low level drivers change a device's queue depth : SCSI Device in question : Do we use tagged queueing (non-0) or do we treat this device as an untagged device (0) : Number of tags allowed if tagged queueing enabled, or number of commands the low level driver can queue up in non-tagged mode (as per cmd_per_lun).

Returns: Nothing

Lock Status: None held on entry

Notes: Low level drivers may call this at any time and we will do the right thing depending on whether or not the device is currently active and whether or not it even has the command blocks built yet.

Definition at line 869 of file scsi.c.

int scsi_device_get ( struct scsi_device sdev)

scsi_device_get - get an additional reference to a scsi_device : device to get a reference to

Description: Gets a reference to the scsi_device and increments the use count of the underlying LLDD module. You must hold host_lock of the parent Scsi_Host or already have a reference when calling this.

Definition at line 1117 of file scsi.c.

struct scsi_device* scsi_device_lookup ( struct Scsi_Host shost,
uint  channel,
uint  id,
uint  lun 
)
read

scsi_device_lookup - find a device given the host : SCSI host pointer : SCSI channel (zero if only one channel) : SCSI target number (physical unit number) : SCSI Logical Unit Number

Description: Looks up the scsi_device with the specified , , for a given host. The returned scsi_device has an additional reference that needs to be released with scsi_device_put once you're done with it.

Definition at line 1329 of file scsi.c.

struct scsi_device* scsi_device_lookup_by_target ( struct scsi_target starget,
uint  lun 
)
read

scsi_device_lookup_by_target - find a device given the target : SCSI target pointer : SCSI Logical Unit Number

Description: Looks up the scsi_device with the specified for a given . The returned scsi_device has an additional reference that needs to be released with scsi_device_put once you're done with it.

Definition at line 1270 of file scsi.c.

void scsi_device_put ( struct scsi_device sdev)

scsi_device_put - release a reference to a scsi_device : device to release a reference on.

Description: Release a reference to the scsi_device and decrements the use count of the underlying LLDD module. The device is freed once the last user vanishes.

Definition at line 1139 of file scsi.c.

int scsi_device_quiesce ( struct scsi_device sdev)

scsi_device_quiesce - Block user issued commands. : scsi device to quiesce.

This works by trying to transition to the SDEV_QUIESCE state (which must be a legal transition). When the device is in this state, only special requests will be accepted, all others will be deferred. Since special requests may also be requeued requests, a successful return doesn't guarantee the device will be totally quiescent.

Must be called with user context, may sleep.

Returns zero if unsuccessful or an error if not.

Definition at line 2354 of file scsi_lib.c.

void scsi_device_resume ( struct scsi_device sdev)

scsi_device_resume - Restart user issued commands to a quiesced device. : scsi device to resume.

Moves the device from quiesced back to running and restarts the queues.

Must be called with user context, may sleep.

Definition at line 2378 of file scsi_lib.c.

int scsi_device_set_state ( struct scsi_device sdev,
enum scsi_device_state  state 
)

scsi_device_set_state - Take the given device through the device state model. : scsi device to change the state of. : state to change to.

Returns zero if unsuccessful or an error if the requested transition is illegal.

Definition at line 2082 of file scsi_lib.c.

const char* scsi_device_state_name ( enum  scsi_device_state)

Definition at line 43 of file scsi_sysfs.c.

int scsi_execute ( struct scsi_device sdev,
const unsigned char cmd,
int  data_direction,
void buffer,
unsigned  bufflen,
unsigned char sense,
int  timeout,
int  retries,
int  flags,
int resid 
)

scsi_execute - insert request and wait for the result : scsi device : scsi command : data direction : data buffer : len of buffer : optional sense buffer : request timeout in seconds : number of times to retry request : or into request flags; : optional residual length

returns the req->errors value which is the scsi_cmnd result field.

Definition at line 224 of file scsi_lib.c.

int scsi_execute_req ( struct scsi_device sdev,
const unsigned char cmd,
int  data_direction,
void buffer,
unsigned  bufflen,
struct scsi_sense_hdr ,
int  timeout,
int  retries,
int resid 
)

Definition at line 275 of file scsi_lib.c.

int scsi_get_vpd_page ( struct scsi_device ,
u8  page,
unsigned char buf,
int  buf_len 
)

Definition at line 1029 of file scsi.c.

int scsi_is_sdev_device ( const struct device )

Definition at line 1132 of file scsi_sysfs.c.

int scsi_is_target_device ( const struct device )

Definition at line 346 of file scsi_scan.c.

int scsi_mode_select ( struct scsi_device sdev,
int  pf,
int  sp,
int  modepage,
unsigned char buffer,
int  len,
int  timeout,
int  retries,
struct scsi_mode_data data,
struct scsi_sense_hdr sshdr 
)

scsi_mode_select - issue a mode select : SCSI device to be queried : Page format bit (1 == standard, 0 == vendor specific) : Save page bit (0 == don't save, 1 == save) : mode page being requested : request buffer (may not be smaller than eight bytes) : length of request buffer. : command timeout : number of retries before failing : returns a structure abstracting the mode header data : place to put sense data (or NULL if no sense to be collected). must be SCSI_SENSE_BUFFERSIZE big.

Returns zero if successful; negative error number or scsi status on error

Definition at line 1862 of file scsi_lib.c.

int scsi_mode_sense ( struct scsi_device sdev,
int  dbd,
int  modepage,
unsigned char buffer,
int  len,
int  timeout,
int  retries,
struct scsi_mode_data data,
struct scsi_sense_hdr sshdr 
)

scsi_mode_sense - issue a mode sense, falling back from 10 to six bytes if necessary. : SCSI device to be queried : set if mode sense will allow block descriptors to be returned : mode page being requested : request buffer (may not be smaller than eight bytes) : length of request buffer. : command timeout : number of retries before failing : returns a structure abstracting the mode header data : place to put sense data (or NULL if no sense to be collected). must be SCSI_SENSE_BUFFERSIZE big.

Returns zero if unsuccessful, or the header offset (either 4 or 8 depending on whether a six or ten byte command was issued) if successful.

Definition at line 1938 of file scsi_lib.c.

int scsi_register_device_handler ( struct scsi_device_handler scsi_dh)

Definition at line 327 of file scsi_dh.c.

void scsi_remove_device ( struct scsi_device sdev)

scsi_remove_device - unregister a device from the scsi bus : scsi_device to unregister

Definition at line 991 of file scsi_sysfs.c.

void scsi_remove_target ( struct device dev)

scsi_remove_target - try to remove a target and all its devices : generic starget or parent of generic stargets to be removed

Note: This is slightly racy. It is possible that if the user requests the addition of another device then the target won't be removed.

Definition at line 1031 of file scsi_sysfs.c.

int scsi_report_opcode ( struct scsi_device sdev,
unsigned char buffer,
unsigned int  len,
unsigned char  opcode 
)

scsi_report_opcode - Find out if a given command opcode is supported : scsi device to query : scratch buffer (must be at least 20 bytes long) : length of buffer : opcode for command to look up

Uses the REPORT SUPPORTED OPERATION CODES to look up the given opcode. Returns 0 if RSOC fails or if the command opcode is unsupported. Returns 1 if the device claims to support the command.

Definition at line 1076 of file scsi.c.

void scsi_scan_target ( struct device parent,
unsigned int  channel,
unsigned int  id,
unsigned int  lun,
int  rescan 
)

scsi_scan_target - scan a target id, possibly including all LUNs on the target. : host to scan : channel to scan : target id to scan : Specific LUN to scan or SCAN_WILD_CARD : passed to LUN scanning routines

Description: Scan the target id on , , and . Scan at least LUN 0, and possibly all LUNs on the target id.

First try a REPORT LUN scan, if that does not scan the target, do a sequential scan of LUNs on the target id.

Definition at line 1632 of file scsi_scan.c.

int scsi_set_medium_removal ( struct scsi_device ,
char   
)

Definition at line 134 of file scsi_ioctl.c.

void scsi_target_block ( struct device )

Definition at line 2525 of file scsi_lib.c.

void scsi_target_quiesce ( struct scsi_target )

Definition at line 2398 of file scsi_lib.c.

void scsi_target_reap ( struct scsi_target starget)

scsi_target_reap - check to see if target is in use and destroy if not : target to be checked

This is used after removing a LUN or doing a last put of the target it checks atomically that nothing is using the target and removes it if so.

Definition at line 475 of file scsi_scan.c.

void scsi_target_resume ( struct scsi_target )

Definition at line 2411 of file scsi_lib.c.

void scsi_target_unblock ( struct device ,
enum  scsi_device_state 
)

Definition at line 2551 of file scsi_lib.c.

int scsi_test_unit_ready ( struct scsi_device sdev,
int  timeout,
int  retries,
struct scsi_sense_hdr sshdr_external 
)

scsi_test_unit_ready - test if unit is ready : scsi device to change the state of. : command timeout : number of retries before failing : Optional pointer to struct scsi_sense_hdr for returning sense. Make sure that this is cleared before passing in.

Returns zero if unsuccessful or an error if TUR failed. For removable media, UNIT_ATTENTION sets ->changed flag.

Definition at line 2043 of file scsi_lib.c.

int scsi_track_queue_full ( struct scsi_device sdev,
int  depth 
)

scsi_track_queue_full - track QUEUE_FULL events to adjust queue depth : SCSI Device in question : Current number of outstanding SCSI commands on this device, not counting the one returned as QUEUE_FULL.

Description: This function will track successive QUEUE_FULL events on a specific SCSI device to determine if and when there is a need to adjust the queue depth on the device.

Returns: 0 - No change needed, >0 - Adjust queue depth to this new depth, -1 - Drop back to untagged operation using host->cmd_per_lun as the untagged command depth

Lock Status: None held on entry

Notes: Low level drivers may call this at any time and we will do "The Right Thing." We are interrupt context safe.

Definition at line 939 of file scsi.c.

int scsi_unregister_device_handler ( struct scsi_device_handler scsi_dh)

Definition at line 351 of file scsi_dh.c.

int scsilun_to_int ( struct scsi_lun scsilun)

scsilun_to_int - convert a scsi_lun to an int : struct scsi_lun to be converted.

Description: Convert from a struct scsi_lun to a four byte host byte-ordered integer, and return the result. The caller must check for truncation before using this function.

Notes: The struct scsi_lun is assumed to be four levels, with each level effectively containing a SCSI byte-ordered (big endian) short; the addressing bits of each level are ignored (the highest two bits). For a description of the LUN format, post SCSI-3 see the SCSI Architecture Model, for SCSI-3 see the SCSI Controller Commands.

Given a struct scsi_lun of: 0a 04 0b 03 00 00 00 00, this function returns the integer: 0x0b030a04

Definition at line 1240 of file scsi_scan.c.

struct scsi_event* sdev_evt_alloc ( enum scsi_device_event  evt_type,
gfp_t  gfpflags 
)
read

sdev_evt_alloc - allocate a new scsi event : type of event to allocate : GFP flags for allocation

Allocates and returns a new scsi_event.

Definition at line 2294 of file scsi_lib.c.

void sdev_evt_send ( struct scsi_device sdev,
struct scsi_event evt 
)

sdev_evt_send - send asserted event to uevent thread : scsi_device event occurred on : event to send

Assert scsi device event asynchronously.

Definition at line 2266 of file scsi_lib.c.

void sdev_evt_send_simple ( struct scsi_device sdev,
enum scsi_device_event  evt_type,
gfp_t  gfpflags 
)

sdev_evt_send_simple - send asserted event to uevent thread : scsi_device event occurred on : type of event to send : GFP flags for allocation

Assert scsi device event asynchronously, given an event type.

Definition at line 2324 of file scsi_lib.c.

void starget_for_each_device ( struct scsi_target ,
void ,
void(*)(struct scsi_device *, void *)  fn 
)

Definition at line 1188 of file scsi.c.

Variable Documentation

unsigned allow_restart

Definition at line 261 of file scsi_device.h.

unsigned borken

Definition at line 238 of file scsi_device.h.

unsigned busy

Definition at line 235 of file scsi_device.h.

unsigned can_power_off

Definition at line 275 of file scsi_device.h.

unsigned int can_queue

Definition at line 301 of file scsi_device.h.

unsigned changed

Definition at line 234 of file scsi_device.h.

unsigned int channel

Definition at line 210 of file scsi_device.h.

struct list_head cmd_list

Definition at line 197 of file scsi_device.h.

unsigned int create

Definition at line 287 of file scsi_device.h.

struct scsi_cmnd* current_cmnd

Definition at line 199 of file scsi_device.h.

unsigned char current_tag

Definition at line 225 of file scsi_device.h.

Definition at line 282 of file scsi_device.h.

unsigned int device_blocked

Definition at line 283 of file scsi_device.h.

unsigned int device_busy

Definition at line 194 of file scsi_device.h.

struct list_head devices

Definition at line 281 of file scsi_device.h.

static void disconnect

Definition at line 240 of file scsi_device.h.

Definition at line 280 of file scsi_device.h.

struct work_struct event_work

Definition at line 281 of file scsi_device.h.

Definition at line 295 of file scsi_device.h.

unsigned expecting_cc_ua

Definition at line 250 of file scsi_device.h.

unsigned fix_capacity

Definition at line 266 of file scsi_device.h.

unsigned guess_capacity

Definition at line 267 of file scsi_device.h.

Definition at line 186 of file scsi_device.h.

Definition at line 216 of file scsi_device.h.

unsigned int id

Definition at line 210 of file scsi_device.h.

char inq_periph_qual

Definition at line 219 of file scsi_device.h.

unsigned char* inquiry

Definition at line 221 of file scsi_device.h.

unsigned char inquiry_len

Definition at line 220 of file scsi_device.h.

atomic_t iodone_cnt

Definition at line 289 of file scsi_device.h.

atomic_t ioerr_cnt

Definition at line 290 of file scsi_device.h.

atomic_t iorequest_cnt

Definition at line 288 of file scsi_device.h.

unsigned is_visible

Definition at line 274 of file scsi_device.h.

unsigned short last_queue_full_count

Definition at line 203 of file scsi_device.h.

unsigned short last_queue_full_depth

Definition at line 202 of file scsi_device.h.

unsigned long last_queue_full_time

Definition at line 204 of file scsi_device.h.

unsigned long last_queue_ramp_up

Definition at line 208 of file scsi_device.h.

unsigned last_sector_bug

Definition at line 269 of file scsi_device.h.

spinlock_t list_lock

Definition at line 196 of file scsi_device.h.

unsigned lockable

Definition at line 236 of file scsi_device.h.

unsigned locked

Definition at line 237 of file scsi_device.h.

unsigned int lun

Definition at line 210 of file scsi_device.h.

unsigned manage_start_stop

Definition at line 262 of file scsi_device.h.

unsigned int manufacturer

Definition at line 212 of file scsi_device.h.

unsigned int max_device_blocked

Definition at line 285 of file scsi_device.h.

unsigned short max_queue_depth

Definition at line 201 of file scsi_device.h.

unsigned int max_target_blocked

Definition at line 303 of file scsi_device.h.

const char* model

Definition at line 223 of file scsi_device.h.

unsigned no_dif

Definition at line 277 of file scsi_device.h.

unsigned no_read_capacity_16

Definition at line 272 of file scsi_device.h.

unsigned no_read_disc_info

Definition at line 271 of file scsi_device.h.

unsigned int no_report_luns

Definition at line 293 of file scsi_device.h.

unsigned no_report_opcodes

Definition at line 254 of file scsi_device.h.

unsigned no_start_on_add

Definition at line 260 of file scsi_device.h.

unsigned no_uld_attach

Definition at line 264 of file scsi_device.h.

unsigned no_write_same

Definition at line 255 of file scsi_device.h.

unsigned ordered_tags

Definition at line 247 of file scsi_device.h.

unsigned int pdt_1f_for_no_lun

Definition at line 291 of file scsi_device.h.

unsigned ppr

Definition at line 244 of file scsi_device.h.

unsigned short queue_depth

Definition at line 200 of file scsi_device.h.

unsigned long queue_ramp_up_period

Definition at line 205 of file scsi_device.h.

unsigned int reap_ref

Definition at line 283 of file scsi_device.h.

unsigned removable

Definition at line 233 of file scsi_device.h.

struct request_queue* request_queue

Definition at line 187 of file scsi_device.h.

struct work_struct requeue_work

Definition at line 296 of file scsi_device.h.

unsigned retry_hwerror

Definition at line 268 of file scsi_device.h.

const char* rev

Definition at line 224 of file scsi_device.h.

struct list_head same_target_siblings

Definition at line 191 of file scsi_device.h.

Definition at line 298 of file scsi_device.h.

char scsi_level

Definition at line 218 of file scsi_device.h.

unsigned int sdev_bflags

Definition at line 228 of file scsi_device.h.

unsigned long sdev_data[0]

Definition at line 300 of file scsi_device.h.

struct device sdev_gendev sdev_dev

Definition at line 292 of file scsi_device.h.

enum scsi_device_state sdev_state

Definition at line 299 of file scsi_device.h.

struct scsi_target* sdev_target

Definition at line 226 of file scsi_device.h.

unsigned sdtr

Definition at line 242 of file scsi_device.h.

unsigned sector_size

Definition at line 214 of file scsi_device.h.

unsigned select_no_atn

Definition at line 265 of file scsi_device.h.

struct list_head siblings

Definition at line 190 of file scsi_device.h.

unsigned simple_tags

Definition at line 246 of file scsi_device.h.

unsigned int single_lun

Definition at line 288 of file scsi_device.h.

unsigned skip_ms_page_3f

Definition at line 257 of file scsi_device.h.

unsigned skip_ms_page_8

Definition at line 256 of file scsi_device.h.

unsigned skip_vpd_pages

Definition at line 258 of file scsi_device.h.

unsigned soft_reset

Definition at line 241 of file scsi_device.h.

unsigned long starget_data[0]

Definition at line 310 of file scsi_device.h.

struct scsi_device* starget_sdev_user

Definition at line 279 of file scsi_device.h.

unsigned start_stop_pwr_cond

Definition at line 263 of file scsi_device.h.

struct list_head starved_entry

Definition at line 198 of file scsi_device.h.

Definition at line 308 of file scsi_device.h.

unsigned tagged_supported

Definition at line 245 of file scsi_device.h.

unsigned int target_blocked

Definition at line 302 of file scsi_device.h.

unsigned int target_busy

Definition at line 296 of file scsi_device.h.

unsigned try_rc_10_first

Definition at line 273 of file scsi_device.h.

Definition at line 217 of file scsi_device.h.

unsigned use_10_for_ms

Definition at line 253 of file scsi_device.h.

unsigned use_10_for_rw

Definition at line 252 of file scsi_device.h.

unsigned use_192_bytes_for_3f

Definition at line 259 of file scsi_device.h.

Definition at line 222 of file scsi_device.h.

unsigned was_reset

Definition at line 248 of file scsi_device.h.

unsigned wce_default_on

Definition at line 276 of file scsi_device.h.

unsigned wdtr

Definition at line 243 of file scsi_device.h.

unsigned writeable

Definition at line 232 of file scsi_device.h.