drivers/scsi/mpt3sas/mpt3sas_debugfs.c
Source file repositories/reference/linux-study-clean/drivers/scsi/mpt3sas/mpt3sas_debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/mpt3sas/mpt3sas_debugfs.c- Extension
.c- Size
- 3731 bytes
- Lines
- 158
- 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.
- 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/kernel.hlinux/types.hlinux/pci.hlinux/interrupt.hlinux/compat.hlinux/uio.hscsi/scsi.hscsi/scsi_device.hscsi/scsi_host.hmpt3sas_base.hlinux/debugfs.h
Detected Declarations
function _debugfs_iocdump_readfunction _debugfs_iocdump_openfunction _debugfs_iocdump_releasefunction mpt3sas_init_debugfsfunction mpt3sas_exit_debugfsfunction mpt3sas_setup_debugfsfunction mpt3sas_destroy_debugfs
Annotated Snippet
static const struct file_operations mpt3sas_debugfs_iocdump_fops = {
.owner = THIS_MODULE,
.open = _debugfs_iocdump_open,
.read = _debugfs_iocdump_read,
.release = _debugfs_iocdump_release,
};
/*
* mpt3sas_init_debugfs : Create debugfs root for mpt3sas driver
*/
void mpt3sas_init_debugfs(void)
{
mpt3sas_debugfs_root = debugfs_create_dir("mpt3sas", NULL);
if (!mpt3sas_debugfs_root)
pr_info("mpt3sas: Cannot create debugfs root\n");
}
/*
* mpt3sas_exit_debugfs : Remove debugfs root for mpt3sas driver
*/
void mpt3sas_exit_debugfs(void)
{
debugfs_remove_recursive(mpt3sas_debugfs_root);
}
/*
* mpt3sas_setup_debugfs : Setup debugfs per HBA adapter
* ioc: MPT3SAS_ADAPTER object
*/
void
mpt3sas_setup_debugfs(struct MPT3SAS_ADAPTER *ioc)
{
char name[64];
snprintf(name, sizeof(name), "scsi_host%d", ioc->shost->host_no);
if (!ioc->debugfs_root) {
ioc->debugfs_root =
debugfs_create_dir(name, mpt3sas_debugfs_root);
if (!ioc->debugfs_root) {
dev_err(&ioc->pdev->dev,
"Cannot create per adapter debugfs directory\n");
return;
}
}
snprintf(name, sizeof(name), "ioc_dump");
ioc->ioc_dump = debugfs_create_file(name, 0444,
ioc->debugfs_root, ioc, &mpt3sas_debugfs_iocdump_fops);
if (!ioc->ioc_dump) {
dev_err(&ioc->pdev->dev,
"Cannot create ioc_dump debugfs file\n");
debugfs_remove(ioc->debugfs_root);
return;
}
snprintf(name, sizeof(name), "host_recovery");
debugfs_create_u8(name, 0444, ioc->debugfs_root, &ioc->shost_recovery);
}
/*
* mpt3sas_destroy_debugfs : Destroy debugfs per HBA adapter
* @ioc: MPT3SAS_ADAPTER object
*/
void mpt3sas_destroy_debugfs(struct MPT3SAS_ADAPTER *ioc)
{
debugfs_remove_recursive(ioc->debugfs_root);
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/types.h`, `linux/pci.h`, `linux/interrupt.h`, `linux/compat.h`, `linux/uio.h`, `scsi/scsi.h`, `scsi/scsi_device.h`.
- Detected declarations: `function _debugfs_iocdump_read`, `function _debugfs_iocdump_open`, `function _debugfs_iocdump_release`, `function mpt3sas_init_debugfs`, `function mpt3sas_exit_debugfs`, `function mpt3sas_setup_debugfs`, `function mpt3sas_destroy_debugfs`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: pattern implementation candidate.
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.