drivers/scsi/scsi_transport_iscsi.c
Source file repositories/reference/linux-study-clean/drivers/scsi/scsi_transport_iscsi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/scsi_transport_iscsi.c- Extension
.c- Size
- 153080 bytes
- Lines
- 5041
- Domain
- Driver Families
- Bucket
- drivers/scsi
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/mutex.hlinux/slab.hlinux/bsg-lib.hlinux/idr.hnet/tcp.hscsi/scsi.hscsi/scsi_host.hscsi/scsi_device.hscsi/scsi_transport.hscsi/scsi_transport_iscsi.hscsi/iscsi_if.hscsi/scsi_cmnd.hscsi/scsi_bsg_iscsi.htrace/events/iscsi.h
Detected Declarations
struct iscsi_internalstruct iscsi_scan_datafunction iscsi_transport_releasefunction show_transport_handlefunction __ATTRfunction show_ep_handlefunction iscsi_create_endpointfunction iscsi_destroy_endpointfunction iscsi_put_endpointfunction iscsi_iface_releasefunction iscsi_iface_attr_is_visiblefunction iscsi_create_ifacefunction iscsi_destroy_ifacefunction iscsi_flashnode_sess_attr_is_visiblefunction iscsi_flashnode_sess_releasefunction iscsi_flashnode_conn_attr_is_visiblefunction iscsi_flashnode_conn_releasefunction iscsi_flashnode_bus_matchfunction iscsi_create_flashnode_sessfunction iscsi_create_flashnode_connfunction iscsi_is_flashnode_conn_devfunction iscsi_destroy_flashnode_connfunction flashnode_match_indexfunction iscsi_get_flashnode_by_indexfunction iscsi_find_flashnode_sessfunction iscsi_find_flashnode_connfunction iscsi_iter_destroy_flashnode_conn_fnfunction iscsi_destroy_flashnode_sessfunction iscsi_iter_destroy_flashnode_fnfunction iscsi_destroy_all_flashnodefunction iscsi_bsg_host_dispatchfunction iscsi_bsg_host_addfunction iscsi_setup_hostfunction iscsi_remove_hostfunction iscsi_conn_get_sidfunction iscsi_session_chkreadyfunction iscsi_is_session_onlinefunction iscsi_session_releasefunction iscsi_is_session_devfunction iscsi_iter_session_fnfunction iscsi_host_for_each_sessionfunction iscsi_user_scan_sessionfunction iscsi_user_scanfunction iscsi_scan_sessionfunction iscsi_block_scsi_ehfunction session_recovery_timedoutfunction __iscsi_unblock_sessionfunction iscsi_unblock_session
Annotated Snippet
static const struct bus_type iscsi_flashnode_bus;
int iscsi_flashnode_bus_match(struct device *dev,
const struct device_driver *drv)
{
if (dev->bus == &iscsi_flashnode_bus)
return 1;
return 0;
}
EXPORT_SYMBOL_GPL(iscsi_flashnode_bus_match);
static const struct bus_type iscsi_flashnode_bus = {
.name = "iscsi_flashnode",
.match = &iscsi_flashnode_bus_match,
};
/**
* iscsi_create_flashnode_sess - Add flashnode session entry in sysfs
* @shost: pointer to host data
* @index: index of flashnode to add in sysfs
* @transport: pointer to transport data
* @dd_size: total size to allocate
*
* Adds a sysfs entry for the flashnode session attributes
*
* Returns:
* pointer to allocated flashnode sess on success
* %NULL on failure
*/
struct iscsi_bus_flash_session *
iscsi_create_flashnode_sess(struct Scsi_Host *shost, int index,
struct iscsi_transport *transport,
int dd_size)
{
struct iscsi_bus_flash_session *fnode_sess;
int err;
fnode_sess = kzalloc(sizeof(*fnode_sess) + dd_size, GFP_KERNEL);
if (!fnode_sess)
return NULL;
fnode_sess->transport = transport;
fnode_sess->target_id = index;
fnode_sess->dev.type = &iscsi_flashnode_sess_dev_type;
fnode_sess->dev.bus = &iscsi_flashnode_bus;
fnode_sess->dev.parent = &shost->shost_gendev;
dev_set_name(&fnode_sess->dev, "flashnode_sess-%u:%u",
shost->host_no, index);
err = device_register(&fnode_sess->dev);
if (err)
goto put_dev;
if (dd_size)
fnode_sess->dd_data = &fnode_sess[1];
return fnode_sess;
put_dev:
put_device(&fnode_sess->dev);
return NULL;
}
EXPORT_SYMBOL_GPL(iscsi_create_flashnode_sess);
/**
* iscsi_create_flashnode_conn - Add flashnode conn entry in sysfs
* @shost: pointer to host data
* @fnode_sess: pointer to the parent flashnode session entry
* @transport: pointer to transport data
* @dd_size: total size to allocate
*
* Adds a sysfs entry for the flashnode connection attributes
*
* Returns:
* pointer to allocated flashnode conn on success
* %NULL on failure
*/
struct iscsi_bus_flash_conn *
iscsi_create_flashnode_conn(struct Scsi_Host *shost,
struct iscsi_bus_flash_session *fnode_sess,
struct iscsi_transport *transport,
int dd_size)
{
struct iscsi_bus_flash_conn *fnode_conn;
int err;
fnode_conn = kzalloc(sizeof(*fnode_conn) + dd_size, GFP_KERNEL);
if (!fnode_conn)
return NULL;
Annotation
- Immediate include surface: `linux/module.h`, `linux/mutex.h`, `linux/slab.h`, `linux/bsg-lib.h`, `linux/idr.h`, `net/tcp.h`, `scsi/scsi.h`, `scsi/scsi_host.h`.
- Detected declarations: `struct iscsi_internal`, `struct iscsi_scan_data`, `function iscsi_transport_release`, `function show_transport_handle`, `function __ATTR`, `function show_ep_handle`, `function iscsi_create_endpoint`, `function iscsi_destroy_endpoint`, `function iscsi_put_endpoint`, `function iscsi_iface_release`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: pattern 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.