ECP-VELOC Components
User documentation for all components
redset_reedsolomon_common.h
Go to the documentation of this file.
1 #ifndef REDSET_REEDSOLOMON_COMMON_H
2 #define REDSET_REEDSOLOMON_COMMON_H
3 
4 /* given a pointer to a reed-solomon state structure,
5  * number of ranks, requested encoding checksums, and number of bits
6  * to determine the number of Galois Field elements, allocate structures
7  * that define the Galois Field */
9  redset_reedsolomon* state,
10  int ranks, /* number of ranks (data items) */
11  int encoding, /* number of checksum encodings */
12  int bits /* define bits for Galois Field GF(2^bits) */
13 );
14 
15 /* free memory allocated and attached to state
16  * from an earlier call to redset_rs_gf_alloc */
18  redset_reedsolomon* state
19 );
20 
21 /* Given our (n+k) x n encoding matrix in mat, pick M different rows
22  * with M=missing from the last k checksum rows that we can use to
23  * solve for the given unknown index values which will be in the range [0,n+k).
24  * Any M distinct rows suffice, so we try pick rows having a minimum
25  * number of unknowns to make for a faster solve later.
26  * We extract an (MxM) matrix holding the subset of coefficients from the
27  * encoding matrix for the selected rows. Inverting the MxM matrix
28  * specifies the operations needed to compute the given unknowns. */
30  redset_reedsolomon* state,
31  unsigned int* mat, /* encoding matrix */
32  int n, /* number of ranks */
33  int k, /* number of checksum values */
34  int missing, /* number of missing values */
35  int* unknowns, /* index of each missing value [0,n+k) */
36  unsigned int** coeffs, /* output matrix of size (missing x missing) */
37  int** selected /* row index selected from encoding matrix for each unknown */
38 );
39 
40 /* solve for x in Ax = b, where A (given in m) is a matrix of size (missing x missing)
41  * using Gaussian elimination to convert A into an identity matrix,
42  * here x and b are really matrices of size [missing, count] for count number of
43  * individual [missing, 1] vectors */
45  redset_reedsolomon* state,
46  unsigned int* m, /* coefficient matrix to be reduced to an identity matrix */
47  int missing, /* number of rows and columns in m */
48  int count, /* length of buf arrays */
49  unsigned char** bufs /* at list of count values for each of the missing unknowns */
50 );
51 
52 /* return encoding index [0, ranks+encoding) for given rank and chunk_id */
54  int ranks,
55  int encoding,
56  int rank,
57  int chunk_id
58 );
59 
60 /* return chunk id into logical file for given rank and chunk_id */
62  int ranks,
63  int encoding,
64  int rank,
65  int chunk_id
66 );
67 
68 /* multiply elements in data by coeff and add to buf */
70  redset_reedsolomon* state,
71  int count, /* length of buffer and data arrays */
72  unsigned char* buf, /* accumulation buffer */
73  unsigned int coeff, /* constant to scale elements in data by */
74  unsigned char* data /* items to be multiplied and added to buf */
75 );
76 
78  int ranks,
79  redset_reedsolomon* state,
80  int chunk_id,
81  int received_rank,
82  int missing,
83  int* rows,
84  int count,
85  unsigned char* recv_buf,
86  unsigned char** data_bufs
87 );
88 
89 #endif
redset_rs_gaussian_solve_identify_rows
void redset_rs_gaussian_solve_identify_rows(redset_reedsolomon *state, unsigned int *mat, int n, int k, int missing, int *unknowns, unsigned int **coeffs, int **selected)
redset_rs_gf_alloc
int redset_rs_gf_alloc(redset_reedsolomon *state, int ranks, int encoding, int bits)
redset_rs_gaussian_solve
void redset_rs_gaussian_solve(redset_reedsolomon *state, unsigned int *m, int missing, int count, unsigned char **bufs)
redset_rs_reduce_buffer_multadd
void redset_rs_reduce_buffer_multadd(redset_reedsolomon *state, int count, unsigned char *buf, unsigned int coeff, unsigned char *data)
redset_rs_gf_delete
void redset_rs_gf_delete(redset_reedsolomon *state)
redset_rs_get_data_id
int redset_rs_get_data_id(int ranks, int encoding, int rank, int chunk_id)
redset_rs_get_encoding_id
int redset_rs_get_encoding_id(int ranks, int encoding, int rank, int chunk_id)
redset_rs_reduce_decode
void redset_rs_reduce_decode(int ranks, redset_reedsolomon *state, int chunk_id, int received_rank, int missing, int *rows, int count, unsigned char *recv_buf, unsigned char **data_bufs)