drivers/scsi/megaraid/megaraid_sas_debugfs.c
Source file repositories/reference/linux-study-clean/drivers/scsi/megaraid/megaraid_sas_debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/megaraid/megaraid_sas_debugfs.c- Extension
.c- Size
- 4594 bytes
- Lines
- 180
- 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/irq_poll.hscsi/scsi.hscsi/scsi_device.hscsi/scsi_host.hmegaraid_sas_fusion.hmegaraid_sas.hlinux/debugfs.h
Detected Declarations
function megasas_debugfs_readfunction megasas_debugfs_raidmap_openfunction megasas_debugfs_releasefunction megasas_init_debugfsfunction megasas_exit_debugfsfunction megasas_setup_debugfsfunction megasas_destroy_debugfsfunction megasas_init_debugfs
Annotated Snippet
static const struct file_operations megasas_debugfs_raidmap_fops = {
.owner = THIS_MODULE,
.open = megasas_debugfs_raidmap_open,
.read = megasas_debugfs_read,
.release = megasas_debugfs_release,
};
/*
* megasas_init_debugfs : Create debugfs root for megaraid_sas driver
*/
void megasas_init_debugfs(void)
{
megasas_debugfs_root = debugfs_create_dir("megaraid_sas", NULL);
if (!megasas_debugfs_root)
pr_info("Cannot create debugfs root\n");
}
/*
* megasas_exit_debugfs : Remove debugfs root for megaraid_sas driver
*/
void megasas_exit_debugfs(void)
{
debugfs_remove_recursive(megasas_debugfs_root);
}
/*
* megasas_setup_debugfs : Setup debugfs per Fusion adapter
* instance: Soft instance of adapter
*/
void
megasas_setup_debugfs(struct megasas_instance *instance)
{
char name[64];
struct fusion_context *fusion;
fusion = instance->ctrl_context;
if (fusion) {
snprintf(name, sizeof(name),
"scsi_host%d", instance->host->host_no);
if (!instance->debugfs_root) {
instance->debugfs_root =
debugfs_create_dir(name, megasas_debugfs_root);
if (!instance->debugfs_root) {
dev_err(&instance->pdev->dev,
"Cannot create per adapter debugfs directory\n");
return;
}
}
snprintf(name, sizeof(name), "raidmap_dump");
instance->raidmap_dump =
debugfs_create_file(name, S_IRUGO,
instance->debugfs_root, instance,
&megasas_debugfs_raidmap_fops);
if (!instance->raidmap_dump) {
dev_err(&instance->pdev->dev,
"Cannot create raidmap debugfs file\n");
debugfs_remove(instance->debugfs_root);
return;
}
}
}
/*
* megasas_destroy_debugfs : Destroy debugfs per Fusion adapter
* instance: Soft instance of adapter
*/
void megasas_destroy_debugfs(struct megasas_instance *instance)
{
debugfs_remove_recursive(instance->debugfs_root);
}
#else
void megasas_init_debugfs(void)
{
}
void megasas_exit_debugfs(void)
{
}
void megasas_setup_debugfs(struct megasas_instance *instance)
{
}
void megasas_destroy_debugfs(struct megasas_instance *instance)
{
}
#endif /*CONFIG_DEBUG_FS*/
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/types.h`, `linux/pci.h`, `linux/interrupt.h`, `linux/compat.h`, `linux/irq_poll.h`, `scsi/scsi.h`, `scsi/scsi_device.h`.
- Detected declarations: `function megasas_debugfs_read`, `function megasas_debugfs_raidmap_open`, `function megasas_debugfs_release`, `function megasas_init_debugfs`, `function megasas_exit_debugfs`, `function megasas_setup_debugfs`, `function megasas_destroy_debugfs`, `function megasas_init_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.