drivers/s390/char/monwriter.c
Source file repositories/reference/linux-study-clean/drivers/s390/char/monwriter.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/char/monwriter.c- Extension
.c- Size
- 7953 bytes
- Lines
- 321
- 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/module.hlinux/moduleparam.hlinux/init.hlinux/errno.hlinux/types.hlinux/kernel.hlinux/miscdevice.hlinux/ctype.hlinux/poll.hlinux/mutex.hlinux/slab.hlinux/uaccess.hlinux/io.hasm/machine.hasm/ebcdic.hasm/appldata.hasm/monwriter.h
Detected Declarations
struct mon_bufstruct mon_privatefunction monwrite_diagfunction monwrite_new_hdrfunction monwrite_new_datafunction monwrite_openfunction monwrite_closefunction list_for_each_entry_safefunction monwrite_writefunction mon_initfunction mon_exitmodule init mon_init
Annotated Snippet
static const struct file_operations monwrite_fops = {
.owner = THIS_MODULE,
.open = &monwrite_open,
.release = &monwrite_close,
.write = &monwrite_write,
.llseek = noop_llseek,
};
static struct miscdevice mon_dev = {
.name = "monwriter",
.fops = &monwrite_fops,
.minor = MISC_DYNAMIC_MINOR,
};
/*
* module init/exit
*/
static int __init mon_init(void)
{
if (!machine_is_vm())
return -ENODEV;
/*
* misc_register() has to be the last action in module_init(), because
* file operations will be available right after this.
*/
return misc_register(&mon_dev);
}
static void __exit mon_exit(void)
{
misc_deregister(&mon_dev);
}
module_init(mon_init);
module_exit(mon_exit);
module_param_named(max_bufs, mon_max_bufs, int, 0644);
MODULE_PARM_DESC(max_bufs, "Maximum number of sample monitor data buffers "
"that can be active at one time");
MODULE_AUTHOR("Melissa Howland <Melissa.Howland@us.ibm.com>");
MODULE_DESCRIPTION("Character device driver for writing z/VM "
"APPLDATA monitor records.");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/init.h`, `linux/errno.h`, `linux/types.h`, `linux/kernel.h`, `linux/miscdevice.h`, `linux/ctype.h`.
- Detected declarations: `struct mon_buf`, `struct mon_private`, `function monwrite_diag`, `function monwrite_new_hdr`, `function monwrite_new_data`, `function monwrite_open`, `function monwrite_close`, `function list_for_each_entry_safe`, `function monwrite_write`, `function mon_init`.
- 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.