raid: reformat using new code style

Signed-off-by: Marcel Cornu <marcel.d.cornu@intel.com>
This commit is contained in:
Marcel Cornu 2024-04-19 17:09:54 +01:00 committed by Pablo de Lara
parent cf6105271a
commit ae951677ab
10 changed files with 893 additions and 884 deletions

View File

@ -37,7 +37,6 @@ DEFINE_INTERFACE_DISPATCHER(xor_gen)
return PROVIDER_INFO(xor_gen_neon);
#endif
return PROVIDER_BASIC(xor_gen);
}
DEFINE_INTERFACE_DISPATCHER(xor_check)
@ -49,7 +48,6 @@ DEFINE_INTERFACE_DISPATCHER(xor_check)
return PROVIDER_INFO(xor_check_neon);
#endif
return PROVIDER_BASIC(xor_check);
}
DEFINE_INTERFACE_DISPATCHER(pq_gen)
@ -61,7 +59,6 @@ DEFINE_INTERFACE_DISPATCHER(pq_gen)
return PROVIDER_INFO(pq_gen_neon);
#endif
return PROVIDER_BASIC(pq_gen);
}
DEFINE_INTERFACE_DISPATCHER(pq_check)
@ -73,5 +70,4 @@ DEFINE_INTERFACE_DISPATCHER(pq_check)
return PROVIDER_INFO(pq_check_neon);
#endif
return PROVIDER_BASIC(pq_check);
}

View File

@ -41,7 +41,8 @@
#define TEST_SEED 0x1234
#endif
int ref_multi_pq(int vects, int len, void **array)
int
ref_multi_pq(int vects, int len, void **array)
{
int i, j;
unsigned char p, q, s;
@ -63,14 +64,16 @@ int ref_multi_pq(int vects, int len, void **array)
// Generates pseudo-random data
void rand_buffer(unsigned char *buf, long buffer_size)
void
rand_buffer(unsigned char *buf, long buffer_size)
{
long i;
for (i = 0; i < buffer_size; i++)
buf[i] = rand();
}
int main(int argc, char *argv[])
int
main(int argc, char *argv[])
{
int i, j, k, ret, fail = 0;
void *buffs[TEST_SOURCES + 2] = { NULL };
@ -155,9 +158,8 @@ int main(int argc, char *argv[])
ret = pq_check(TEST_SOURCES + 2, TEST_LEN, buffs);
if (ret != 0) { // should pass
fail++;
printf
("\nFail rand test with un-corrupted buffer j=%d, i=%d\n",
j, i);
printf("\nFail rand test with un-corrupted buffer j=%d, i=%d\n", j,
i);
goto exit;
}
c = ((char *) buffs[j])[i];
@ -200,8 +202,8 @@ int main(int argc, char *argv[])
ret = pq_check(j, TEST_LEN, buffs);
if (ret == 0) { // Should fail
printf
("\nfail rand fixed len test corrupted buffer %d sources\n",
printf("\nfail rand fixed len test corrupted buffer %d "
"sources\n",
j);
fail++;
goto exit;
@ -233,8 +235,8 @@ int main(int argc, char *argv[])
// See if it still passes
ret = pq_check(j, k, buffs);
if (ret != 0) { // Should pass
printf
("\nfail rand var src, len test %d sources, len=%d\n",
printf("\nfail rand var src, len test %d sources, "
"len=%d\n",
j, k);
fail++;
goto exit;
@ -246,10 +248,10 @@ int main(int argc, char *argv[])
ret = pq_check(j, k, buffs);
if (ret == 0) { // Should fail
printf
("\nfail rand var src, len test corrupted buffer "
"%d sources, len=%d, ret=%d\n", j, k,
ret);
printf("\nfail rand var src, len test corrupted "
"buffer "
"%d sources, len=%d, ret=%d\n",
j, k, ret);
fail++;
goto exit;
}
@ -286,12 +288,11 @@ int main(int argc, char *argv[])
c = tmp_buf[serr][lerr];
tmp_buf[serr][lerr] = c ^ 1;
ret =
pq_check(TEST_SOURCES + 2, TEST_LEN - i, (void *)tmp_buf);
ret = pq_check(TEST_SOURCES + 2, TEST_LEN - i, (void *) tmp_buf);
if (ret == 0) {
printf("fail end test corrupted buffer - "
"offset: %d, len: %d, ret: %d\n", i,
TEST_LEN - i, ret);
"offset: %d, len: %d, ret: %d\n",
i, TEST_LEN - i, ret);
fail++;
goto exit;
}
@ -313,5 +314,4 @@ int main(int argc, char *argv[])
for (i = 0; i < TEST_SOURCES + 2; i++)
aligned_free(buffs[i]);
return fail;
}

View File

@ -54,7 +54,8 @@
#define TEST_MEM ((TEST_SOURCES + 2) * (TEST_LEN))
int main(int argc, char *argv[])
int
main(int argc, char *argv[])
{
int i;
void *buffs[TEST_SOURCES + 2];

View File

@ -44,14 +44,16 @@
// Generates pseudo-random data
void rand_buffer(unsigned char *buf, long buffer_size)
void
rand_buffer(unsigned char *buf, long buffer_size)
{
long i;
for (i = 0; i < buffer_size; i++)
buf[i] = rand();
}
int dump(unsigned char *buf, int len)
int
dump(unsigned char *buf, int len)
{
int i;
for (i = 0; i < len;) {
@ -63,7 +65,8 @@ int dump(unsigned char *buf, int len)
return 0;
}
int main(int argc, char *argv[])
int
main(int argc, char *argv[])
{
int i, j, k, ret = 0, fail = 0;
void *buffs[TEST_SOURCES + 2] = { NULL }; // Pointers to src and dest
@ -164,7 +167,8 @@ int main(int argc, char *argv[])
if (fail > 0) {
printf("fail rand test %d sources, len=%d, fail="
"%d, ret=%d\n", j, k, fail, ret);
"%d, ret=%d\n",
j, k, fail, ret);
goto exit;
}
}
@ -187,7 +191,8 @@ int main(int argc, char *argv[])
if (fail > 0) {
printf("fail end test - offset: %d, len: %d, fail: %d, "
"ret: %d\n", k, TEST_LEN - k, fail, ret);
"ret: %d\n",
k, TEST_LEN - k, fail, ret);
goto exit;
}
#ifdef TEST_VERBOSE

View File

@ -40,7 +40,8 @@
#define gf8poly 0x1d1d1d1dUL
#endif
int pq_gen_base(int vects, int len, void **array)
int
pq_gen_base(int vects, int len, void **array)
{
int i, j;
unsigned long p, q, s;
@ -66,7 +67,8 @@ int pq_gen_base(int vects, int len, void **array)
return 0;
}
int pq_check_base(int vects, int len, void **array)
int
pq_check_base(int vects, int len, void **array)
{
int i, j;
unsigned char p, q, s;
@ -94,7 +96,8 @@ int pq_check_base(int vects, int len, void **array)
return 0;
}
int xor_gen_base(int vects, int len, void **array)
int
xor_gen_base(int vects, int len, void **array)
{
int i, j;
unsigned char parity;
@ -109,13 +112,13 @@ int xor_gen_base(int vects, int len, void **array)
parity ^= src[j][i];
src[vects - 1][i] = parity; // last pointer is dest
}
return 0;
}
int xor_check_base(int vects, int len, void **array)
int
xor_check_base(int vects, int len, void **array)
{
int i, j, fail = 0;

View File

@ -29,22 +29,26 @@
#include "raid.h"
int pq_gen(int vects, int len, void **array)
int
pq_gen(int vects, int len, void **array)
{
return pq_gen_base(vects, len, array);
}
int pq_check(int vects, int len, void **array)
int
pq_check(int vects, int len, void **array)
{
return pq_check_base(vects, len, array);
}
int xor_gen(int vects, int len, void **array)
int
xor_gen(int vects, int len, void **array)
{
return xor_gen_base(vects, len, array);
}
int xor_check(int vects, int len, void **array)
int
xor_check(int vects, int len, void **array)
{
return xor_check_base(vects, len, array);
}

View File

@ -43,14 +43,16 @@
// Generates pseudo-random data
void rand_buffer(unsigned char *buf, long buffer_size)
void
rand_buffer(unsigned char *buf, long buffer_size)
{
long i;
for (i = 0; i < buffer_size; i++)
buf[i] = rand();
}
int main(int argc, char *argv[])
int
main(int argc, char *argv[])
{
int i, j, k, ret, fail = 0;
void *buffs[TEST_SOURCES + 1] = { NULL };
@ -136,9 +138,8 @@ int main(int argc, char *argv[])
ret = xor_check(TEST_SOURCES + 1, TEST_LEN, buffs);
if (ret != 0) { // should pass
fail++;
printf
("\nFail rand test with un-corrupted buffer j=%d, i=%d\n",
j, i);
printf("\nFail rand test with un-corrupted buffer j=%d, i=%d\n", j,
i);
goto exit;
}
c = ((char *) buffs[j])[i];
@ -181,9 +182,7 @@ int main(int argc, char *argv[])
ret = xor_check(j, TEST_LEN, buffs);
if (ret == 0) { // Should fail
printf
("\nfail rand test corrupted buffer %d sources\n",
j);
printf("\nfail rand test corrupted buffer %d sources\n", j);
fail++;
goto exit;
}
@ -225,8 +224,8 @@ int main(int argc, char *argv[])
ret = xor_check(j, k, buffs);
if (ret == 0) { // Should fail
printf("\nfail rand test corrupted buffer "
"%d sources, len=%d, ret=%d\n", j, k,
ret);
"%d sources, len=%d, ret=%d\n",
j, k, ret);
fail++;
goto exit;
}
@ -263,12 +262,11 @@ int main(int argc, char *argv[])
c = tmp_buf[serr][lerr];
tmp_buf[serr][lerr] = c ^ 1;
ret =
xor_check(TEST_SOURCES + 1, TEST_LEN - i, (void *)tmp_buf);
ret = xor_check(TEST_SOURCES + 1, TEST_LEN - i, (void *) tmp_buf);
if (ret == 0) {
printf("fail end test corrupted buffer - "
"offset: %d, len: %d, ret: %d\n", i,
TEST_LEN - i, ret);
"offset: %d, len: %d, ret: %d\n",
i, TEST_LEN - i, ret);
fail++;
goto exit;
}
@ -291,5 +289,4 @@ int main(int argc, char *argv[])
aligned_free(buffs[i]);
return fail;
}

View File

@ -34,7 +34,8 @@
#define TEST_SOURCES 16
#define TEST_LEN 16 * 1024
int main(int argc, char *argv[])
int
main(int argc, char *argv[])
{
int i, j, should_pass, should_fail, ret = 0;
void *buffs[TEST_SOURCES + 1] = { NULL };

View File

@ -52,7 +52,8 @@
#define TEST_MEM ((TEST_SOURCES + 1) * (TEST_LEN))
int main(int argc, char *argv[])
int
main(int argc, char *argv[])
{
int i, ret, fail = 0;
void **buffs;

View File

@ -43,14 +43,16 @@
// Generates pseudo-random data
void rand_buffer(unsigned char *buf, long buffer_size)
void
rand_buffer(unsigned char *buf, long buffer_size)
{
long i;
for (i = 0; i < buffer_size; i++)
buf[i] = rand();
}
int main(int argc, char *argv[])
int
main(int argc, char *argv[])
{
int i, j, k, ret, fail = 0;
void *buffs[TEST_SOURCES + 1] = { NULL };
@ -137,8 +139,7 @@ int main(int argc, char *argv[])
fail |= xor_check_base(j, k, buffs);
if (fail > 0) {
printf("fail rand test %d sources, len=%d, ret=%d\n", j, k,
fail);
printf("fail rand test %d sources, len=%d, ret=%d\n", j, k, fail);
goto exit;
}
}