drivers/tty/vt/vc_screen.c

Source file repositories/reference/linux-study-clean/drivers/tty/vt/vc_screen.c

File Facts

System
Linux kernel
Corpus path
drivers/tty/vt/vc_screen.c
Extension
.c
Size
18144 bytes
Lines
807
Domain
Driver Families
Bucket
drivers/tty
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 vcs_fops = {
	.llseek		= vcs_lseek,
	.read		= vcs_read,
	.write		= vcs_write,
	.poll		= vcs_poll,
	.fasync		= vcs_fasync,
	.open		= vcs_open,
	.release	= vcs_release,
};

static const struct class vc_class = {
	.name = "vc",
};

void vcs_make_sysfs(int index)
{
	device_create(&vc_class, NULL, MKDEV(VCS_MAJOR, index + 1), NULL, "vcs%u", index + 1);
	device_create(&vc_class, NULL, MKDEV(VCS_MAJOR, index + 65), NULL, "vcsu%u", index + 1);
	device_create(&vc_class, NULL, MKDEV(VCS_MAJOR, index + 129), NULL, "vcsa%u", index + 1);
}

void vcs_remove_sysfs(int index)
{
	device_destroy(&vc_class, MKDEV(VCS_MAJOR, index + 1));
	device_destroy(&vc_class, MKDEV(VCS_MAJOR, index + 65));
	device_destroy(&vc_class, MKDEV(VCS_MAJOR, index + 129));
}

int __init vcs_init(void)
{
	unsigned int i;

	if (register_chrdev(VCS_MAJOR, "vcs", &vcs_fops))
		panic("unable to get major %d for vcs device", VCS_MAJOR);
	if (class_register(&vc_class))
		panic("unable to create vc_class");

	device_create(&vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs");
	device_create(&vc_class, NULL, MKDEV(VCS_MAJOR, 64), NULL, "vcsu");
	device_create(&vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa");
	for (i = 0; i < MIN_NR_CONSOLES; i++)
		vcs_make_sysfs(i);
	return 0;
}

Annotation

Implementation Notes