]> git.sesse.net Git - bcachefs-tools-debian/blob - c_src/raid/helper.h
move Rust sources to top level, C sources into c_src
[bcachefs-tools-debian] / c_src / raid / helper.h
1 /*
2  * Copyright (C) 2013 Andrea Mazzoleni
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  */
14
15 #ifndef __RAID_HELPER_H
16 #define __RAID_HELPER_H
17
18 /**
19  * Inserts an integer in a sorted vector.
20  *
21  * This function can be used to insert indexes in order, ready to be used for
22  * calling raid_rec().
23  *
24  * @n Number of integers currently in the vector.
25  * @v Vector of integers already sorted.
26  *   It must have extra space for the new elemet at the end.
27  * @i Value to insert.
28  */
29 void raid_insert(int n, int *v, int i);
30
31 /**
32  * Sorts a small vector of integers.
33  *
34  * If you have indexes not in order, you can use this function to sort them
35  * before calling raid_rec().
36  *
37  * @n Number of integers. No more than RAID_PARITY_MAX.
38  * @v Vector of integers.
39  */
40 void raid_sort(int n, int *v);
41
42 #endif
43