include/scsi/scsi_cmnd.h
Source file repositories/reference/linux-study-clean/include/scsi/scsi_cmnd.h
File Facts
- System
- Linux kernel
- Corpus path
include/scsi/scsi_cmnd.h- Extension
.h- Size
- 10718 bytes
- Lines
- 401
- Domain
- Repository Root And Misc
- Bucket
- include
- Inferred role
- Repository Root And Misc: implementation source
- Status
- source implementation candidate
Why This File Exists
Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/dma-mapping.hlinux/blkdev.hlinux/t10-pi.hlinux/list.hlinux/types.hlinux/timer.hlinux/scatterlist.hscsi/scsi_device.h
Detected Declarations
struct Scsi_Hoststruct scsi_data_bufferstruct scsi_pointerstruct scsi_cmndenum scsi_cmnd_submitterenum scsi_prot_operationsenum scsi_prot_flagsenum scsi_prot_target_typefunction scsi_dma_mapfunction scsi_dma_unmapfunction scsi_bufflenfunction scsi_set_residfunction scsi_get_residfunction scsi_sg_copy_from_bufferfunction scsi_sg_copy_to_bufferfunction scsi_get_sectorfunction scsi_get_lbafunction scsi_logical_block_countfunction scsi_set_prot_opfunction scsi_get_prot_opfunction scsi_set_prot_typefunction scsi_get_prot_typefunction scsi_prot_ref_tagfunction scsi_prot_intervalfunction scsi_prot_sg_countfunction set_status_bytefunction get_status_bytefunction set_host_bytefunction get_host_bytefunction scsi_msg_to_host_bytefunction scsi_transfer_length
Annotated Snippet
struct scsi_data_buffer {
struct sg_table table;
unsigned length;
};
/* embedded in scsi_cmnd */
struct scsi_pointer {
char *ptr; /* data pointer */
int this_residual; /* left in this buffer */
struct scatterlist *buffer; /* which buffer */
int buffers_residual; /* how many buffers left */
dma_addr_t dma_handle;
volatile int Status;
volatile int Message;
volatile int have_data_in;
volatile int sent_command;
volatile int phase;
};
/* for scmd->flags */
#define SCMD_TAGGED (1 << 0)
#define SCMD_INITIALIZED (1 << 1)
#define SCMD_LAST (1 << 2)
/*
* libata uses SCSI EH to fetch sense data for successful commands.
* SCSI EH should not overwrite scmd->result when SCMD_FORCE_EH_SUCCESS is set.
*/
#define SCMD_FORCE_EH_SUCCESS (1 << 3)
#define SCMD_FAIL_IF_RECOVERING (1 << 4)
/* flags preserved across unprep / reprep */
#define SCMD_PRESERVED_FLAGS (SCMD_INITIALIZED | SCMD_FAIL_IF_RECOVERING)
/* for scmd->state */
#define SCMD_STATE_COMPLETE 0
#define SCMD_STATE_INFLIGHT 1
enum scsi_cmnd_submitter {
SUBMITTED_BY_BLOCK_LAYER = 0,
SUBMITTED_BY_SCSI_ERROR_HANDLER = 1,
SUBMITTED_BY_SCSI_RESET_IOCTL = 2,
} __packed;
struct scsi_cmnd {
struct scsi_device *device;
struct list_head eh_entry; /* entry for the host eh_abort_list/eh_cmd_q */
struct delayed_work abort_work;
struct rcu_head rcu;
int eh_eflags; /* Used by error handlr */
int budget_token;
/*
* This is set to jiffies as it was when the command was first
* allocated. It is used to time how long the command has
* been outstanding
*/
unsigned long jiffies_at_alloc;
int retries;
int allowed;
unsigned char prot_op;
unsigned char prot_type;
unsigned char prot_flags;
enum scsi_cmnd_submitter submitter;
unsigned short cmd_len;
enum dma_data_direction sc_data_direction;
unsigned char cmnd[32]; /* SCSI CDB */
/* These elements define the operation we ultimately want to perform */
struct scsi_data_buffer sdb;
struct scsi_data_buffer *prot_sdb;
unsigned underflow; /* Return error if less than
this amount is transferred */
unsigned transfersize; /* How much we are guaranteed to
transfer with each SCSI transfer
(ie, between disconnect /
reconnects. Probably == sector
size */
unsigned resid_len; /* residual count */
unsigned sense_len;
unsigned char *sense_buffer;
Annotation
- Immediate include surface: `linux/dma-mapping.h`, `linux/blkdev.h`, `linux/t10-pi.h`, `linux/list.h`, `linux/types.h`, `linux/timer.h`, `linux/scatterlist.h`, `scsi/scsi_device.h`.
- Detected declarations: `struct Scsi_Host`, `struct scsi_data_buffer`, `struct scsi_pointer`, `struct scsi_cmnd`, `enum scsi_cmnd_submitter`, `enum scsi_prot_operations`, `enum scsi_prot_flags`, `enum scsi_prot_target_type`, `function scsi_dma_map`, `function scsi_dma_unmap`.
- Atlas domain: Repository Root And Misc / include.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.