drivers/block/aoe/aoechr.c
Source file repositories/reference/linux-study-clean/drivers/block/aoe/aoechr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/block/aoe/aoechr.c- Extension
.c- Size
- 6304 bytes
- Lines
- 323
- Domain
- Driver Families
- Bucket
- drivers/block
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/hdreg.hlinux/blkdev.hlinux/completion.hlinux/delay.hlinux/slab.hlinux/mutex.hlinux/skbuff.hlinux/export.haoe.h
Detected Declarations
struct aoe_chardevstruct ErrMsgfunction discoverfunction interfacesfunction revalidatefunction aoechr_errorfunction aoechr_writefunction aoechr_openfunction aoechr_relfunction aoechr_readfunction aoechr_initfunction aoechr_exit
Annotated Snippet
static const struct file_operations aoe_fops = {
.write = aoechr_write,
.read = aoechr_read,
.open = aoechr_open,
.release = aoechr_rel,
.owner = THIS_MODULE,
.llseek = noop_llseek,
};
int __init
aoechr_init(void)
{
int n, i;
n = register_chrdev(AOE_MAJOR, "aoechr", &aoe_fops);
if (n < 0) {
printk(KERN_ERR "aoe: can't register char device\n");
return n;
}
init_completion(&emsgs_comp);
spin_lock_init(&emsgs_lock);
n = class_register(&aoe_class);
if (n) {
unregister_chrdev(AOE_MAJOR, "aoechr");
return n;
}
for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
device_create(&aoe_class, NULL,
MKDEV(AOE_MAJOR, chardevs[i].minor), NULL,
chardevs[i].name);
return 0;
}
void
aoechr_exit(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
device_destroy(&aoe_class, MKDEV(AOE_MAJOR, chardevs[i].minor));
class_unregister(&aoe_class);
unregister_chrdev(AOE_MAJOR, "aoechr");
}
Annotation
- Immediate include surface: `linux/hdreg.h`, `linux/blkdev.h`, `linux/completion.h`, `linux/delay.h`, `linux/slab.h`, `linux/mutex.h`, `linux/skbuff.h`, `linux/export.h`.
- Detected declarations: `struct aoe_chardev`, `struct ErrMsg`, `function discover`, `function interfaces`, `function revalidate`, `function aoechr_error`, `function aoechr_write`, `function aoechr_open`, `function aoechr_rel`, `function aoechr_read`.
- Atlas domain: Driver Families / drivers/block.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.