Documentation/DocBook/scsi_midlayer.tmpl
Subsystems (3)
PATCH 1/1 Documentation/DocBook/scsi_midlayer.tmpl
From: Rob Landley <[email protected]>
Add Documentation/DocBook/scsi_midlayer.tmpl and patch lots of drivers/scsi files fixing/adding kerneldoc comments.
---
More of an RFC than a patch, really. Kind of big and probably needs to be broken up. One minor code change where I added parentheses in scsi_ioctl.c because (blah && blah & FLAG) is something I had to double-check the precedence of and wanted to clarify. Everything else should be comments, docbook, or adding the tmpl to the Makefile.
The upper and lower layers are mostly stubs at present.
Documentation/DocBook/Makefile | 2 Documentation/DocBook/scsi_midlayer.tmpl | 409 +++++++++++++++++++++ drivers/scsi/constants.c | 1 drivers/scsi/scsi.c | 181 ++++----- drivers/scsi/scsi_devinfo.c | 34 - drivers/scsi/scsi_error.c | 34 - drivers/scsi/scsi_ioctl.c | 24 - drivers/scsi/scsi_lib.c | 14 drivers/scsi/scsi_netlink.c | 19 drivers/scsi/scsi_proc.c | 110 +++++ drivers/scsi/scsi_scan.c | 30 + drivers/scsi/scsi_transport_fc.c | 25 - drivers/scsi/scsi_transport_iscsi.c | 3 drivers/scsi/scsi_transport_sas.c | 5 drivers/scsi/scsi_transport_srp.c | 2 drivers/scsi/scsicam.c | 39 +- 16 files changed, 745 insertions(+), 187 deletions(-)
Documentation/DocBook/scsi_midlayer.tmpl new file +409 -0
@@ -0,0 +1,409 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" + "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []> + +<book id="scsimid"> + <bookinfo> + <title>SCSI Mid Layer Guide</title> + + <authorgroup> + <author> + <firstname>James</firstname> + <surname>Bottomley</surname> + <affiliation> + <address> + <email>[email protected]</email> + </address> + </affiliation> + </author> + + <author> + <firstname>Rob</firstname> + <surname>Landley</surname> + <affiliation> + <address> + <email>[email protected]</email> + </address> + </affiliation> + </author> + + </authorgroup> + + <copyright> + <year>2007</year> + <holder>Linux Foundation</holder> + </copyright> + + <legalnotice> + <para> + This documentation is free software; you can redistribute + it and/or modify it under the terms of the GNU General Public + License version 2. + </para> + + <para> + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + For more details see the file COPYING in the source + distribution of Linux. + </para> + </legalnotice> + </bookinfo> + + <toc></toc> + + <chapter id="intro"> + <title>Introduction</title> + <sect1 id="protocol_vs_bus"> + <title>Protocol vs bus</title> + <para> + Once upon a time, the Small Computer Systems Interface defined both + a parallel I/O bus and a data protocol to connect a wide variety of + peripherals (disk drives, tape drives, modems, printers, scanners, + optical drives, test equipment, and medical devices) to a host + computer. + </para> + <para> + Although the old parallel (fast/wide/ultra) SCSI bus has largely + fallen out of use, the SCSI command set is more widely used than ever + to communicate with devices over a number of different busses. + </para> + <para> + The <ulink url='http://www.t10.org/scsi-3.htm'>SCSI protocol</ulink> + is a big-endian peer-to-peer packet based protocol. SCSI commands + are 6, 10, 12, or 16 bytes long, often followed by an associated data + payload. + </para> + <para> + SCSI commands can be transported over just about any kind of bus, and + are the default protocol for storage devices attached to USB, SATA, + SAS, Fibre Channel, FireWire, and ATAPI devices. SCSI packets are + also commonly exchanged over Infiniband, + <ulink url='http://i2o.shadowconnect.com/faq.php'>I20</ulink>, TCP/IP + (<ulink url='http://en.wikipedia.org/wiki/ISCSI'>iSCSI</ulink>), even + <ulink url='http://cyberelk.net/tim/parport/parscsi.html'>Parallel + ports</ulink>. + </para> + </sect1> + <sect1 id="subsystem_design"> + <title>Design of the Linux SCSI subsystem</title> + <para> + The SCSI subsystem uses a three layer design, with upper, mid, and low + layers. Every operation involving the SCSI subsystem (such as reading + a sector from a disk) uses one driver at each of the 3 levels: one + upper layer driver, one lower layer driver, and the scsi midlayer. + </para> + <para> + The SCSI upper layer provides the interface between userspace and the + kernel, in the form of block and char device nodes for I/O and + ioctl(). The SCSI lower layer contains drivers for specific hardware + devices. + </para> + <para> + In between is the SCSI mid-layer, analogous to a network routing + layer such as the IPv4 stack. The SCSI mid-layer routes a packet + based data protocol between the upper layer's /dev nodes and the + corresponding devices in the lower layer. It manages command queues, + provides error handling and power management functions, and responds + to ioctl() requests. + </para> + </sect1> + </chapter> + + <chapter id="upper_layer"> + <title>SCSI upper layer</title> + <para> + The upper layer supports the user-kernel interface by providing + device nodes. + </para> + <sect1 id="sd"> + <title>sd (SCSI Disk)</title> + <para>sd (sd_mod.o)</para> +<!-- !Idrivers/scsi/sd.c --> + </sect1> + <sect1 id="sr"> + <title>sr (SCSI CD-ROM)</title> + <para>sr (sr_mod.o)</para> + </sect1> + <sect1 id="st"> + <title>st (SCSI Tape)</title> + <para>st (st.o)</para> + </sect1> + <sect1 id="sg"> + <title>sg (SCSI Generic)</title> + <para>sg (sg.o)</para> + </sect1> + <sect1 id="ch"> + <title>ch (SCSI Media Changer)</title> + <para>ch (ch.c)</para> + </sect1> + </chapter> + + <chapter id="mid_layer"> + <title>SCSI mid layer</title> + + <sect1 id="midlayer_implementation"> + <title>SCSI midlayer implementation</title> + <sect2 id="scsi_device.h"> + <title>include/scsi/scsi_device.h</title> + <para> + </para> +!Iinclude/scsi/scsi_device.h + </sect2> + + <sect2 id="scsi.c"> + <title>drivers/scsi/scsi.c</title> + <para>Main file for the scsi midlayer.</para> +!Edrivers/scsi/scsi.c + </sect2> + <sect2 id="scsicam.c"> + <title>drivers/scsi/scsicam.c</title> + <para> + <ulink url='http://www.t10.org/ftp/t10/drafts/cam/cam-r12b.pdf'>SCSI + Common Access Method</ulink> support functions, for use with + HDIO_GETGEO, etc. + </para> +!Edrivers/scsi/scsicam.c + </sect2> + <sect2 id="scsi_error.c"> + <title>drivers/scsi/scsi_error.c</title> + <para>Common SCSI error/timeout handling routines.</para> +!Edrivers/scsi/scsi_error.c + </sect2> + <sect2 id="scsi_devinfo.c"> + <title>drivers/scsi/scsi_devinfo.c</title> + <para> + Manage scsi_dev_info_list, which tracks blacklisted and whitelisted + devices. + </para> +!Idrivers/scsi/scsi_devinfo.c + </sect2> + <sect2 id="scsi_ioctl.c"> + <title>drivers/scsi/scsi_ioctl.c</title> + <para> + Handle ioctl() calls for scsi devices. + </para> +!Edrivers/scsi/scsi_ioctl.c + </sect2> + <sect2 id="scsi_lib.c"> + <title>drivers/scsi/scsi_lib.c</title> + <para> + SCSI queuing library. + </para> +!Edrivers/scsi/scsi_lib.c + </sect2> + <sect2 id="scsi_lib_dma.c"> + <title>drivers/scsi/scsi_lib_dma.c</title> + <para> + SCSI library functions depending on DMA + (map and unmap scatter-gather lists). + </para> +!Edrivers/scsi/scsi_lib_dma.c + </sect2> + <sect2 id="scsi_module.c"> + <title>drivers/scsi/scsi_module.c</title> + <para> + The file drivers/scsi/scsi_module.c contains legacy support for + old-style host templates. It should never be used by any new driver. + </para> + </sect2> + <sect2 id="scsi_proc.c"> + <title>drivers/scsi/scsi_proc.c</title> + <para> + The functions in this file provide an interface between + the PROC file system and the SCSI device drivers + It is mainly used for debugging, statistics and to pass + information directly to the lowlevel driver. + + I.E. plumbing to manage /proc/scsi/* + </para> +!Idrivers/scsi/scsi_proc.c + </sect2> + <sect2 id="scsi_netlink.c"> + <title>drivers/scsi/scsi_netlink.c</title> + <para> + Infrastructure to provide async events from transports to userspace + via netlink, using a single NETLINK_SCSITRANSPORT protocol for all + transports. + + See <ulink url='http://marc.info/?l=linux-scsi&m=115507374832500&w=2'>the + original patch submission</ulink> for more details. + </para> +!Idrivers/scsi/scsi_netlink.c + </sect2> + <sect2 id="scsi_scan.c"> + <title>drivers/scsi/scsi_scan.c</title> + <para> + Scan a host to determine which (if any) devices are attached. + + The general scanning/probing algorithm is as follows, exceptions are + made to it depending on device specific flags, compilation options, + and global variable (boot or module load time) settings. + + A specific LUN is scanned via an INQUIRY command; if the LUN has a + device attached, a scsi_device is allocated and setup for it. + + For every id of every channel on the given host, start by scanning + LUN 0. Skip hosts that don't respond at all to a scan of LUN 0. + Otherwise, if LUN 0 has a device attached, allocate and setup a + scsi_device for it. If target is SCSI-3 or up, issue a REPORT LUN, + and scan all of the LUNs returned by the REPORT LUN; else, + sequentially scan LUNs up until some maximum is reached, or a LUN is + seen that cannot have a device attached to it. + </para> +!Idrivers/scsi/scsi_scan.c + </sect2> + <sect2 id="scsi_sysctl.c"> + <title>drivers/scsi/scsi_sysctl.c</title> + <para> + Set up the sysctl entry: "/dev/scsi/logging_level" + (DEV_SCSI_LOGGING_LEVEL) which sets/returns scsi_logging_level. + </para> + </sect2> + <sect2 id="scsi_sysfs.c"> + <title>drivers/scsi/scsi_sysfs.c</title> + <para> + SCSI sysfs interface routines. + </para> +!Edrivers/scsi/scsi_sysfs.c + </sect2> + <sect2 id="hosts.c"> + <title>drivers/scsi/hosts.c</title> + <para> + mid to lowlevel SCSI driver interface + </para> +!Edrivers/scsi/hosts.c + </sect2> + <sect2 id="constants.c"> + <title>drivers/scsi/constants.c</title> + <para> + mid to lowlevel SCSI driver interface + </para> +!Edrivers/scsi/constants.c + </sect2> + </sect1> + + <sect1 id="Transport_classes"> + <title>Transport classes</title> + <para> + Transport classes are service libraries for drivers in the scsi + lower layer, which expose transport attributes in sysfs. + </para> + <sect2 id="Fibre_Channel_transport"> + <title>Fibre Channel transport</title> + <para> + The file drivers/scsi/scsi_transport_fc.c defines transport attributes + for Fibre Channel. + </para> +!Edrivers/scsi/scsi_transport_fc.c + </sect2> + <sect2 id="iSCSI_transport"> + <title>iSCSI transport class</title> + <para> + The file drivers/scsi/scsi_transport_iscsi.c defines transport + attributes for the iSCSI class, which sends SCSI packets over TCP/IP + connections. + </para> +!Edrivers/scsi/scsi_transport_iscsi.c + </sect2> + <sect2 id="SAS_transport"> + <title>Serial Attached SCSI (SAS) transport class</title> + <para> + The file drivers/scsi/scsi_transport_sas.c defines transport + attributes for Serial Attached SCSI, a variant of SATA aimed at + large high-end systems. + </para> + <para> + The SAS transport class contains common code to deal with SAS HBAs, + an aproximated representation of SAS topologies in the driver model, + and various sysfs attributes to expose these topologies and managment + interfaces to userspace. + </para> + <para> + In addition to the basic SCSI core objects this transport class + introduces two additional intermediate objects: The SAS PHY + as represented by struct sas_phy defines an "outgoing" PHY on + a SAS HBA or Expander, and the SAS remote PHY represented by + struct sas_rphy defines an "incoming" PHY on a SAS Expander or + end device. Note that this is purely a software concept, the + underlying hardware for a PHY and a remote PHY is the exactly + the same. + </para> + <para> + There is no concept of a SAS port in this code, users can see + what PHYs form a wide port based on the port_identifier attribute, + which is the same for all PHYs in a port. + </para> +!Edrivers/scsi/scsi_transport_sas.c + </sect2> + <sect2 id="SATA_transport"> + <title>SATA transport class</title> + <para> + The SATA transport is handled by libata, which has its own book of + documentation in this directory. + </para> + </sect2> + <sect2 id="SPI_transport"> + <title>Parallel SCSI (SPI) transport class</title> + <para> + The file drivers/scsi/scsi_transport_spi.c defines transport + attributes for traditional (fast/wide/ultra) SCSI busses. + </para> +!Edrivers/scsi/scsi_transport_spi.c + </sect2> + <sect2 id="SRP_transport"> + <title>SCSI RDMA (SRP) transport class</title> + <para> + The file drivers/scsi/scsi_transport_srp.c defines transport + attributes for SCSI over Remote Direct Memory Access. + </para> +!Edrivers/scsi/scsi_transport_srp.c + </sect2> + </sect1> + + </chapter> + + <chapter id="lower_layer"> + <title>SCSI lower layer</title> + <sect1 id="hba_drivers"> + <title>Host Bus Adapter transport types</title> + <para> + Many modern device controllers use the SCSI command set as a protocol to + communicate with their devices through many different types of physical + connections. + </para> + <para> + In SCSI language a bus capable of carrying SCSI commands is + called a "transport", and a controller connecting to such a bus is + called a "host bus adapter" (HBA). + </para> + <sect2 id="scsi_debug.c"> + <title>Debug transport</title> + <para> + The file drivers/scsi/scsi_debug.c simulates a host adapter with a + variable number of disks (or disk like devices) attached, sharing a + common amount of RAM. Does a lot of checking to make sure that we are + not getting blocks mixed up, and panics the kernel if anything out of + the ordinary is seen. + </para> + <para> + To be more realistic, the simulated devices have the transport + attributes of SAS disks. + </para> + <para> + For documentation see + <ulink url='http://www.torque.net/sg/sdebug26.html'>http://www.torque.net/sg/sdebug26.html</ulink> + </para> +<!-- !Edrivers/scsi/scsi_debug.c --> + </sect2> + <sect2 id="todo"> + <title>todo</title> + <para>Parallel (fast/wide/ultra) SCSI, USB, SATA, + SAS, Fibre Channel, FireWire, ATAPI devices, Infiniband, + I20, iSCSI, Parallel ports, netlink... + </para> + </sect2> + </sect1> + </chapter> +</book>
Documentation/DocBook/Makefile +1 -1
@@ -11,7 +11,7 @@ DOCBOOKS := wanbook.xml z8530book.xml mc procfs-guide.xml writing_usb_driver.xml \ kernel-api.xml filesystems.xml lsm.xml usb.xml \ gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \ - genericirq.xml s390-drivers.xml + genericirq.xml s390-drivers.xml scsi_midlayer.xml ### # The build process is as follows (targets):
drivers/scsi/constants.c +0 -1
@@ -362,7 +362,6 @@ EXPORT_SYMBOL(scsi_print_command);EXPORT_SYMBOL (scsi_print_command);/** -* * scsi_print_status - print scsi status description * @scsi_status: scsi status value *
drivers/scsi/scsi.c +95 -86
320 lines not on this page · raw message
drivers/scsi/scsi_devinfo.c +15 -19
@@ -276,11 +276,12 @@ static void scsi_strcpy_devinfo(char *na }/** -* scsi_dev_info_list_add: add one dev_info list entry. +* scsi_dev_info_list_add - add one dev_info list entry. +* @compatible: if true, null terminate short strings. Otherwise space pad. * @vendor: vendor string * @model: model (product) string * @strflags: integer string -* @flag: if strflags NULL, use this flag value +* @flags: if strflags NULL, use this flag value * * Description: * Create and add one dev_info entry for @vendor, @model, @strflags or
@@ -322,8 +323,7 @@ static int scsi_dev_info_list_add(int co }/** -* scsi_dev_info_list_add_str: parse dev_list and add to the -* scsi_dev_info_list. +* scsi_dev_info_list_add_str - parse dev_list and add to the scsi_dev_info_list. * @dev_list: string of device flags to add * * Description:
@@ -374,15 +374,15 @@ static int scsi_dev_info_list_add_str(ch }/** -* get_device_flags - get device specific flags from the dynamic device -* list. Called during scan time. +* get_device_flags - get device specific flags from the dynamic device list. +* @sdev: &scsi_device to get flags for * @vendor: vendor name * @model: model name * * Description: * Search the scsi_dev_info_list for an entry matching @vendor and * @model, if found, return the matching flags value, else return -* the host or global default settings. +* the host or global default settings. Called during scan time. **/ int scsi_get_device_flags(struct scsi_device *sdev, const unsigned char *vendor,
@@ -483,13 +483,11 @@ stop_output: }/* -* proc_scsi_dev_info_write: allow additions to the scsi_dev_info_list via -* /proc. -* -* Use: echo "vendor:model:flag" > /proc/scsi/device_info -* -* To add a black/white list entry for vendor and model with an integer -* value of flag to the scsi device info list. +* proc_scsi_dev_info_write - allow additions to scsi_dev_info_list via /proc. +* +* Description: Adds a black/white list entry for vendor and model with an +* integer value of flag to the scsi device info list. +* To use, echo "vendor:model:flag" > /proc/scsi/device_info */ static int proc_scsi_devinfo_write (struct file *file,const char __user *buf,unsigned long length,void *data)
@@ -532,8 +530,7 @@ MODULE_PARM_DESC(default_dev_flags, "scsi default device flag integer value");/** -* scsi_dev_info_list_delete: called from scsi.c:exit_scsi to remove -* the scsi_dev_info_list. +* scsi_dev_info_list_delete - called from scsi.c:exit_scsi to remove the scsi_dev_info_list. **/ void scsi_exit_devinfo (void ) {
@@ -552,11 +549,10 @@ void scsi_exit_devinfo(void) }/** -* scsi_dev_list_init: set up the dynamic device list. -* @dev_list: string of device flags to add +* scsi_dev_list_init - set up the dynamic device list. * * Description: -* Add command line @dev_list entries, then add +* Add command line entries from scsi_dev_flags, then add * scsi_static_device_list entries to the scsi device info list. **/ int __init scsi_init_devinfo (void )
drivers/scsi/scsi_error.c +19 -15
@@ -795,7 +795,7 @@ EXPORT_SYMBOL(scsi_eh_finish_cmd);/** * scsi_eh_get_sense - Get device sense data. * @work_q: Queue of commands to process. -* @done_q: Queue of proccessed commands.. +* @done_q: Queue of proccessed commands. * * Description: * See if we need to request sense information. if so, then get it
@@ -859,7 +859,7 @@ EXPORT_SYMBOL_GPL(scsi_eh_get_sense);/** * scsi_eh_tur - Send TUR to device. -* @scmd: Scsi cmd to send TUR +* @scmd: &scsi_cmnd to send TUR * * Return value: * 0 - Device is ready. 1 - Device NOT ready.
@@ -888,14 +888,14 @@ retry_tur: }/** -* scsi_eh_abort_cmds - abort canceled commands. -* @shost: scsi host being recovered. -* @eh_done_q: list_head for processed commands. +* scsi_eh_abort_cmds - abort pending commands. +* @work_q: &list_head for pending commands. +* @done_q: &list_head for processed commands. * * Decription: * Try and see whether or not it makes sense to try and abort the -* running command. this only works out to be the case if we have one -* command that has timed out. if the command simply failed, it makes +* running command. This only works out to be the case if we have one +* command that has timed out. If the command simply failed, it makes * no sense to try and abort the command, since as far as the shost * adapter is concerned, it isn't running. **/
@@ -932,7 +932,7 @@ static int scsi_eh_abort_cmds(struct lis/** * scsi_eh_try_stu - Send START_UNIT to device. -* @scmd: Scsi cmd to send START_UNIT +* @scmd: &scsi_cmnd to send START_UNIT * * Return value: * 0 - Device is ready. 1 - Device NOT ready.
@@ -957,8 +957,9 @@ static int scsi_eh_try_stu(struct scsi_c/** * scsi_eh_stu - send START_UNIT if needed -* @shost: scsi host being recovered. -* @eh_done_q: list_head for processed commands. +* @shost: &scsi host being recovered. +* @work_q: &list_head for pending commands. +* @done_q: &list_head for processed commands. * * Notes: * If commands are failing due to not ready, initializing command required,
@@ -1009,10 +1010,11 @@ static int scsi_eh_stu(struct Scsi_Host/** * scsi_eh_bus_device_reset - send bdr if needed * @shost: scsi host being recovered. -* @eh_done_q: list_head for processed commands. +* @work_q: &list_head for pending commands. +* @done_q: &list_head for processed commands. * * Notes: -* Try a bus device reset. still, look to see whether we have multiple +* Try a bus device reset. Still, look to see whether we have multiple * devices that are jammed or not - if we have multiple devices, it * makes no sense to try bus_device_reset - we really would need to try * a bus_reset instead.
@@ -1064,8 +1066,9 @@ static int scsi_eh_bus_device_reset(stru/** * scsi_eh_bus_reset - send a bus reset -* @shost: scsi host being recovered. -* @eh_done_q: list_head for processed commands. +* @shost: &scsi host being recovered. +* @work_q: &list_head for pending commands. +* @done_q: &list_head for processed commands. **/ static int scsi_eh_bus_reset(struct Scsi_Host *shost, struct list_head *work_q,
@@ -1441,7 +1444,8 @@ static void scsi_restart_operations(stru/** * scsi_eh_ready_devs - check device ready state and recover if not. * @shost: host to be recovered. -* @eh_done_q: list_head for processed commands. +* @work_q: &list_head for pending commands. +* @done_q: &list_head for processed commands. * **/ void scsi_eh_ready_devs(struct Scsi_Host *shost,
drivers/scsi/scsi_ioctl.c +16 -8
@@ -174,10 +174,15 @@ static int scsi_ioctl_get_pci(struct scs } -/* -* the scsi_ioctl() function differs from most ioctls in that it does -* not take a major/minor number as the dev field. Rather, it takes -* a pointer to a scsi_devices[] element, a structure. +/** +* scsi_ioctl - Dispatch ioctl to scsi device +* @sdev: scsi device receiving ioctl +* @cmd: which ioctl is it +* @arg: data associated with ioctl +* +* Description: The scsi_ioctl() function differs from most ioctls in that it +* does not take a major/minor number as the dev field. Rather, it takes +* a pointer to a &struct scsi_device. */ int scsi_ioctl (struct scsi_device *sdev,int cmd,void __user *arg) {
@@ -264,9 +269,12 @@ int scsi_ioctl(struct scsi_device *sdev, }EXPORT_SYMBOL (scsi_ioctl); -/* -* the scsi_nonblock_ioctl() function is designed for ioctls which may -* be executed even if the device is in recovery. +/** +* scsi_nonblock_ioctl() - Handle SG_SCSI_RESET +* @sdev: scsi device receiving ioctl +* @cmd: Must be SC_SCSI_RESET +* @arg: pointer to int containing SG_SCSI_RESET_{DEVICE,BUS,HOST} +* @filp: either NULL or a &struct file which must have the O_NONBLOCK flag. */ int scsi_nonblockable_ioctl (struct scsi_device *sdev,int cmd,void __user *arg,struct file *filp)
@@ -276,7 +284,7 @@ int scsi_nonblockable_ioctl(struct scsi_/* The first set of iocts may be executed even if we're doing * error processing, as long as the device was opened * non-blocking */ -if (filp && filp->f_flags &O_NONBLOCK ) { +if (filp && (filp->f_flags &O_NONBLOCK )) {if (scsi_host_in_recovery (sdev->host))return -ENODEV ; }else if (!scsi_block_when_processing_errors (sdev))
drivers/scsi/scsi_lib.c +8 -6
@@ -274,7 +274,7 @@ static void scsi_bi_endio(struct bio *bi/** * scsi_req_map_sg - map a scatterlist into a request * @rq: request to fill -* @sg: scatterlist +* @sgl: scatterlist * @nsegs: number of elements * @bufflen: len of buffer * @gfp: memory allocation flags
@@ -365,13 +365,15 @@ free_bios:* @sdev: scsi device * @cmd: scsi command * @cmd_len: length of scsi cdb -* @data_direction: data direction +* @data_direction: DMA_TO_DEVICE, DMA_FROM_DEVICE, or DMA_NONE * @buffer: data buffer (this can be a kernel buffer or scatterlist) * @bufflen: len of buffer * @use_sg: if buffer is a scatterlist this is the number of elements * @timeout: request timeout in seconds * @retries: number of times to retry request -* @flags: or into request flags +* @privdata: data passed to done() +* @done: callback function when done +* @gfp: memory allocation flags **/ int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd, int cmd_len, int data_direction, void *buffer, unsigned bufflen,
@@ -1804,7 +1806,7 @@ void scsi_exit_queue(void)* @timeout: command timeout * @retries: number of retries before failing * @data: returns a structure abstracting the mode header data -* @sense: place to put sense data (or NULL if no sense to be collected). +* @sshdr: 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
@@ -1881,7 +1883,7 @@ EXPORT_SYMBOL_GPL(scsi_mode_select);* @timeout: command timeout * @retries: number of retries before failing * @data: returns a structure abstracting the mode header data -* @sense: place to put sense data (or NULL if no sense to be collected). +* @sshdr: 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
@@ -2324,7 +2326,7 @@ EXPORT_SYMBOL_GPL(scsi_target_unblock);/** * scsi_kmap_atomic_sg - find and atomically map an sg-elemnt -* @sg: scatter-gather list +* @sgl: scatter-gather list * @sg_count: number of segments in sg * @offset: offset in bytes into sg, on return offset into the mapped area * @len: bytes to map, on return number of bytes mapped
drivers/scsi/scsi_netlink.c +7 -12
@@ -32,11 +32,12 @@ EXPORT_SYMBOL_GPL(scsi_nl_sock);/** -* scsi_nl_rcv_msg - -* Receive message handler. Extracts message from a receive buffer. +* scsi_nl_rcv_msg - Receive message handler. +* @skb: socket receive buffer +* +* Description: Extracts message from a receive buffer. * Validates message header and calls appropriate transport message handler * -* @skb: socket receive buffer * **/ static void
@@ -99,9 +100,7 @@ next_msg:/** -* scsi_nl_rcv_event - -* Event handler for a netlink socket. -* +* scsi_nl_rcv_event - Event handler for a netlink socket. * @this: event notifier block * @event: event type * @ptr: event payload
@@ -129,9 +128,7 @@ static struct notifier_block scsi_netlin/** -* scsi_netlink_init - -* Called by SCSI subsystem to intialize the SCSI transport netlink -* interface +* scsi_netlink_init - Called by SCSI subsystem to intialize the SCSI transport netlink interface * **/ void
@@ -160,9 +157,7 @@ scsi_netlink_init(void)/** -* scsi_netlink_exit - -* Called by SCSI subsystem to disable the SCSI transport netlink -* interface +* scsi_netlink_exit - Called by SCSI subsystem to disable the SCSI transport netlink interface * **/ void
drivers/scsi/scsi_proc.c +108 -2
197 lines not on this page · raw message
drivers/scsi/scsi_scan.c +20 -10
@@ -221,6 +221,9 @@ static void scsi_unlock_floptical(struct/** * scsi_alloc_sdev - allocate and setup a scsi_Device +* @starget: which target to allocate a &scsi_device for +* @lun: which lun +* @hostdata: usually NULL and set by ->slave_alloc instead * * Description: * Allocate, initialize for io, and return a pointer to a scsi_Device.
@@ -954,9 +957,10 @@ static unsigned char *scsi_inq_str(unsig* scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it * @starget: pointer to target device structure * @lun: LUN of target device -* @sdevscan: probe the LUN corresponding to this scsi_device -* @sdevnew: store the value of any new scsi_device allocated * @bflagsp: store bflags here if not NULL +* @sdevp: probe the LUN corresponding to this scsi_device +* @rescan: if nonzero skip some code only needed on first scan +* @hostdata: passed to scsi_alloc_sdev() * * Description: * Call scsi_probe_lun, if a LUN with an attached device is found,
@@ -1107,6 +1111,8 @@ static int scsi_probe_and_add_lun(struct* scsi_sequential_lun_scan - sequentially scan a SCSI target * @starget: pointer to target structure to scan * @bflags: black/white list flag for LUN 0 +* @scsi_level: Which version of the standard does this device adhere to +* @rescan: passed to scsi_probe_add_lun() * * Description: * Generally, scan from LUN 1 (LUN 0 is assumed to already have been
@@ -1217,7 +1223,7 @@ EXPORT_SYMBOL(scsilun_to_int);/** * int_to_scsilun: reverts an int into a scsi_lun -* @int: integer to be reverted +* @lun: integer to be reverted * @scsilun: struct scsi_lun to be set. * * Description:
@@ -1249,18 +1255,22 @@ EXPORT_SYMBOL(int_to_scsilun);/** * scsi_report_lun_scan - Scan using SCSI REPORT LUN results -* @sdevscan: scan the host, channel, and id of this scsi_device +* @starget: which target +* @bflags: Zero or a mix of BLIST_NOLUN, BLIST_REPORTLUN2, or BLIST_NOREPORTLUN +* @rescan: nonzero if we can skip code only needed on first scan * * Description: -* If @sdevscan is for a SCSI-3 or up device, send a REPORT LUN -* command, and scan the resulting list of LUNs by calling -* scsi_probe_and_add_lun. -* -* Modifies sdevscan->lun. +* Fast scanning for modern (SCSI-3) devices by sending a REPORT LUN command. +* Scan the resulting list of LUNs by calling scsi_probe_and_add_lun. +* +* If BLINK_REPORTLUN2 is set, scan a target that supports more than 8 +* LUNs even if it's older than SCSI-3. +* If BLIST_NOREPORTLUN is set, return 1 always. +* If BLIST_NOLUN is set, return 0 always. * * Return: * 0: scan completed (or no memory, so further scanning is futile) -* 1: no report lun scan, or not configured +* 1: could not scan with REPORT LUN **/ static int scsi_report_lun_scan (struct scsi_target *starget,int bflags,int rescan)
drivers/scsi/scsi_transport_fc.c +14 -11
@@ -481,9 +481,9 @@ MODULE_PARM_DESC(dev_loss_tmo," exceeded, the scsi target is removed. Value should be" " between 1 and SCSI_DEVICE_BLOCK_MAX_TIMEOUT."); -/** +/* * Netlink Infrastructure -**/ +*/ static atomic_t fc_event_seq;
@@ -491,7 +491,7 @@ static atomic_t fc_event_seq;* fc_get_event_number - Obtain the next sequential FC event number * * Notes: -* We could have inline'd this, but it would have required fc_event_seq to +* We could have inlined this, but it would have required fc_event_seq to * be exposed. For now, live with the subroutine call. * Atomic used to avoid lock/unlock... **/
@@ -586,6 +586,7 @@ EXPORT_SYMBOL(fc_host_post_event);* @event_number: fc event number obtained from get_fc_event_number() * @data_len: amount, in bytes, of vendor unique data * @data_buf: pointer to vendor unique data +* @vendor_id: Vendor id * * Notes: * This routine assumes no locks are held on entry.
@@ -2214,13 +2215,13 @@ fc_flush_devloss(struct Scsi_Host *shost/** * fc_remove_host - called to terminate any fc_transport-related elements * for a scsi host. -* @rport: remote port to be unblocked. +* @shost: Which &Scsi_Host * * This routine is expected to be called immediately preceeding the * a driver's call to scsi_remove_host(). * * WARNING: A driver utilizing the fc_transport, which fails to call -* this routine prior to scsi_remote_host(), will leave dangling +* this routine prior to scsi_remove_host(), will leave dangling * objects in /sys/class/fc_remote_ports. Access to any of these * objects can result in a system crash !!! *
@@ -2691,11 +2692,11 @@ EXPORT_SYMBOL(fc_remote_port_add);* port is no longer part of the topology. Note: Although a port * may no longer be part of the topology, it may persist in the remote * ports displayed by the fc_host. We do this under 2 conditions: -* - If the port was a scsi target, we delay its deletion by "blocking" it. +* 1) If the port was a scsi target, we delay its deletion by "blocking" it. * This allows the port to temporarily disappear, then reappear without * disrupting the SCSI device tree attached to it. During the "blocked" * period the port will still exist. -* - If the port was a scsi target and disappears for longer than we +* 2) If the port was a scsi target and disappears for longer than we * expect, we'll delete the port and the tear down the SCSI device tree * attached to it. However, we want to semi-persist the target id assigned * to that port if it eventually does exist. The port structure will
@@ -2709,7 +2710,8 @@ EXPORT_SYMBOL(fc_remote_port_add);* temporary blocked state. From the LLDD's perspective, the rport no * longer exists. From the SCSI midlayer's perspective, the SCSI target * exists, but all sdevs on it are blocked from further I/O. The following -* is then expected: +* is then expected. +* * If the remote port does not return (signaled by a LLDD call to * fc_remote_port_add()) within the dev_loss_tmo timeout, then the * scsi target is removed - killing all outstanding i/o and removing the
@@ -2795,9 +2797,10 @@ EXPORT_SYMBOL(fc_remote_port_delete);* fc_remote_port_rolechg - notifies the fc transport that the roles * on a remote may have changed. * @rport: The remote port that changed. -* -* The LLDD calls this routine to notify the transport that the roles -* on a remote port may have changed. The largest effect of this is +* @roles: New roles for this port. +* +* Description: The LLDD calls this routine to notify the transport that the +* roles on a remote port may have changed. The largest effect of this is * if a port now becomes a FCP Target, it must be allocated a * scsi target id. If the port is no longer a FCP target, any * scsi target id value assigned to it will persist in case the
drivers/scsi/scsi_transport_iscsi.c +2 -1
@@ -328,6 +328,7 @@ EXPORT_SYMBOL_GPL(iscsi_add_session);* iscsi_create_session - create iscsi class session * @shost: scsi host * @transport: iscsi transport +* @target_id: which target * * This can be called from a LLD or iscsi_transport. **/
@@ -465,7 +466,7 @@ EXPORT_SYMBOL_GPL(iscsi_create_conn);/** * iscsi_destroy_conn - destroy iscsi class connection -* @session: iscsi cls session +* @conn: iscsi cls session * * This can be called from a LLD or iscsi_transport. **/
drivers/scsi/scsi_transport_sas.c +4 -1
@@ -1309,6 +1309,7 @@ static void sas_rphy_initialize(struct s/** * sas_end_device_alloc - allocate an rphy for an end device +* @parent: which port * * Allocates an SAS remote PHY structure, connected to @parent. *
@@ -1345,6 +1346,8 @@ EXPORT_SYMBOL(sas_end_device_alloc);/** * sas_expander_alloc - allocate an rphy for an end device +* @parent: which port +* @type: SAS_EDGE_EXPANDER_DEVICE or SAS_FANOUT_EXPANDER_DEVICE * * Allocates an SAS remote PHY structure, connected to @parent. *
@@ -1431,7 +1434,7 @@ EXPORT_SYMBOL(sas_rphy_add);/** * sas_rphy_free -- free a SAS remote PHY -* @rphy SAS remote PHY to free +* @rphy: SAS remote PHY to free * * Frees the specified SAS remote PHY. *
drivers/scsi/scsi_transport_srp.c +1 -1
@@ -243,7 +243,7 @@ EXPORT_SYMBOL_GPL(srp_rport_add);/** * srp_rport_del -- remove a SRP remote port -* @port: SRP remote port to remove +* @rport: SRP remote port to remove * * Removes the specified SRP remote port. */
drivers/scsi/scsicam.c +26 -13
@@ -24,6 +24,14 @@ static int setsize(unsigned long capacitstatic int setsize (unsigned long capacity,unsigned int *cyls,unsigned int *hds,unsigned int *secs); +/** +* scsi_bios_ptable - Read PC partition table out of first sector of device. +* @dev: from this device +* +* Description: Reads the first sector from the device and returns %0x42 bytes +* starting at offset %0x1be. +* Returns: partition table in kmalloc(GFP_KERNEL) memory, or NULL on error. +*/ unsigned char *scsi_bios_ptable (struct block_device *dev) {unsigned char *res =kmalloc (66 ,GFP_KERNEL );
@@ -43,15 +51,17 @@ unsigned char *scsi_bios_ptable(struct b }EXPORT_SYMBOL (scsi_bios_ptable); -/* -* Function : int scsicam_bios_param (struct block_device *bdev, ector_t capacity, int *ip) -* -* Purpose : to determine the BIOS mapping used for a drive in a +/** +* scsicam_bios_param - Determine geometry of a disk in cylinders/heads/sectors. +* @bdev: which device +* @capacity: size of the disk in sectors +* @ip: return value: ip[0]=heads, ip[1]=sectors, ip[2]=cylinders +* +* Description : determine the BIOS mapping/geometry used for a drive in a * SCSI-CAM system, storing the results in ip as required * by the HDIO_GETGEO ioctl(). * * Returns : -1 on failure, 0 on success. -* */ int scsicam_bios_param (struct block_device *bdev,sector_t capacity,int *ip)
@@ -98,15 +108,18 @@ int scsicam_bios_param(struct block_devi }EXPORT_SYMBOL (scsicam_bios_param); -/* -* Function : static int scsi_partsize(unsigned char *buf, unsigned long -* capacity,unsigned int *cyls, unsigned int *hds, unsigned int *secs); -* -* Purpose : to determine the BIOS mapping used to create the partition +/** +* scsi_partsize - Parse cylinders/heads/sectors from PC partition table +* @buf: partition table, see scsi_bios_ptable() +* @capacity: size of the disk in sectors +* @cyls: put cylinders here +* @hds: put heads here +* @secs: put sectors here +* +* Description: determine the BIOS mapping/geometry used to create the partition * table, storing the results in *cyls, *hds, and *secs * -* Returns : -1 on failure, 0 on success. -* +* Returns: -1 on failure, 0 on success. */ int scsi_partsize(unsigned char *buf, unsigned long capacity,
@@ -194,7 +207,7 @@ EXPORT_SYMBOL(scsi_partsize);* * WORKING X3T9.2 * DRAFT 792D -* +* see http://www.t10.org/ftp/t10/drafts/cam/cam-r12b.pdf * * Revision 6 * 10-MAR-94
Signature · 2 lines
"One of my most productive days was throwing away 1000 lines of code." - Ken Thompson.
Quoted 1 line · Rob Landley
drivers/scsi/scsi.c | 181 ++++-----
Also have a look at this:
"Fix a few misleading comments in scsi.c"
http://marc.info/?l=linux-scsi&m=119340708627893
"scsi.c: fix some typos in comments"
http://marc.info/?l=linux-scsi&m=114279682717770
Signature · 3 lines
Stefan Richter -=====-=-=== =-=- ==-== http://arcgraph.de/sr/
Quoted 8 lines · Stefan Richter
Quoted 1 line · Rob Landley
drivers/scsi/scsi.c | 181 ++++-----Also have a look at this:
"Fix a few misleading comments inscsi.c"
http://marc.info/?l=linux-scsi&m=119340708627893
"scsi.c: fix some typos in comments"
http://marc.info/?l=linux-scsi&m=114279682717770
Got it. I'll merge 'em this weekend, dinner calls...
Thanks,
Rob
Signature · 2 lines
"One of my most productive days was throwing away 1000 lines of code." - Ken Thompson.
Quoted 8 lines · Stefan Richter
Quoted 1 line · Rob Landley
drivers/scsi/scsi.c | 181 ++++-----Also have a look at this:
"Fix a few misleading comments inscsi.c"
http://marc.info/?l=linux-scsi&m=119340708627893
"scsi.c: fix some typos in comments"
http://marc.info/?l=linux-scsi&m=114279682717770
Got 'em. Updated. And I split them up. Stand by for patchbomb...
Rob
Signature · 2 lines
"One of my most productive days was throwing away 1000 lines of code." - Ken Thompson.