include/scsi/scsi_device.h
Source file repositories/reference/linux-study-clean/include/scsi/scsi_device.h
File Facts
- System
- Linux kernel
- Corpus path
include/scsi/scsi_device.h- Extension
.h- Size
- 25606 bytes
- Lines
- 732
- 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/list.hlinux/spinlock.hlinux/workqueue.hlinux/blk-mq.hscsi/scsi.hscsi/scsi_common.hlinux/atomic.hlinux/sbitmap.h
Detected Declarations
struct bsg_devicestruct devicestruct request_queuestruct scsi_cmndstruct scsi_lunstruct scsi_sense_hdrstruct scsi_mode_datastruct scsi_eventstruct scsi_vpdstruct scsi_devicestruct scsi_targetstruct scsi_failurestruct scsi_failuresstruct scsi_exec_argsenum scsi_device_stateenum scsi_scan_modeenum scsi_device_eventenum scsi_target_statefunction scsi_autopm_get_devicefunction scsi_autopm_put_devicefunction sdev_channelfunction sdev_idfunction scsi_device_is_pseudo_devfunction scsi_device_onlinefunction scsi_device_blockedfunction scsi_device_createdfunction scsi_device_syncfunction scsi_device_widefunction scsi_device_dtfunction scsi_device_dt_onlyfunction scsi_device_iusfunction scsi_device_qasfunction scsi_device_enclosurefunction scsi_device_protectionfunction scsi_device_tpgsfunction scsi_device_supports_vpdfunction scsi_device_busy
Annotated Snippet
struct scsi_mode_data {
__u32 length;
__u16 block_descriptor_length;
__u8 medium_type;
__u8 device_specific;
__u8 header_length;
__u8 longlba:1;
};
/*
* sdev state: If you alter this, you also need to alter scsi_sysfs.c
* (for the ascii descriptions) and the state model enforcer:
* scsi_lib:scsi_device_set_state().
*/
enum scsi_device_state {
SDEV_CREATED = 1, /* device created but not added to sysfs
* Only internal commands allowed (for inq) */
SDEV_RUNNING, /* device properly configured
* All commands allowed */
SDEV_CANCEL, /* beginning to delete device
* Only error handler commands allowed */
SDEV_DEL, /* device deleted
* no commands allowed */
SDEV_QUIESCE, /* Device quiescent. No block commands
* will be accepted, only specials (which
* originate in the mid-layer) */
SDEV_OFFLINE, /* Device offlined (by error handling or
* user request */
SDEV_TRANSPORT_OFFLINE, /* Offlined by transport class error handler */
SDEV_BLOCK, /* Device blocked by scsi lld. No
* scsi commands from user or midlayer
* should be issued to the scsi
* lld. */
SDEV_CREATED_BLOCK, /* same as above but for created devices */
};
enum scsi_scan_mode {
SCSI_SCAN_INITIAL = 0,
SCSI_SCAN_RESCAN,
SCSI_SCAN_MANUAL,
};
enum scsi_device_event {
SDEV_EVT_MEDIA_CHANGE = 1, /* media has changed */
SDEV_EVT_INQUIRY_CHANGE_REPORTED, /* 3F 03 UA reported */
SDEV_EVT_CAPACITY_CHANGE_REPORTED, /* 2A 09 UA reported */
SDEV_EVT_SOFT_THRESHOLD_REACHED_REPORTED, /* 38 07 UA reported */
SDEV_EVT_MODE_PARAMETER_CHANGE_REPORTED, /* 2A 01 UA reported */
SDEV_EVT_LUN_CHANGE_REPORTED, /* 3F 0E UA reported */
SDEV_EVT_ALUA_STATE_CHANGE_REPORTED, /* 2A 06 UA reported */
SDEV_EVT_POWER_ON_RESET_OCCURRED, /* 29 00 UA reported */
SDEV_EVT_FIRST = SDEV_EVT_MEDIA_CHANGE,
SDEV_EVT_LAST = SDEV_EVT_POWER_ON_RESET_OCCURRED,
SDEV_EVT_MAXBITS = SDEV_EVT_LAST + 1
};
struct scsi_event {
enum scsi_device_event evt_type;
struct list_head node;
/* put union of data structures, for non-simple event types,
* here
*/
};
/**
* struct scsi_vpd - SCSI Vital Product Data
* @rcu: For kfree_rcu().
* @len: Length in bytes of @data.
* @data: VPD data as defined in various T10 SCSI standard documents.
*/
struct scsi_vpd {
struct rcu_head rcu;
int len;
unsigned char data[];
};
struct scsi_device {
struct Scsi_Host *host;
struct request_queue *request_queue;
/* the next two are protected by the host->host_lock */
struct list_head siblings; /* list of all devices on this host */
struct list_head same_target_siblings; /* just the devices sharing same target id */
struct sbitmap budget_map;
atomic_t device_blocked; /* Device returned QUEUE_FULL. */
Annotation
- Immediate include surface: `linux/list.h`, `linux/spinlock.h`, `linux/workqueue.h`, `linux/blk-mq.h`, `scsi/scsi.h`, `scsi/scsi_common.h`, `linux/atomic.h`, `linux/sbitmap.h`.
- Detected declarations: `struct bsg_device`, `struct device`, `struct request_queue`, `struct scsi_cmnd`, `struct scsi_lun`, `struct scsi_sense_hdr`, `struct scsi_mode_data`, `struct scsi_event`, `struct scsi_vpd`, `struct scsi_device`.
- 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.