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.

Dependency Surface

Detected Declarations

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

Implementation Notes