xref: /linux/lib/raid/raid6/algos.h (revision 2e05544060b9fef5d4d0e0172944e6956c55080f)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Copyright 2003 H. Peter Anvin - All Rights Reserved
4  */
5 #ifndef _PQ_IMPL_H
6 #define _PQ_IMPL_H
7 
8 #include <linux/init.h>
9 #include <linux/raid/pq_tables.h>
10 
11 /* Routine choices */
12 struct raid6_calls {
13 	const char *name;
14 	void (*gen_syndrome)(int disks, size_t bytes, void **ptrs);
15 	void (*xor_syndrome)(int disks, int start, int stop, size_t bytes,
16 			void **ptrs);
17 };
18 
19 struct raid6_recov_calls {
20 	const char *name;
21 	void (*data2)(int disks, size_t bytes, int faila, int failb,
22 			void **ptrs);
23 	void (*datap)(int disks, size_t bytes, int faila, void **ptrs);
24 };
25 
26 void __init raid6_algo_add(const struct raid6_calls *algo);
27 void __init raid6_algo_add_default(void);
28 void __init raid6_recov_algo_add(const struct raid6_recov_calls *algo);
29 
30 /* for the kunit test */
31 const struct raid6_calls *raid6_algo_find(unsigned int idx);
32 const struct raid6_recov_calls *raid6_recov_algo_find(unsigned int idx);
33 
34 /* generic implementations */
35 extern const struct raid6_calls raid6_intx1;
36 extern const struct raid6_calls raid6_intx2;
37 extern const struct raid6_calls raid6_intx4;
38 extern const struct raid6_calls raid6_intx8;
39 extern const struct raid6_recov_calls raid6_recov_intx1;
40 
41 #endif /* _PQ_IMPL_H */
42