drivers/firmware/efi/test/efi_test.c
Source file repositories/reference/linux-study-clean/drivers/firmware/efi/test/efi_test.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/firmware/efi/test/efi_test.c- Extension
.c- Size
- 17844 bytes
- Lines
- 785
- Domain
- Driver Families
- Bucket
- drivers/firmware
- 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.
- 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/miscdevice.hlinux/module.hlinux/init.hlinux/proc_fs.hlinux/efi.hlinux/security.hlinux/slab.hlinux/uaccess.hefi_test.h
Detected Declarations
function user_ucs2_strsizefunction copy_ucs2_from_user_lenfunction get_ucs2_strsize_from_userfunction copy_ucs2_from_user_lenfunction copy_to_userfunction efi_runtime_get_variablefunction efi_runtime_set_variablefunction efi_runtime_get_timefunction efi_runtime_set_timefunction efi_runtime_get_waketimefunction efi_runtime_set_waketimefunction efi_runtime_get_nextvariablenamefunction efi_runtime_get_nexthighmonocountfunction efi_runtime_reset_systemfunction efi_runtime_query_variableinfofunction efi_runtime_query_capsulecapsfunction efi_runtime_get_supported_maskfunction efi_test_ioctlfunction efi_test_openfunction efi_test_closefunction efi_test_initfunction efi_test_exitmodule init efi_test_init
Annotated Snippet
static const struct file_operations efi_test_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = efi_test_ioctl,
.open = efi_test_open,
.release = efi_test_close,
};
static struct miscdevice efi_test_dev = {
MISC_DYNAMIC_MINOR,
"efi_test",
&efi_test_fops
};
static int __init efi_test_init(void)
{
int ret;
ret = misc_register(&efi_test_dev);
if (ret) {
pr_err("efi_test: can't misc_register on minor=%d\n",
MISC_DYNAMIC_MINOR);
return ret;
}
return 0;
}
static void __exit efi_test_exit(void)
{
misc_deregister(&efi_test_dev);
}
module_init(efi_test_init);
module_exit(efi_test_exit);
Annotation
- Immediate include surface: `linux/miscdevice.h`, `linux/module.h`, `linux/init.h`, `linux/proc_fs.h`, `linux/efi.h`, `linux/security.h`, `linux/slab.h`, `linux/uaccess.h`.
- Detected declarations: `function user_ucs2_strsize`, `function copy_ucs2_from_user_len`, `function get_ucs2_strsize_from_user`, `function copy_ucs2_from_user_len`, `function copy_to_user`, `function efi_runtime_get_variable`, `function efi_runtime_set_variable`, `function efi_runtime_get_time`, `function efi_runtime_set_time`, `function efi_runtime_get_waketime`.
- Atlas domain: Driver Families / drivers/firmware.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.