lib/test_kho.c
Source file repositories/reference/linux-study-clean/lib/test_kho.c
File Facts
- System
- Linux kernel
- Corpus path
lib/test_kho.c- Extension
.c- Size
- 8246 bytes
- Lines
- 366
- Domain
- Kernel Services
- Bucket
- lib
- Inferred role
- Kernel Services: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
- Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/mm.hlinux/gfp.hlinux/slab.hlinux/kexec.hlinux/libfdt.hlinux/module.hlinux/printk.hlinux/vmalloc.hlinux/kexec_handover.hlinux/kho/abi/kexec_handover.hnet/checksum.h
Detected Declarations
struct kho_test_statefunction kho_test_unpreserve_datafunction kho_test_preserve_datafunction kho_test_prepare_fdtfunction kho_test_preservefunction kho_test_generate_datafunction get_orderfunction kho_test_savefunction kho_test_restore_datafunction kho_test_restorefunction kho_test_initfunction kho_test_cleanupfunction kho_test_exitmodule init kho_test_init
Annotated Snippet
module_init(kho_test_init);
static void kho_test_cleanup(void)
{
/* unpreserve and free the data stored in folios */
kho_test_unpreserve_data(&kho_test_state);
for (int i = 0; i < kho_test_state.nr_folios; i++)
folio_put(kho_test_state.folios[i]);
kvfree(kho_test_state.folios);
/* Unpreserve and release the FDT folio */
kho_unpreserve_folio(kho_test_state.fdt);
folio_put(kho_test_state.fdt);
}
static void __exit kho_test_exit(void)
{
kho_remove_subtree(folio_address(kho_test_state.fdt));
kho_test_cleanup();
}
module_exit(kho_test_exit);
MODULE_AUTHOR("Mike Rapoport <rppt@kernel.org>");
MODULE_DESCRIPTION("KHO test module");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `linux/mm.h`, `linux/gfp.h`, `linux/slab.h`, `linux/kexec.h`, `linux/libfdt.h`, `linux/module.h`, `linux/printk.h`, `linux/vmalloc.h`.
- Detected declarations: `struct kho_test_state`, `function kho_test_unpreserve_data`, `function kho_test_preserve_data`, `function kho_test_prepare_fdt`, `function kho_test_preserve`, `function kho_test_generate_data`, `function get_order`, `function kho_test_save`, `function kho_test_restore_data`, `function kho_test_restore`.
- Atlas domain: Kernel Services / lib.
- Implementation status: integration implementation candidate.
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.