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.

Dependency Surface

Detected Declarations

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

Implementation Notes