Commit c9f420fdcd13f94105ea82d37ffd910e1248a695

Authored by Jim Plank
1 parent 16838859
Exists in master and in 1 other branch v2

Minor typos and stuff. More later.

Examples/reed_sol_01.c
... ... @@ -37,12 +37,9 @@
37 37 * POSSIBILITY OF SUCH DAMAGE.
38 38 */
39 39  
40   -
41 40  
42   -/*
43   - revised by S. Simmerman
44   - 2/25/08
45   -*/
  41 +/* Part of this code was revised by Scott Simmerman 2/25/08 */
  42 +
46 43 #include <stdio.h>
47 44 #include <stdlib.h>
48 45 #include <string.h>
... ... @@ -56,8 +53,8 @@ usage(char *s)
56 53 fprintf(stderr, "usage: reed_sol_01 k m w - Does a simple Reed-Solomon coding example in GF(2^w).\n");
57 54 fprintf(stderr, " \n");
58 55 fprintf(stderr, " w must be 8, 16 or 32. k+m must be <= 2^w. It sets up a classic\n");
59   - fprintf(stderr, " Vandermonde-based distribution matrix and encodes k devices of\n");
60   - fprintf(stderr, " %d bytes each with it. Then it decodes.\n", sizeof(long));
  56 + fprintf(stderr, " Vandermonde-based generator matrix and encodes k devices of\n");
  57 + fprintf(stderr, " %ld bytes each with it. Then it decodes.\n", sizeof(long));
61 58 fprintf(stderr, " \n");
62 59 fprintf(stderr, "This demonstrates: jerasure_matrix_encode()\n");
63 60 fprintf(stderr, " jerasure_matrix_decode()\n");
... ... @@ -111,6 +108,7 @@ int main(int argc, char **argv)
111 108 int k, w, i, j, m;
112 109 int *matrix;
113 110 char **data, **coding;
  111 + unsigned char uc;
114 112 int *erasures, *erased;
115 113 int *decoding_matrix, *dm_ids;
116 114  
... ... @@ -130,8 +128,10 @@ int main(int argc, char **argv)
130 128 data = talloc(char *, k);
131 129 for (i = 0; i < k; i++) {
132 130 data[i] = talloc(char, sizeof(long));
133   - l = lrand48();
134   - memcpy(data[i], &l, sizeof(long));
  131 + for (j = 0; j < sizeof(long); j++) {
  132 + uc = lrand48()%256;
  133 + data[i][j] = (char) uc;
  134 + }
135 135 }
136 136  
137 137 coding = talloc(char *, m);
... ...
Examples/reed_sol_03.c
... ... @@ -57,7 +57,7 @@ usage(char *s)
57 57 fprintf(stderr, " \n");
58 58 fprintf(stderr, " w must be 8, 16 or 32. k+2 must be <= 2^w. It sets up a classic\n");
59 59 fprintf(stderr, " RAID-6 coding matrix based on Anvin's optimization and encodes\n");
60   - fprintf(stderr, " %d-byte devices with it. Then it decodes.\n", sizeof(long));
  60 + fprintf(stderr, " %ld-byte devices with it. Then it decodes.\n", sizeof(long));
61 61 fprintf(stderr, " \n");
62 62 fprintf(stderr, "This demonstrates: reed_sol_r6_encode()\n");
63 63 fprintf(stderr, " reed_sol_r6_coding_matrix()\n");
... ... @@ -109,6 +109,7 @@ static void print_data_and_coding(int k, int m, int w, int size,
109 109 int main(int argc, char **argv)
110 110 {
111 111 long l;
  112 + unsigned char uc;
112 113 int k, w, i, j, m;
113 114 int *matrix;
114 115 char **data, **coding;
... ... @@ -123,7 +124,7 @@ int main(int argc, char **argv)
123 124  
124 125 matrix = reed_sol_r6_coding_matrix(k, w);
125 126  
126   - printf("Last 2 rows of the Distribution Matrix:\n\n");
  127 + printf("Last 2 rows of the Generator Matrix:\n\n");
127 128 jerasure_print_matrix(matrix, m, k, w);
128 129 printf("\n");
129 130  
... ... @@ -131,8 +132,10 @@ int main(int argc, char **argv)
131 132 data = talloc(char *, k);
132 133 for (i = 0; i < k; i++) {
133 134 data[i] = talloc(char, sizeof(long));
134   - l = lrand48();
135   - memcpy(data[i], &l, sizeof(long));
  135 + for (j = 0; j < sizeof(long); j++) {
  136 + uc = lrand48()%256;
  137 + data[i][j] = (char) uc;
  138 + }
136 139 }
137 140  
138 141 coding = talloc(char *, m);
... ...
Examples/reed_sol_hard_time_gf.c
... ... @@ -234,7 +234,7 @@ timer_split (const double *t)
234 234  
235 235 usage(char *s)
236 236 {
237   - fprintf(stderr, "usage: reed_sol_hard_test_gf k m w [additional GF args]- Test and time Reed-Solomon in a particular GF(2^w).\n");
  237 + fprintf(stderr, "usage: reed_sol_hard_test_gf k m w iterations bufsize [additional GF args]- Test and time Reed-Solomon in a particular GF(2^w).\n");
238 238 fprintf(stderr, " \n");
239 239 fprintf(stderr, " w must be 8, 16 or 32. k+m must be <= 2^w.\n");
240 240 fprintf(stderr, " See the README for information on the additional GF args.\n");
... ...
Examples/reed_sol_time_gf.c
... ... @@ -81,7 +81,7 @@ timer_split (const double *t)
81 81  
82 82 usage(char *s)
83 83 {
84   - fprintf(stderr, "usage: reed_sol_test_gf k m w [additional GF args]- Test and time Reed-Solomon in a particular GF(2^w).\n");
  84 + fprintf(stderr, "usage: reed_sol_time_gf k m w iterations bufsize [additional GF args]- Test and time Reed-Solomon in a particular GF(2^w).\n");
85 85 fprintf(stderr, " \n");
86 86 fprintf(stderr, " w must be 8, 16 or 32. k+m must be <= 2^w.\n");
87 87 fprintf(stderr, " See the README for information on the additional GF args.\n");
... ...