From 6b619906afddcaae57dbf6673662c2b60cb681ab Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Fri, 3 Jan 2014 10:36:21 +0100 Subject: [PATCH] Refactors again function calls. --- raid/int.c | 6 ++--- raid/internal.h | 24 +++++++++-------- raid/memory.h | 6 ++--- raid/raid.c | 13 ++++----- raid/raid.h | 72 ++++++++++++++++++++++++------------------------- raid/test.c | 3 ++- raid/x86.c | 6 ++--- 7 files changed, 67 insertions(+), 63 deletions(-) diff --git a/raid/int.c b/raid/int.c index 495cb145..e78c432a 100644 --- a/raid/int.c +++ b/raid/int.c @@ -383,7 +383,7 @@ void raid_par6_int8(int nd, size_t size, void **vv) * * Dx = A[ip[0],id[0]]^-1 * Pd */ -void raid_rec1_int8(int nr, const int *id, const int *ip, int nd, size_t size, void **vv) +void raid_rec1_int8(int nr, int *id, int *ip, int nd, size_t size, void **vv) { uint8_t **v = (uint8_t **)vv; uint8_t *p; @@ -436,7 +436,7 @@ void raid_rec1_int8(int nr, const int *id, const int *ip, int nd, size_t size, v * * we solve inverting the coefficients matrix. */ -void raid_rec2_int8(int nr, const int *id, const int *ip, int nd, size_t size, void **vv) +void raid_rec2_int8(int nr, int *id, int *ip, int nd, size_t size, void **vv) { uint8_t **v = (uint8_t **)vv; uint8_t *p; @@ -504,7 +504,7 @@ void raid_rec2_int8(int nr, const int *id, const int *ip, int nd, size_t size, v * PD[0] = Pd, PD[1] = Qd, PD[2] = Rd, ... * D[0] = Dx, D[1] = Dy, D[2] = Dz, ... */ -void raid_recX_int8(int nr, const int *id, const int *ip, int nd, size_t size, void **vv) +void raid_recX_int8(int nr, int *id, int *ip, int nd, size_t size, void **vv) { uint8_t **v = (uint8_t **)vv; uint8_t *p[RAID_PARITY_MAX]; diff --git a/raid/internal.h b/raid/internal.h index 8084d0e4..8d8221fd 100644 --- a/raid/internal.h +++ b/raid/internal.h @@ -34,9 +34,9 @@ int raid_selftest(void); void raid_par_ref(int nd, int np, size_t size, void **vv); void raid_invert(uint8_t *M, uint8_t *V, int n); -void raid_delta_gen(int nr, const int *id, const int *ip, int nd, size_t size, void **v); -void raid_rec1_par1(const int *id, int nd, size_t size, void **v); -void raid_rec2_par2(const int *id, const int *ip, int nd, size_t size, void **vv); +void raid_delta_gen(int nr, int *id, int *ip, int nd, size_t size, void **v); +void raid_rec1_par1(int *id, int nd, size_t size, void **v); +void raid_rec2_par2(int *id, int *ip, int nd, size_t size, void **vv); void raid_par1_int32(int nd, size_t size, void **vv); void raid_par1_int64(int nd, size_t size, void **vv); void raid_par1_sse2(int nd, size_t size, void **vv); @@ -60,12 +60,12 @@ void raid_par5_ssse3ext(int nd, size_t size, void **vv); void raid_par6_int8(int nd, size_t size, void **vv); void raid_par6_ssse3(int nd, size_t size, void **vv); void raid_par6_ssse3ext(int nd, size_t size, void **vv); -void raid_rec1_int8(int nr, const int *id, const int *ip, int nd, size_t size, void **vv); -void raid_rec2_int8(int nr, const int *id, const int *ip, int nd, size_t size, void **vv); -void raid_recX_int8(int nr, const int *id, const int *ip, int nd, size_t size, void **vv); -void raid_rec1_ssse3(int nr, const int *id, const int *ip, int nd, size_t size, void **vv); -void raid_rec2_ssse3(int nr, const int *id, const int *ip, int nd, size_t size, void **vv); -void raid_recX_ssse3(int nr, const int *id, const int *ip, int nd, size_t size, void **vv); +void raid_rec1_int8(int nr, int *id, int *ip, int nd, size_t size, void **vv); +void raid_rec2_int8(int nr, int *id, int *ip, int nd, size_t size, void **vv); +void raid_recX_int8(int nr, int *id, int *ip, int nd, size_t size, void **vv); +void raid_rec1_ssse3(int nr, int *id, int *ip, int nd, size_t size, void **vv); +void raid_rec2_ssse3(int nr, int *id, int *ip, int nd, size_t size, void **vv); +void raid_recX_ssse3(int nr, int *id, int *ip, int nd, size_t size, void **vv); /* * Internal naming. @@ -86,10 +86,12 @@ const char *raid_recX_tag(void); /* * Internal forwarders. */ -extern void (*raid_par_ptr[RAID_PARITY_MAX])(int nd, size_t size, void **vv); extern void (*raid_par3_ptr)(int nd, size_t size, void **vv); extern void (*raid_parz_ptr)(int nd, size_t size, void **vv); -extern void (*raid_rec_ptr[RAID_PARITY_MAX])(int nr, const int *id, const int *ip, int nd, size_t size, void **vv); +extern void (*raid_par_ptr[RAID_PARITY_MAX])( + int nd, size_t size, void **vv); +extern void (*raid_rec_ptr[RAID_PARITY_MAX])( + int nr, int *id, int *ip, int nd, size_t size, void **vv); /* * Tables. diff --git a/raid/memory.h b/raid/memory.h index bea3cc33..a92512c1 100644 --- a/raid/memory.h +++ b/raid/memory.h @@ -59,9 +59,9 @@ void *raid_malloc_align(size_t size, void **freeptr); /** * Aligned vector allocation. - * Returns a vector of ::n pointers, each one pointing to a block of - * the specified ::size. - * The first ::nd elements are reversed in order. + * Returns a vector of @n pointers, each one pointing to a block of + * the specified @size. + * The first @nd elements are reversed in order. */ void **raid_malloc_vector(int nd, int n, size_t size, void **freeptr); diff --git a/raid/raid.c b/raid/raid.c index 7b25abd0..617a732e 100644 --- a/raid/raid.c +++ b/raid/raid.c @@ -269,7 +269,7 @@ void raid_invert(uint8_t *M, uint8_t *V, int n) * Note that all the other parities not in the ip[] vector * are destroyed. */ -void raid_delta_gen(int nr, const int *id, const int *ip, int nd, size_t size, void **v) +void raid_delta_gen(int nr, int *id, int *ip, int nd, size_t size, void **v) { void *p[RAID_PARITY_MAX]; void *pa[RAID_PARITY_MAX]; @@ -312,7 +312,7 @@ void raid_delta_gen(int nr, const int *id, const int *ip, int nd, size_t size, v * * Dx = Pd */ -void raid_rec1_par1(const int *id, int nd, size_t size, void **v) +void raid_rec1_par1(int *id, int nd, size_t size, void **v) { void *p; void *pa; @@ -359,7 +359,7 @@ void raid_rec1_par1(const int *id, int nd, size_t size, void **v) * * That are always satisfied for any 0<=id[0] nd); BUG_ON(nrd + nrp > np); @@ -431,7 +432,7 @@ void raid_rec(int nrd, const int *id, int nrp, int *ip, int nd, int np, size_t s raid_par(nd, ip[nrp - 1] + 1, size, v); } -void raid_rec_dataonly(int nr, const int *id, const int *ip, int nd, size_t size, void **v) +void raid_rec_dataonly(int nr, int *id, int *ip, int nd, size_t size, void **v) { BUG_ON(nr > nd); BUG_ON(size % 64 != 0); diff --git a/raid/raid.h b/raid/raid.h index 5c834750..7d143474 100644 --- a/raid/raid.h +++ b/raid/raid.h @@ -29,18 +29,18 @@ * RAID mode supporting up to 3 parities, * * It has a fast triple parity implementation even without SSSE3, but it - * cannot go beyond it. + * cannot go beyond triple parity. * This is mostly intended for low end CPUs like ARM and AMD Athlon. */ #define RAID_MODE_VANDERMONDE 1 /** - * Max level of parity supported in the default mode RAID_MODE_CAUCHY. + * Max level of parity disks supported. */ #define RAID_PARITY_MAX 6 /** - * Maximum number of data disks. + * Maximum number of data disks supported. */ #define RAID_DATA_MAX 251 @@ -84,67 +84,67 @@ void raid_waste(void *zero); /** * Computes the parity. * - * \param nd Number of data disks. - * \param np Number of parities to compute. - * \param size Size of the blocks pointed by ::v. It must be a multipler of 64. - * \param v Vector of pointers to the blocks for disks and parities. - * It has (::nd + ::np) elements. The first elements are the blocks for + * @nd Number of data blocks. + * @np Number of parities blocks to compute. + * @size Size of the blocks pointed by @v. It must be a multipler of 64. + * @v Vector of pointers to the blocks of data and parity. + * It has (@nd + @np) elements. The starting elements are the blocks for * data, following with the parity blocks. - * Each blocks has ::size bytes. + * Each blocks has @size bytes. */ void raid_par(int nd, int np, size_t size, void **v); /** - * Recovers failures of data and parity blocks. + * Recovers failures in data and parity blocks. * - * All the data and parity blocks marked as bad in the ::id and ::ip vector + * All the data and parity blocks marked as bad in the @id and @ip vector * are recovered and recomputed. * * The parities blocks to use for recovering are automatically selected from - * the ones NOT present in the ::ip vector. + * the ones NOT present in the @ip vector. * - * Ensure to have ::nrd + ::nrp <= ::np, otherwise recovering is not possible. + * Ensure to have @nrd + @nrp <= @np, otherwise recovering is not possible. * - * \param nrd Number of failed data disks to recover. - * \param id[] Vector of ::nrd indexes of the data disks to recover. + * @nrd Number of failed data blocks to recover. + * @id[] Vector of @nrd indexes of the data blocks to recover. * The indexes start from 0. They must be in order. - * \param nrp Number of failed parity disks to recover. - * \param ip[] Vector of ::nrp indexes of the parity disks to recover. + * @nrp Number of failed parity blocks to recover. + * @ip[] Vector of @nrp indexes of the parity blocks to recover. * The indexes start from 0. They must be in order. * All the parities not specified here are assumed correct, and they are * not recomputed. - * \param nd Number of data disks. - * \param np Number of parity disks. - * \param size Size of the blocks pointed by ::v. It must be a multipler of 64. - * \param v Vector of pointers to the blocks for disks and parities. - * It has (::nd + ::np) elements. The first elements are the blocks + * @nd Number of data blocks. + * @np Number of parity blocks. + * @size Size of the blocks pointed by @v. It must be a multipler of 64. + * @v Vector of pointers to the blocks of data and parity. + * It has (@nd + @np) elements. The starting elements are the blocks * for data, following with the parity blocks. - * Each blocks has ::size bytes. + * Each blocks has @size bytes. */ -void raid_rec(int nrd, const int *id, int nrp, int *ip, int nd, int np, size_t size, void **v); +void raid_rec(int nrd, int *id, int nrp, int *ip, int nd, int np, size_t size, void **v); /** * Recovers failures of data blocks using the specified parities. * - * The data blocks marked as bad in the ::id vector are recovered. + * The data blocks marked as bad in the @id vector are recovered. * * If you have provided an additional buffer with raid_waste(), the * parity blocks are not modified. Without this buffer, the content of - * parities blocks not specified in the ::ip vector will be destroyed. + * parities blocks not specified in the @ip vector will be destroyed. * - * \param nr Number of failed data disks to recover. - * \param id[] Vector of ::nr indexes of the data disks to recover. + * @nr Number of failed data blocks to recover. + * @id[] Vector of @nr indexes of the data blocksto recover. * The indexes start from 0. They must be in order. - * \param ip[] Vector of ::nr indexes of the parity disks to use for recovering. + * @ip[] Vector of @nr indexes of the parity blocks to use for recovering. * The indexes start from 0. They must be in order. - * \param nd Number of data disks. - * \param size Size of the blocks pointed by ::v. It must be a multipler of 64. - * \param v Vector of pointers to the blocks for disks and parities. - * It has (::nd + ::ip[::nr - 1] + 1) elements. The first elements are the + * @nd Number of data blocks. + * @size Size of the blocks pointed by @v. It must be a multipler of 64. + * @v Vector of pointers to the blocks of data and parity. + * It has (@nd + @ip[@nr - 1] + 1) elements. The starting elements are the * blocks for data, following with the parity blocks. - * Each blocks has ::size bytes. + * Each blocks has @size bytes. */ -void raid_rec_dataonly(int nr, const int *id, const int *ip, int nd, size_t size, void **v); +void raid_rec_dataonly(int nr, int *id, int *ip, int nd, size_t size, void **v); /** * Sorts a small vector of integers. @@ -152,7 +152,7 @@ void raid_rec_dataonly(int nr, const int *id, const int *ip, int nd, size_t size * If you have block indexes not in order, you can use this function to sort * them before callign raid_rec(). * - * \param n Number of integers. No more than RAID_PARITY_MAX. + * @n Number of integers. No more than RAID_PARITY_MAX. * \paran v Vector of integers. */ void raid_sort(int n, int *v); diff --git a/raid/test.c b/raid/test.c index 6a3217cb..90eee29d 100644 --- a/raid/test.c +++ b/raid/test.c @@ -119,7 +119,8 @@ int raid_test_rec(int mode, int nd, size_t size) int i; int j; int nr; - void (*f[RAID_PARITY_MAX][4])(int nr, const int *id, const int *ip, int nd, size_t size, void **vbuf); + void (*f[RAID_PARITY_MAX][4])( + int nr, int *id, int *ip, int nd, size_t size, void **vbuf); int nf[RAID_PARITY_MAX]; int np; diff --git a/raid/x86.c b/raid/x86.c index 43a9dc7a..2b692950 100644 --- a/raid/x86.c +++ b/raid/x86.c @@ -1322,7 +1322,7 @@ void raid_par6_ssse3ext(int nd, size_t size, void **vv) /* * RAID recovering for one disk SSSE3 implementation */ -void raid_rec1_ssse3(int nr, const int *id, const int *ip, int nd, size_t size, void **vv) +void raid_rec1_ssse3(int nr, int *id, int *ip, int nd, size_t size, void **vv) { uint8_t **v = (uint8_t **)vv; uint8_t *p; @@ -1381,7 +1381,7 @@ void raid_rec1_ssse3(int nr, const int *id, const int *ip, int nd, size_t size, /* * RAID recovering for two disks SSSE3 implementation */ -void raid_rec2_ssse3(int nr, const int *id, const int *ip, int nd, size_t size, void **vv) +void raid_rec2_ssse3(int nr, int *id, int *ip, int nd, size_t size, void **vv) { uint8_t **v = (uint8_t **)vv; const int N = 2; @@ -1487,7 +1487,7 @@ void raid_rec2_ssse3(int nr, const int *id, const int *ip, int nd, size_t size, /* * RAID recovering SSSE3 implementation */ -void raid_recX_ssse3(int nr, const int *id, const int *ip, int nd, size_t size, void **vv) +void raid_recX_ssse3(int nr, int *id, int *ip, int nd, size_t size, void **vv) { uint8_t **v = (uint8_t **)vv; int N = nr;