mirror of
https://github.com/intel/isa-l.git
synced 2024-12-12 09:23:50 +01:00
raid: reformat using new code style
Signed-off-by: Marcel Cornu <marcel.d.cornu@intel.com>
This commit is contained in:
parent
cf6105271a
commit
ae951677ab
@ -37,7 +37,6 @@ DEFINE_INTERFACE_DISPATCHER(xor_gen)
|
|||||||
return PROVIDER_INFO(xor_gen_neon);
|
return PROVIDER_INFO(xor_gen_neon);
|
||||||
#endif
|
#endif
|
||||||
return PROVIDER_BASIC(xor_gen);
|
return PROVIDER_BASIC(xor_gen);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_INTERFACE_DISPATCHER(xor_check)
|
DEFINE_INTERFACE_DISPATCHER(xor_check)
|
||||||
@ -49,7 +48,6 @@ DEFINE_INTERFACE_DISPATCHER(xor_check)
|
|||||||
return PROVIDER_INFO(xor_check_neon);
|
return PROVIDER_INFO(xor_check_neon);
|
||||||
#endif
|
#endif
|
||||||
return PROVIDER_BASIC(xor_check);
|
return PROVIDER_BASIC(xor_check);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_INTERFACE_DISPATCHER(pq_gen)
|
DEFINE_INTERFACE_DISPATCHER(pq_gen)
|
||||||
@ -61,7 +59,6 @@ DEFINE_INTERFACE_DISPATCHER(pq_gen)
|
|||||||
return PROVIDER_INFO(pq_gen_neon);
|
return PROVIDER_INFO(pq_gen_neon);
|
||||||
#endif
|
#endif
|
||||||
return PROVIDER_BASIC(pq_gen);
|
return PROVIDER_BASIC(pq_gen);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_INTERFACE_DISPATCHER(pq_check)
|
DEFINE_INTERFACE_DISPATCHER(pq_check)
|
||||||
@ -73,5 +70,4 @@ DEFINE_INTERFACE_DISPATCHER(pq_check)
|
|||||||
return PROVIDER_INFO(pq_check_neon);
|
return PROVIDER_INFO(pq_check_neon);
|
||||||
#endif
|
#endif
|
||||||
return PROVIDER_BASIC(pq_check);
|
return PROVIDER_BASIC(pq_check);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,8 @@
|
|||||||
#define TEST_SEED 0x1234
|
#define TEST_SEED 0x1234
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int ref_multi_pq(int vects, int len, void **array)
|
int
|
||||||
|
ref_multi_pq(int vects, int len, void **array)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
unsigned char p, q, s;
|
unsigned char p, q, s;
|
||||||
@ -63,14 +64,16 @@ int ref_multi_pq(int vects, int len, void **array)
|
|||||||
|
|
||||||
// Generates pseudo-random data
|
// Generates pseudo-random data
|
||||||
|
|
||||||
void rand_buffer(unsigned char *buf, long buffer_size)
|
void
|
||||||
|
rand_buffer(unsigned char *buf, long buffer_size)
|
||||||
{
|
{
|
||||||
long i;
|
long i;
|
||||||
for (i = 0; i < buffer_size; i++)
|
for (i = 0; i < buffer_size; i++)
|
||||||
buf[i] = rand();
|
buf[i] = rand();
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i, j, k, ret, fail = 0;
|
int i, j, k, ret, fail = 0;
|
||||||
void *buffs[TEST_SOURCES + 2] = { NULL };
|
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);
|
ret = pq_check(TEST_SOURCES + 2, TEST_LEN, buffs);
|
||||||
if (ret != 0) { // should pass
|
if (ret != 0) { // should pass
|
||||||
fail++;
|
fail++;
|
||||||
printf
|
printf("\nFail rand test with un-corrupted buffer j=%d, i=%d\n", j,
|
||||||
("\nFail rand test with un-corrupted buffer j=%d, i=%d\n",
|
i);
|
||||||
j, i);
|
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
c = ((char *) buffs[j])[i];
|
c = ((char *) buffs[j])[i];
|
||||||
@ -200,8 +202,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
ret = pq_check(j, TEST_LEN, buffs);
|
ret = pq_check(j, TEST_LEN, buffs);
|
||||||
if (ret == 0) { // Should fail
|
if (ret == 0) { // Should fail
|
||||||
printf
|
printf("\nfail rand fixed len test corrupted buffer %d "
|
||||||
("\nfail rand fixed len test corrupted buffer %d sources\n",
|
"sources\n",
|
||||||
j);
|
j);
|
||||||
fail++;
|
fail++;
|
||||||
goto exit;
|
goto exit;
|
||||||
@ -233,8 +235,8 @@ int main(int argc, char *argv[])
|
|||||||
// See if it still passes
|
// See if it still passes
|
||||||
ret = pq_check(j, k, buffs);
|
ret = pq_check(j, k, buffs);
|
||||||
if (ret != 0) { // Should pass
|
if (ret != 0) { // Should pass
|
||||||
printf
|
printf("\nfail rand var src, len test %d sources, "
|
||||||
("\nfail rand var src, len test %d sources, len=%d\n",
|
"len=%d\n",
|
||||||
j, k);
|
j, k);
|
||||||
fail++;
|
fail++;
|
||||||
goto exit;
|
goto exit;
|
||||||
@ -246,10 +248,10 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
ret = pq_check(j, k, buffs);
|
ret = pq_check(j, k, buffs);
|
||||||
if (ret == 0) { // Should fail
|
if (ret == 0) { // Should fail
|
||||||
printf
|
printf("\nfail rand var src, len test corrupted "
|
||||||
("\nfail rand var src, len test corrupted buffer "
|
"buffer "
|
||||||
"%d sources, len=%d, ret=%d\n", j, k,
|
"%d sources, len=%d, ret=%d\n",
|
||||||
ret);
|
j, k, ret);
|
||||||
fail++;
|
fail++;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
@ -286,12 +288,11 @@ int main(int argc, char *argv[])
|
|||||||
c = tmp_buf[serr][lerr];
|
c = tmp_buf[serr][lerr];
|
||||||
tmp_buf[serr][lerr] = c ^ 1;
|
tmp_buf[serr][lerr] = c ^ 1;
|
||||||
|
|
||||||
ret =
|
ret = pq_check(TEST_SOURCES + 2, TEST_LEN - i, (void *) tmp_buf);
|
||||||
pq_check(TEST_SOURCES + 2, TEST_LEN - i, (void *)tmp_buf);
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
printf("fail end test corrupted buffer - "
|
printf("fail end test corrupted buffer - "
|
||||||
"offset: %d, len: %d, ret: %d\n", i,
|
"offset: %d, len: %d, ret: %d\n",
|
||||||
TEST_LEN - i, ret);
|
i, TEST_LEN - i, ret);
|
||||||
fail++;
|
fail++;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
@ -313,5 +314,4 @@ int main(int argc, char *argv[])
|
|||||||
for (i = 0; i < TEST_SOURCES + 2; i++)
|
for (i = 0; i < TEST_SOURCES + 2; i++)
|
||||||
aligned_free(buffs[i]);
|
aligned_free(buffs[i]);
|
||||||
return fail;
|
return fail;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,8 @@
|
|||||||
|
|
||||||
#define TEST_MEM ((TEST_SOURCES + 2) * (TEST_LEN))
|
#define TEST_MEM ((TEST_SOURCES + 2) * (TEST_LEN))
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
void *buffs[TEST_SOURCES + 2];
|
void *buffs[TEST_SOURCES + 2];
|
||||||
|
@ -44,14 +44,16 @@
|
|||||||
|
|
||||||
// Generates pseudo-random data
|
// Generates pseudo-random data
|
||||||
|
|
||||||
void rand_buffer(unsigned char *buf, long buffer_size)
|
void
|
||||||
|
rand_buffer(unsigned char *buf, long buffer_size)
|
||||||
{
|
{
|
||||||
long i;
|
long i;
|
||||||
for (i = 0; i < buffer_size; i++)
|
for (i = 0; i < buffer_size; i++)
|
||||||
buf[i] = rand();
|
buf[i] = rand();
|
||||||
}
|
}
|
||||||
|
|
||||||
int dump(unsigned char *buf, int len)
|
int
|
||||||
|
dump(unsigned char *buf, int len)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < len;) {
|
for (i = 0; i < len;) {
|
||||||
@ -63,7 +65,8 @@ int dump(unsigned char *buf, int len)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i, j, k, ret = 0, fail = 0;
|
int i, j, k, ret = 0, fail = 0;
|
||||||
void *buffs[TEST_SOURCES + 2] = { NULL }; // Pointers to src and dest
|
void *buffs[TEST_SOURCES + 2] = { NULL }; // Pointers to src and dest
|
||||||
@ -164,7 +167,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (fail > 0) {
|
if (fail > 0) {
|
||||||
printf("fail rand test %d sources, len=%d, fail="
|
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;
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -187,7 +191,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (fail > 0) {
|
if (fail > 0) {
|
||||||
printf("fail end test - offset: %d, len: %d, fail: %d, "
|
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;
|
goto exit;
|
||||||
}
|
}
|
||||||
#ifdef TEST_VERBOSE
|
#ifdef TEST_VERBOSE
|
||||||
|
@ -40,7 +40,8 @@
|
|||||||
#define gf8poly 0x1d1d1d1dUL
|
#define gf8poly 0x1d1d1d1dUL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int pq_gen_base(int vects, int len, void **array)
|
int
|
||||||
|
pq_gen_base(int vects, int len, void **array)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
unsigned long p, q, s;
|
unsigned long p, q, s;
|
||||||
@ -66,7 +67,8 @@ int pq_gen_base(int vects, int len, void **array)
|
|||||||
return 0;
|
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;
|
int i, j;
|
||||||
unsigned char p, q, s;
|
unsigned char p, q, s;
|
||||||
@ -94,7 +96,8 @@ int pq_check_base(int vects, int len, void **array)
|
|||||||
return 0;
|
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;
|
int i, j;
|
||||||
unsigned char parity;
|
unsigned char parity;
|
||||||
@ -109,13 +112,13 @@ int xor_gen_base(int vects, int len, void **array)
|
|||||||
parity ^= src[j][i];
|
parity ^= src[j][i];
|
||||||
|
|
||||||
src[vects - 1][i] = parity; // last pointer is dest
|
src[vects - 1][i] = parity; // last pointer is dest
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
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;
|
int i, j, fail = 0;
|
||||||
|
|
||||||
|
@ -29,22 +29,26 @@
|
|||||||
|
|
||||||
#include "raid.h"
|
#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);
|
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);
|
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);
|
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);
|
return xor_check_base(vects, len, array);
|
||||||
}
|
}
|
||||||
|
@ -43,14 +43,16 @@
|
|||||||
|
|
||||||
// Generates pseudo-random data
|
// Generates pseudo-random data
|
||||||
|
|
||||||
void rand_buffer(unsigned char *buf, long buffer_size)
|
void
|
||||||
|
rand_buffer(unsigned char *buf, long buffer_size)
|
||||||
{
|
{
|
||||||
long i;
|
long i;
|
||||||
for (i = 0; i < buffer_size; i++)
|
for (i = 0; i < buffer_size; i++)
|
||||||
buf[i] = rand();
|
buf[i] = rand();
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i, j, k, ret, fail = 0;
|
int i, j, k, ret, fail = 0;
|
||||||
void *buffs[TEST_SOURCES + 1] = { NULL };
|
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);
|
ret = xor_check(TEST_SOURCES + 1, TEST_LEN, buffs);
|
||||||
if (ret != 0) { // should pass
|
if (ret != 0) { // should pass
|
||||||
fail++;
|
fail++;
|
||||||
printf
|
printf("\nFail rand test with un-corrupted buffer j=%d, i=%d\n", j,
|
||||||
("\nFail rand test with un-corrupted buffer j=%d, i=%d\n",
|
i);
|
||||||
j, i);
|
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
c = ((char *) buffs[j])[i];
|
c = ((char *) buffs[j])[i];
|
||||||
@ -181,9 +182,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
ret = xor_check(j, TEST_LEN, buffs);
|
ret = xor_check(j, TEST_LEN, buffs);
|
||||||
if (ret == 0) { // Should fail
|
if (ret == 0) { // Should fail
|
||||||
printf
|
printf("\nfail rand test corrupted buffer %d sources\n", j);
|
||||||
("\nfail rand test corrupted buffer %d sources\n",
|
|
||||||
j);
|
|
||||||
fail++;
|
fail++;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
@ -225,8 +224,8 @@ int main(int argc, char *argv[])
|
|||||||
ret = xor_check(j, k, buffs);
|
ret = xor_check(j, k, buffs);
|
||||||
if (ret == 0) { // Should fail
|
if (ret == 0) { // Should fail
|
||||||
printf("\nfail rand test corrupted buffer "
|
printf("\nfail rand test corrupted buffer "
|
||||||
"%d sources, len=%d, ret=%d\n", j, k,
|
"%d sources, len=%d, ret=%d\n",
|
||||||
ret);
|
j, k, ret);
|
||||||
fail++;
|
fail++;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
@ -263,12 +262,11 @@ int main(int argc, char *argv[])
|
|||||||
c = tmp_buf[serr][lerr];
|
c = tmp_buf[serr][lerr];
|
||||||
tmp_buf[serr][lerr] = c ^ 1;
|
tmp_buf[serr][lerr] = c ^ 1;
|
||||||
|
|
||||||
ret =
|
ret = xor_check(TEST_SOURCES + 1, TEST_LEN - i, (void *) tmp_buf);
|
||||||
xor_check(TEST_SOURCES + 1, TEST_LEN - i, (void *)tmp_buf);
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
printf("fail end test corrupted buffer - "
|
printf("fail end test corrupted buffer - "
|
||||||
"offset: %d, len: %d, ret: %d\n", i,
|
"offset: %d, len: %d, ret: %d\n",
|
||||||
TEST_LEN - i, ret);
|
i, TEST_LEN - i, ret);
|
||||||
fail++;
|
fail++;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
@ -291,5 +289,4 @@ int main(int argc, char *argv[])
|
|||||||
aligned_free(buffs[i]);
|
aligned_free(buffs[i]);
|
||||||
|
|
||||||
return fail;
|
return fail;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,8 @@
|
|||||||
#define TEST_SOURCES 16
|
#define TEST_SOURCES 16
|
||||||
#define TEST_LEN 16 * 1024
|
#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;
|
int i, j, should_pass, should_fail, ret = 0;
|
||||||
void *buffs[TEST_SOURCES + 1] = { NULL };
|
void *buffs[TEST_SOURCES + 1] = { NULL };
|
||||||
|
@ -52,7 +52,8 @@
|
|||||||
|
|
||||||
#define TEST_MEM ((TEST_SOURCES + 1) * (TEST_LEN))
|
#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;
|
int i, ret, fail = 0;
|
||||||
void **buffs;
|
void **buffs;
|
||||||
|
@ -43,14 +43,16 @@
|
|||||||
|
|
||||||
// Generates pseudo-random data
|
// Generates pseudo-random data
|
||||||
|
|
||||||
void rand_buffer(unsigned char *buf, long buffer_size)
|
void
|
||||||
|
rand_buffer(unsigned char *buf, long buffer_size)
|
||||||
{
|
{
|
||||||
long i;
|
long i;
|
||||||
for (i = 0; i < buffer_size; i++)
|
for (i = 0; i < buffer_size; i++)
|
||||||
buf[i] = rand();
|
buf[i] = rand();
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i, j, k, ret, fail = 0;
|
int i, j, k, ret, fail = 0;
|
||||||
void *buffs[TEST_SOURCES + 1] = { NULL };
|
void *buffs[TEST_SOURCES + 1] = { NULL };
|
||||||
@ -137,8 +139,7 @@ int main(int argc, char *argv[])
|
|||||||
fail |= xor_check_base(j, k, buffs);
|
fail |= xor_check_base(j, k, buffs);
|
||||||
|
|
||||||
if (fail > 0) {
|
if (fail > 0) {
|
||||||
printf("fail rand test %d sources, len=%d, ret=%d\n", j, k,
|
printf("fail rand test %d sources, len=%d, ret=%d\n", j, k, fail);
|
||||||
fail);
|
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user