mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-04 22:00:19 -05:00
Adds new files for Cauchy RAID.
This commit is contained in:
parent
9a5978eb22
commit
d371fec14f
5 changed files with 273 additions and 0 deletions
111
combos.h
Normal file
111
combos.h
Normal file
|
|
@ -0,0 +1,111 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2013 Andrea Mazzoleni
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Combinations of 6 elements.
|
||||||
|
* Ends is marked with first element as -1.
|
||||||
|
*/
|
||||||
|
static int combo[][32][8] = {
|
||||||
|
/* combinations of 1 of 6 elements */
|
||||||
|
{
|
||||||
|
{ 0 },
|
||||||
|
{ 1 },
|
||||||
|
{ 2 },
|
||||||
|
{ 3 },
|
||||||
|
{ 4 },
|
||||||
|
{ 5 },
|
||||||
|
{ -1 }
|
||||||
|
},
|
||||||
|
/* combinations of 2 of 6 elements */
|
||||||
|
{
|
||||||
|
{ 0, 1 },
|
||||||
|
{ 0, 2 },
|
||||||
|
{ 0, 3 },
|
||||||
|
{ 0, 4 },
|
||||||
|
{ 0, 5 },
|
||||||
|
{ 1, 2 },
|
||||||
|
{ 1, 3 },
|
||||||
|
{ 1, 4 },
|
||||||
|
{ 1, 5 },
|
||||||
|
{ 2, 3 },
|
||||||
|
{ 2, 4 },
|
||||||
|
{ 2, 5 },
|
||||||
|
{ 3, 4 },
|
||||||
|
{ 3, 5 },
|
||||||
|
{ 4, 5 },
|
||||||
|
{ -1 }
|
||||||
|
},
|
||||||
|
/* combinations of 3 of 6 elements */
|
||||||
|
{
|
||||||
|
{ 0, 1, 2 },
|
||||||
|
{ 0, 1, 3 },
|
||||||
|
{ 0, 1, 4 },
|
||||||
|
{ 0, 1, 5 },
|
||||||
|
{ 0, 2, 3 },
|
||||||
|
{ 0, 2, 4 },
|
||||||
|
{ 0, 2, 5 },
|
||||||
|
{ 0, 3, 4 },
|
||||||
|
{ 0, 3, 5 },
|
||||||
|
{ 0, 4, 5 },
|
||||||
|
{ 1, 2, 3 },
|
||||||
|
{ 1, 2, 4 },
|
||||||
|
{ 1, 2, 5 },
|
||||||
|
{ 1, 3, 4 },
|
||||||
|
{ 1, 3, 5 },
|
||||||
|
{ 1, 4, 5 },
|
||||||
|
{ 2, 3, 4 },
|
||||||
|
{ 2, 3, 5 },
|
||||||
|
{ 2, 4, 5 },
|
||||||
|
{ 3, 4, 5 },
|
||||||
|
{ -1 }
|
||||||
|
},
|
||||||
|
/* combinations of 4 of 6 elements */
|
||||||
|
{
|
||||||
|
{ 0, 1, 2, 3 },
|
||||||
|
{ 0, 1, 2, 4 },
|
||||||
|
{ 0, 1, 2, 5 },
|
||||||
|
{ 0, 1, 3, 4 },
|
||||||
|
{ 0, 1, 3, 5 },
|
||||||
|
{ 0, 1, 4, 5 },
|
||||||
|
{ 0, 2, 3, 4 },
|
||||||
|
{ 0, 2, 3, 5 },
|
||||||
|
{ 0, 2, 4, 5 },
|
||||||
|
{ 0, 3, 4, 5 },
|
||||||
|
{ 1, 2, 3, 4 },
|
||||||
|
{ 1, 2, 3, 5 },
|
||||||
|
{ 1, 2, 4, 5 },
|
||||||
|
{ 1, 3, 4, 5 },
|
||||||
|
{ 2, 3, 4, 5 },
|
||||||
|
{ -1 }
|
||||||
|
},
|
||||||
|
/* combinations of 5 of 6 elements */
|
||||||
|
{
|
||||||
|
{ 0, 1, 2, 3, 4 },
|
||||||
|
{ 0, 1, 2, 3, 5 },
|
||||||
|
{ 0, 1, 2, 4, 5 },
|
||||||
|
{ 0, 1, 3, 4, 5 },
|
||||||
|
{ 0, 2, 3, 4, 5 },
|
||||||
|
{ 1, 2, 3, 4, 5 },
|
||||||
|
{ -1 }
|
||||||
|
},
|
||||||
|
/* combinations of 6 of 6 elements */
|
||||||
|
{
|
||||||
|
{ 0, 1, 2, 3, 4, 5 },
|
||||||
|
{ -1 }
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
98
mkcombos.c
Normal file
98
mkcombos.c
Normal file
|
|
@ -0,0 +1,98 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2013 Andrea Mazzoleni
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
unsigned combo(unsigned mask, unsigned pick, unsigned from, unsigned to, unsigned* map)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
unsigned count;
|
||||||
|
|
||||||
|
if (pick == 0) {
|
||||||
|
map[0] = mask;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
count = 0;
|
||||||
|
for(i=from;i<=to;++i)
|
||||||
|
count += combo(mask | (1 << i), pick - 1, i + 1, to, map + count);
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
void print_combo(unsigned n)
|
||||||
|
{
|
||||||
|
unsigned map[10000];
|
||||||
|
unsigned count;
|
||||||
|
unsigned i, j, k;
|
||||||
|
|
||||||
|
printf("/**\n");
|
||||||
|
printf(" * Combinations of %u elements.\n", n);
|
||||||
|
printf(" * Ends is marked with first element as -1.\n");
|
||||||
|
printf(" */\n");
|
||||||
|
printf("static int combo[][32][8] = {\n"); /* fixed value 32/8, change them if changing maximum n */
|
||||||
|
|
||||||
|
for(i=1;i<=n;++i) {
|
||||||
|
count = combo(0, i, 0, n - 1, map);
|
||||||
|
|
||||||
|
printf("\t/* combinations of %u of %u elements */\n", i, n);
|
||||||
|
printf("\t{\n");
|
||||||
|
for(j=0;j<count;++j) {
|
||||||
|
unsigned mask = map[j];
|
||||||
|
printf("\t\t{ ");
|
||||||
|
for(k=0;mask;++k) {
|
||||||
|
if (mask & 1) {
|
||||||
|
printf("%u", k);
|
||||||
|
mask >>= 1;
|
||||||
|
if (mask)
|
||||||
|
printf(", ");
|
||||||
|
} else {
|
||||||
|
mask >>= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf(" },\n");
|
||||||
|
}
|
||||||
|
printf("\t\t{ -1 }\n");
|
||||||
|
printf("\t},\n");
|
||||||
|
}
|
||||||
|
printf("};\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
printf("/*\n");
|
||||||
|
printf(" * Copyright (C) 2013 Andrea Mazzoleni\n");
|
||||||
|
printf(" *\n");
|
||||||
|
printf(" * This program is free software: you can redistribute it and/or modify\n");
|
||||||
|
printf(" * it under the terms of the GNU General Public License as published by\n");
|
||||||
|
printf(" * the Free Software Foundation, either version 2 of the License, or\n");
|
||||||
|
printf(" * (at your option) any later version.\n");
|
||||||
|
printf(" *\n");
|
||||||
|
printf(" * This program is distributed in the hope that it will be useful,\n");
|
||||||
|
printf(" * but WITHOUT ANY WARRANTY; without even the implied warranty of\n");
|
||||||
|
printf(" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n");
|
||||||
|
printf(" * GNU General Public License for more details.\n");
|
||||||
|
printf(" *\n");
|
||||||
|
printf(" * You should have received a copy of the GNU General Public License\n");
|
||||||
|
printf(" * along with this program. If not, see <http://www.gnu.org/licenses/>.\n");
|
||||||
|
printf(" */\n");
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
print_combo(6);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
22
test-raidHP-hole.conf
Normal file
22
test-raidHP-hole.conf
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
block_size 1
|
||||||
|
parity test/parity
|
||||||
|
q-parity test/q-parity
|
||||||
|
r-parity test/r-parity
|
||||||
|
s-parity test/s-parity
|
||||||
|
t-parity test/t-parity
|
||||||
|
u-parity test/u-parity
|
||||||
|
content test/content
|
||||||
|
content test/p-content
|
||||||
|
content test/q-content
|
||||||
|
content test/r-content
|
||||||
|
content test/s-content
|
||||||
|
content test/t-content
|
||||||
|
content test/u-content
|
||||||
|
disk disk1 test/disk1/
|
||||||
|
disk disk3 test/disk3/
|
||||||
|
disk disk4 test/disk4/
|
||||||
|
disk disk5 test/disk5/
|
||||||
|
disk disk6 test/disk6/
|
||||||
|
include *.hidden
|
||||||
|
exclude *.unrecoverable
|
||||||
|
|
||||||
22
test-raidHP.conf
Normal file
22
test-raidHP.conf
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
block_size 1
|
||||||
|
parity test/parity
|
||||||
|
q-parity test/q-parity
|
||||||
|
r-parity test/r-parity
|
||||||
|
s-parity test/s-parity
|
||||||
|
t-parity test/t-parity
|
||||||
|
u-parity test/u-parity
|
||||||
|
content test/content
|
||||||
|
content test/p-content
|
||||||
|
content test/q-content
|
||||||
|
content test/r-content
|
||||||
|
content test/t-content
|
||||||
|
content test/u-content
|
||||||
|
disk disk1 test/disk1/
|
||||||
|
disk disk2 test/disk2/
|
||||||
|
disk disk3 test/disk3/
|
||||||
|
disk disk4 test/disk4/
|
||||||
|
disk disk5 test/disk5/
|
||||||
|
disk disk6 test/disk6/
|
||||||
|
include *.hidden
|
||||||
|
exclude *.unrecoverable
|
||||||
|
|
||||||
20
test-raidPP.conf
Normal file
20
test-raidPP.conf
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
block_size 1
|
||||||
|
parity test/parity
|
||||||
|
q-parity test/q-parity
|
||||||
|
r-parity test/r-parity
|
||||||
|
s-parity test/s-parity
|
||||||
|
t-parity test/t-parity
|
||||||
|
content test/content
|
||||||
|
content test/p-content
|
||||||
|
content test/q-content
|
||||||
|
content test/r-content
|
||||||
|
content test/t-content
|
||||||
|
disk disk1 test/disk1/
|
||||||
|
disk disk2 test/disk2/
|
||||||
|
disk disk3 test/disk3/
|
||||||
|
disk disk4 test/disk4/
|
||||||
|
disk disk5 test/disk5/
|
||||||
|
disk disk6 test/disk6/
|
||||||
|
include *.hidden
|
||||||
|
exclude *.unrecoverable
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue