kernel/irq/debugfs.c
Source file repositories/reference/linux-study-clean/kernel/irq/debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
kernel/irq/debugfs.c- Extension
.c- Size
- 7186 bytes
- Lines
- 257
- Domain
- Core OS
- Bucket
- Scheduler, Processes, Timers, Sync, And Syscalls
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/irqdomain.hlinux/irq.hlinux/uaccess.hinternals.h
Detected Declarations
function irq_debug_show_bitsfunction irq_debug_show_masksfunction irq_debug_show_masksfunction irq_debug_show_chipfunction irq_debug_show_datafunction irq_debug_showfunction irq_debug_openfunction irq_debug_writefunction irq_debugfs_copy_devnamefunction irq_add_debugfs_entryfunction irq_debugfs_init
Annotated Snippet
static const struct file_operations dfs_irq_ops = {
.open = irq_debug_open,
.write = irq_debug_write,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
void irq_debugfs_copy_devname(int irq, struct device *dev)
{
struct irq_desc *desc = irq_to_desc(irq);
const char *name = dev_name(dev);
if (name)
desc->dev_name = kstrdup(name, GFP_KERNEL);
}
void irq_add_debugfs_entry(unsigned int irq, struct irq_desc *desc)
{
char name [12];
if (!irq_dir || !desc || desc->debugfs_file)
return;
sprintf(name, "%u", irq);
desc->debugfs_file = debugfs_create_file(name, 0644, irq_dir, desc,
&dfs_irq_ops);
}
static int __init irq_debugfs_init(void)
{
struct dentry *root_dir;
int irq;
root_dir = debugfs_create_dir("irq", NULL);
irq_domain_debugfs_init(root_dir);
irq_dir = debugfs_create_dir("irqs", root_dir);
irq_lock_sparse();
for_each_active_irq(irq)
irq_add_debugfs_entry(irq, irq_to_desc(irq));
irq_unlock_sparse();
return 0;
}
__initcall(irq_debugfs_init);
Annotation
- Immediate include surface: `linux/irqdomain.h`, `linux/irq.h`, `linux/uaccess.h`, `internals.h`.
- Detected declarations: `function irq_debug_show_bits`, `function irq_debug_show_masks`, `function irq_debug_show_masks`, `function irq_debug_show_chip`, `function irq_debug_show_data`, `function irq_debug_show`, `function irq_debug_open`, `function irq_debug_write`, `function irq_debugfs_copy_devname`, `function irq_add_debugfs_entry`.
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.