drivers/scsi/scsi_dh.c
Source file repositories/reference/linux-study-clean/drivers/scsi/scsi_dh.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/scsi_dh.c- Extension
.c- Size
- 9435 bytes
- Lines
- 376
- Domain
- Driver Families
- Bucket
- drivers/scsi
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/slab.hlinux/module.hscsi/scsi_dh.hscsi_priv.h
Detected Declarations
struct scsi_dh_blistfunction scsi_dh_find_driverfunction scsi_dh_handler_attachfunction scsi_dh_handler_detachfunction scsi_dh_add_devicefunction scsi_dh_release_devicefunction scsi_register_device_handlerfunction scsi_unregister_device_handlerfunction datafunction scsi_dh_set_paramsfunction scsi_dh_attachexport scsi_register_device_handlerexport scsi_unregister_device_handlerexport scsi_dh_activateexport scsi_dh_set_paramsexport scsi_dh_attachexport scsi_dh_attached_handler_name
Annotated Snippet
struct scsi_dh_blist {
const char *vendor;
const char *model;
const char *driver;
};
static const struct scsi_dh_blist scsi_dh_blist[] = {
{"DGC", "RAID", "emc" },
{"DGC", "DISK", "emc" },
{"DGC", "VRAID", "emc" },
{"COMPAQ", "MSA1000 VOLUME", "hp_sw" },
{"COMPAQ", "HSV110", "hp_sw" },
{"HP", "HSV100", "hp_sw"},
{"DEC", "HSG80", "hp_sw"},
{"IBM", "1722", "rdac", },
{"IBM", "1724", "rdac", },
{"IBM", "1726", "rdac", },
{"IBM", "1742", "rdac", },
{"IBM", "1745", "rdac", },
{"IBM", "1746", "rdac", },
{"IBM", "1813", "rdac", },
{"IBM", "1814", "rdac", },
{"IBM", "1815", "rdac", },
{"IBM", "1818", "rdac", },
{"IBM", "3526", "rdac", },
{"IBM", "3542", "rdac", },
{"IBM", "3552", "rdac", },
{"SGI", "TP9300", "rdac", },
{"SGI", "TP9400", "rdac", },
{"SGI", "TP9500", "rdac", },
{"SGI", "TP9700", "rdac", },
{"SGI", "IS", "rdac", },
{"STK", "OPENstorage", "rdac", },
{"STK", "FLEXLINE 380", "rdac", },
{"STK", "BladeCtlr", "rdac", },
{"SUN", "CSM", "rdac", },
{"SUN", "LCSM100", "rdac", },
{"SUN", "STK6580_6780", "rdac", },
{"SUN", "SUN_6180", "rdac", },
{"SUN", "ArrayStorage", "rdac", },
{"DELL", "MD3", "rdac", },
{"NETAPP", "INF-01-00", "rdac", },
{"LSI", "INF-01-00", "rdac", },
{"ENGENIO", "INF-01-00", "rdac", },
{"LENOVO", "DE_Series", "rdac", },
{"FUJITSU", "ETERNUS_AHB", "rdac", },
{NULL, NULL, NULL },
};
static const char *
scsi_dh_find_driver(struct scsi_device *sdev)
{
const struct scsi_dh_blist *b;
if (scsi_device_tpgs(sdev))
return "alua";
for (b = scsi_dh_blist; b->vendor; b++) {
if (!strncmp(sdev->vendor, b->vendor, strlen(b->vendor)) &&
!strncmp(sdev->model, b->model, strlen(b->model))) {
return b->driver;
}
}
return NULL;
}
static struct scsi_device_handler *__scsi_dh_lookup(const char *name)
{
struct scsi_device_handler *tmp, *found = NULL;
spin_lock(&list_lock);
list_for_each_entry(tmp, &scsi_dh_list, list) {
if (!strncmp(tmp->name, name, strlen(tmp->name))) {
found = tmp;
break;
}
}
spin_unlock(&list_lock);
return found;
}
static struct scsi_device_handler *scsi_dh_lookup(const char *name)
{
struct scsi_device_handler *dh;
if (!name || strlen(name) == 0)
return NULL;
Annotation
- Immediate include surface: `linux/slab.h`, `linux/module.h`, `scsi/scsi_dh.h`, `scsi_priv.h`.
- Detected declarations: `struct scsi_dh_blist`, `function scsi_dh_find_driver`, `function scsi_dh_handler_attach`, `function scsi_dh_handler_detach`, `function scsi_dh_add_device`, `function scsi_dh_release_device`, `function scsi_register_device_handler`, `function scsi_unregister_device_handler`, `function data`, `function scsi_dh_set_params`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: integration 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.