drivers/s390/char/vmcp.c
Source file repositories/reference/linux-study-clean/drivers/s390/char/vmcp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/char/vmcp.c- Extension
.c- Size
- 6558 bytes
- Lines
- 271
- Domain
- Driver Families
- Bucket
- drivers/s390
- 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/fs.hlinux/init.hlinux/kernel.hlinux/miscdevice.hlinux/slab.hlinux/uaccess.hlinux/mutex.hlinux/cma.hlinux/mm.hasm/machine.hasm/cpcmd.hasm/debug.hasm/vmcp.h
Detected Declarations
struct vmcp_sessionfunction early_parse_vmcp_cmafunction vmcp_cma_reservefunction vmcp_response_allocfunction vmcp_response_freefunction vmcp_openfunction vmcp_releasefunction vmcp_readfunction vmcp_writefunction vmcp_ioctlfunction vmcp_initmodule init vmcp_init
Annotated Snippet
static const struct file_operations vmcp_fops = {
.owner = THIS_MODULE,
.open = vmcp_open,
.release = vmcp_release,
.read = vmcp_read,
.write = vmcp_write,
.unlocked_ioctl = vmcp_ioctl,
};
static struct miscdevice vmcp_dev = {
.name = "vmcp",
.minor = MISC_DYNAMIC_MINOR,
.fops = &vmcp_fops,
};
static int __init vmcp_init(void)
{
int ret;
if (!machine_is_vm())
return 0;
vmcp_debug = debug_register("vmcp", 1, 1, 240);
if (!vmcp_debug)
return -ENOMEM;
ret = debug_register_view(vmcp_debug, &debug_hex_ascii_view);
if (ret) {
debug_unregister(vmcp_debug);
return ret;
}
ret = misc_register(&vmcp_dev);
if (ret)
debug_unregister(vmcp_debug);
return ret;
}
device_initcall(vmcp_init);
Annotation
- Immediate include surface: `linux/fs.h`, `linux/init.h`, `linux/kernel.h`, `linux/miscdevice.h`, `linux/slab.h`, `linux/uaccess.h`, `linux/mutex.h`, `linux/cma.h`.
- Detected declarations: `struct vmcp_session`, `function early_parse_vmcp_cma`, `function vmcp_cma_reserve`, `function vmcp_response_alloc`, `function vmcp_response_free`, `function vmcp_open`, `function vmcp_release`, `function vmcp_read`, `function vmcp_write`, `function vmcp_ioctl`.
- Atlas domain: Driver Families / drivers/s390.
- 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.