lib/raid/raid6/algos.c
Source file repositories/reference/linux-study-clean/lib/raid/raid6/algos.c
File Facts
- System
- Linux kernel
- Corpus path
lib/raid/raid6/algos.c- Extension
.c- Size
- 11203 bytes
- Lines
- 378
- 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/module.hlinux/gfp.hlinux/raid/pq.hlinux/slab.hlinux/static_call.hkunit/visibility.halgos.hpq_arch.h
Detected Declarations
function raid6_gen_syndromefunction raid6_xor_syndromefunction raid6_can_xor_syndromefunction raid6_recov_2datafunction raid6_recov_datapfunction raid6_choose_genfunction raid6_select_algofunction raid6_algo_addfunction raid6_algo_add_defaultfunction raid6_recov_algo_addfunction arch_raid6_initfunction raid6_initfunction raid6_exitmodule init raid6_initexport raid6_gen_syndromeexport raid6_xor_syndromeexport raid6_can_xor_syndromeexport raid6_recov_2dataexport raid6_recov_datap
Annotated Snippet
subsys_initcall(raid6_init);
module_exit(raid6_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("RAID6 Q-syndrome calculations");
#if IS_ENABLED(CONFIG_RAID6_PQ_KUNIT_TEST)
const struct raid6_calls *raid6_algo_find(unsigned int idx)
{
if (idx >= raid6_nr_algos) {
/*
* Always include the simplest generic integer implementation in
* the unit tests as a baseline.
*/
if (idx == raid6_nr_algos &&
raid6_algos[0] != &raid6_intx1)
return &raid6_intx1;
return NULL;
}
return raid6_algos[idx];
}
EXPORT_SYMBOL_IF_KUNIT(raid6_algo_find);
const struct raid6_recov_calls *raid6_recov_algo_find(unsigned int idx)
{
switch (idx) {
case 0:
/* always test the generic integer implementation */
return &raid6_recov_intx1;
case 1:
/* test the optimized implementation if there is one */
if (raid6_recov_algo != &raid6_recov_intx1)
return raid6_recov_algo;
return NULL;
default:
return NULL;
}
}
EXPORT_SYMBOL_IF_KUNIT(raid6_recov_algo_find);
#endif /* CONFIG_RAID6_PQ_KUNIT_TEST */
Annotation
- Immediate include surface: `linux/module.h`, `linux/gfp.h`, `linux/raid/pq.h`, `linux/slab.h`, `linux/static_call.h`, `kunit/visibility.h`, `algos.h`, `pq_arch.h`.
- Detected declarations: `function raid6_gen_syndrome`, `function raid6_xor_syndrome`, `function raid6_can_xor_syndrome`, `function raid6_recov_2data`, `function raid6_recov_datap`, `function raid6_choose_gen`, `function raid6_select_algo`, `function raid6_algo_add`, `function raid6_algo_add_default`, `function raid6_recov_algo_add`.
- 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.