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.
- 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.
- 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/major.hlinux/errno.hlinux/export.hlinux/tty.hlinux/interrupt.hlinux/mm.hlinux/init.hlinux/vt_kern.hlinux/selection.hlinux/kbd_kern.hlinux/console.hlinux/device.hlinux/sched.hlinux/fs.hlinux/poll.hlinux/signal.hlinux/slab.hlinux/notifier.hlinux/uaccess.hasm/byteorder.hlinux/unaligned.h
Detected Declarations
struct vcs_poll_datafunction vcs_notifierfunction vcs_poll_data_freefunction vcs_poll_data_getfunction vcs_sizefunction vcs_lseekfunction scoped_guardfunction vcs_read_buf_unifunction vcs_read_buf_noattrfunction vcs_read_buffunction vcs_readfunction Compilersfunction vcs_writefunction vcs_pollfunction vcs_fasyncfunction vcs_openfunction vcs_releasefunction vcs_make_sysfsfunction vcs_remove_sysfsfunction vcs_init
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
- Immediate include surface: `linux/kernel.h`, `linux/major.h`, `linux/errno.h`, `linux/export.h`, `linux/tty.h`, `linux/interrupt.h`, `linux/mm.h`, `linux/init.h`.
- Detected declarations: `struct vcs_poll_data`, `function vcs_notifier`, `function vcs_poll_data_free`, `function vcs_poll_data_get`, `function vcs_size`, `function vcs_lseek`, `function scoped_guard`, `function vcs_read_buf_uni`, `function vcs_read_buf_noattr`, `function vcs_read_buf`.
- Atlas domain: Driver Families / drivers/tty.
- 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.