drivers/xen/xenbus/xenbus_dev_frontend.c
Source file repositories/reference/linux-study-clean/drivers/xen/xenbus/xenbus_dev_frontend.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/xen/xenbus/xenbus_dev_frontend.c- Extension
.c- Size
- 17032 bytes
- Lines
- 725
- Domain
- Driver Families
- Bucket
- drivers/xen
- 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/errno.hlinux/uio.hlinux/notifier.hlinux/wait.hlinux/fs.hlinux/poll.hlinux/mutex.hlinux/sched.hlinux/spinlock.hlinux/mount.hlinux/pagemap.hlinux/uaccess.hlinux/init.hlinux/namei.hlinux/string.hlinux/slab.hlinux/miscdevice.hlinux/workqueue.hxen/xenbus.hxen/xen.hasm/xen/hypervisor.hxenbus.h
Detected Declarations
struct xenbus_transaction_holderstruct read_bufferstruct xenbus_file_privstruct watch_adapterfunction xenbus_file_readfunction queue_replyfunction queue_cleanupfunction free_watch_adapterfunction watch_firedfunction xenbus_workerfunction list_for_each_entry_safefunction list_for_each_entry_safefunction list_for_each_entry_safefunction xenbus_file_freefunction xenbus_dev_queue_replyfunction xenbus_command_replyfunction xenbus_write_transactionfunction xenbus_write_watchfunction list_for_each_entryfunction xenbus_file_writefunction xenbus_file_openfunction xenbus_file_releasefunction xenbus_file_pollfunction xenbus_initmodule init xenbus_initexport xen_xenbus_fops
Annotated Snippet
const struct file_operations xen_xenbus_fops = {
.read = xenbus_file_read,
.write = xenbus_file_write,
.open = xenbus_file_open,
.release = xenbus_file_release,
.poll = xenbus_file_poll,
};
EXPORT_SYMBOL_GPL(xen_xenbus_fops);
static struct miscdevice xenbus_dev = {
.minor = MISC_DYNAMIC_MINOR,
.name = "xen/xenbus",
.fops = &xen_xenbus_fops,
};
static int __init xenbus_init(void)
{
int err;
if (!xen_domain())
return -ENODEV;
err = misc_register(&xenbus_dev);
if (err)
pr_err("Could not register xenbus frontend device\n");
return err;
}
device_initcall(xenbus_init);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/errno.h`, `linux/uio.h`, `linux/notifier.h`, `linux/wait.h`, `linux/fs.h`, `linux/poll.h`, `linux/mutex.h`.
- Detected declarations: `struct xenbus_transaction_holder`, `struct read_buffer`, `struct xenbus_file_priv`, `struct watch_adapter`, `function xenbus_file_read`, `function queue_reply`, `function queue_cleanup`, `function free_watch_adapter`, `function watch_fired`, `function xenbus_worker`.
- Atlas domain: Driver Families / drivers/xen.
- 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.