Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
scsi_cmnd.h File Reference
#include <linux/dma-mapping.h>
#include <linux/blkdev.h>
#include <linux/list.h>
#include <linux/types.h>
#include <linux/timer.h>
#include <linux/scatterlist.h>

Go to the source code of this file.

Data Structures

struct  scsi_data_buffer
 
struct  scsi_pointer
 
struct  scsi_cmnd
 

Macros

#define MAX_COMMAND_SIZE   16
 
#define SCSI_SENSE_BUFFERSIZE   96
 
#define scsi_for_each_sg(cmd, sg, nseg, __i)   for_each_sg(scsi_sglist(cmd), sg, nseg, __i)
 
#define scsi_for_each_prot_sg(cmd, sg, nseg, __i)   for_each_sg(scsi_prot_sglist(cmd), sg, nseg, __i)
 

Enumerations

enum  scsi_prot_operations {
  SCSI_PROT_NORMAL = 0, SCSI_PROT_READ_INSERT, SCSI_PROT_WRITE_STRIP, SCSI_PROT_READ_STRIP,
  SCSI_PROT_WRITE_INSERT, SCSI_PROT_READ_PASS, SCSI_PROT_WRITE_PASS
}
 
enum  scsi_prot_target_type { SCSI_PROT_DIF_TYPE0 = 0, SCSI_PROT_DIF_TYPE1, SCSI_PROT_DIF_TYPE2, SCSI_PROT_DIF_TYPE3 }
 

Functions

struct scsi_cmndscsi_get_command (struct scsi_device *, gfp_t)
 
struct scsi_cmnd__scsi_get_command (struct Scsi_Host *, gfp_t)
 
void scsi_put_command (struct scsi_cmnd *)
 
void __scsi_put_command (struct Scsi_Host *, struct scsi_cmnd *, struct device *)
 
void scsi_finish_command (struct scsi_cmnd *cmd)
 
voidscsi_kmap_atomic_sg (struct scatterlist *sg, int sg_count, size_t *offset, size_t *len)
 
void scsi_kunmap_atomic_sg (void *virt)
 
int scsi_init_io (struct scsi_cmnd *cmd, gfp_t gfp_mask)
 
void scsi_release_buffers (struct scsi_cmnd *cmd)
 
int scsi_dma_map (struct scsi_cmnd *cmd)
 
void scsi_dma_unmap (struct scsi_cmnd *cmd)
 
struct scsi_cmndscsi_allocate_command (gfp_t gfp_mask)
 
void scsi_free_command (gfp_t gfp_mask, struct scsi_cmnd *cmd)
 

Macro Definition Documentation

#define MAX_COMMAND_SIZE   16

Definition at line 27 of file scsi_cmnd.h.

#define scsi_for_each_prot_sg (   cmd,
  sg,
  nseg,
  __i 
)    for_each_sg(scsi_prot_sglist(cmd), sg, nseg, __i)

Definition at line 294 of file scsi_cmnd.h.

#define scsi_for_each_sg (   cmd,
  sg,
  nseg,
  __i 
)    for_each_sg(scsi_sglist(cmd), sg, nseg, __i)

Definition at line 186 of file scsi_cmnd.h.

#define SCSI_SENSE_BUFFERSIZE   96

Definition at line 106 of file scsi_cmnd.h.

Enumeration Type Documentation

Enumerator:
SCSI_PROT_NORMAL 
SCSI_PROT_READ_INSERT 
SCSI_PROT_WRITE_STRIP 
SCSI_PROT_READ_STRIP 
SCSI_PROT_WRITE_INSERT 
SCSI_PROT_READ_PASS 
SCSI_PROT_WRITE_PASS 

Definition at line 224 of file scsi_cmnd.h.

Enumerator:
SCSI_PROT_DIF_TYPE0 
SCSI_PROT_DIF_TYPE1 
SCSI_PROT_DIF_TYPE2 
SCSI_PROT_DIF_TYPE3 

Definition at line 257 of file scsi_cmnd.h.

Function Documentation

struct scsi_cmnd* __scsi_get_command ( struct Scsi_Host shost,
gfp_t  gfp_mask 
)
read

__scsi_get_command - Allocate a struct scsi_cmnd : host to transmit command : allocation mask

Description: allocate a struct scsi_cmd from host's slab, recycling from the host's free_list if necessary.

Definition at line 251 of file scsi.c.

void __scsi_put_command ( struct Scsi_Host shost,
struct scsi_cmnd cmd,
struct device dev 
)

__scsi_put_command - Free a struct scsi_cmnd : dev->host : Command to free : parent scsi device

Definition at line 322 of file scsi.c.

struct scsi_cmnd* scsi_allocate_command ( gfp_t  gfp_mask)
read

scsi_allocate_command - get a fully allocated SCSI command : allocation mask

This function is for use outside of the normal host based pools. It allocates the relevant command and takes an additional reference on the pool it used. This function must be paired with scsi_free_command which also has the identical mask, otherwise the free pool counts will eventually go wrong and you'll trigger a bug.

This function should only be used by drivers that need a static command allocation at start of day for internal functions.

Definition at line 432 of file scsi.c.

int scsi_dma_map ( struct scsi_cmnd cmd)

scsi_dma_map - perform DMA mapping against command's sg lists : scsi command

Returns the number of sg lists actually used, zero if the sg lists is NULL, or -ENOMEM if the mapping failed.

Definition at line 22 of file scsi_lib_dma.c.

void scsi_dma_unmap ( struct scsi_cmnd cmd)

scsi_dma_unmap - unmap command's sg lists mapped by scsi_dma_map : scsi command

Definition at line 42 of file scsi_lib_dma.c.

void scsi_finish_command ( struct scsi_cmnd cmd)

scsi_finish_command - cleanup and pass command back to upper layer : the command

Description: Pass command off to upper layer for finishing of I/O request, waking processes that are waiting on results, etc.

Definition at line 799 of file scsi.c.

void scsi_free_command ( gfp_t  gfp_mask,
struct scsi_cmnd cmd 
)

scsi_free_command - free a command allocated by scsi_allocate_command : mask used in the original allocation : command to free

Note: using the original allocation mask is vital because that's what determines which command pool we use to free the command. Any mismatch will cause the system to BUG eventually.

Definition at line 452 of file scsi.c.

struct scsi_cmnd* scsi_get_command ( struct scsi_device dev,
gfp_t  gfp_mask 
)
read

scsi_get_command - Allocate and setup a scsi command block : parent scsi device : allocator flags

Returns: The allocated scsi command structure.

Definition at line 290 of file scsi.c.

int scsi_init_io ( struct scsi_cmnd cmd,
gfp_t  gfp_mask 
)

Definition at line 1045 of file scsi_lib.c.

void* scsi_kmap_atomic_sg ( struct scatterlist sgl,
int  sg_count,
size_t offset,
size_t len 
)

scsi_kmap_atomic_sg - find and atomically map an sg-elemnt : scatter-gather list : number of segments in sg : offset in bytes into sg, on return offset into the mapped area : bytes to map, on return number of bytes mapped

Returns virtual address of the start of the mapped page

Definition at line 2570 of file scsi_lib.c.

void scsi_kunmap_atomic_sg ( void virt)

scsi_kunmap_atomic_sg - atomically unmap a virtual address, previously mapped with scsi_kmap_atomic_sg : virtual address to be unmapped

Definition at line 2615 of file scsi_lib.c.

void scsi_put_command ( struct scsi_cmnd cmd)

scsi_put_command - Free a scsi command block : command block to free

Returns: Nothing.

Notes: The command must not belong to any lists.

Definition at line 350 of file scsi.c.

void scsi_release_buffers ( struct scsi_cmnd cmd)

Definition at line 693 of file scsi_lib.c.