Revision 2.0 is ready for prime time!

master
Jim Plank 2014-01-25 10:55:29 -05:00
parent 7a502868f1
commit be40b4e549
30 changed files with 253 additions and 192 deletions

View File

@ -37,6 +37,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank
*/
#include <stdio.h>
#include <stdint.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,10 +37,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
revised by S. Simmerman 2/25/08
Re-revised by JSP to use GF-Complete - 1/2014
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,10 +37,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
revised by S. Simmerman 2/25/08
Re-revised by JSP to use GF-Complete - 1/2014
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,10 +37,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
revised by S. Simmerman 2/25/08
Re-revised by JSP to use GF-Complete - 1/2014
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan.
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,6 +37,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan.
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank.
*/
/*
This program takes as input an inputfile, k, m, a coding

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,6 +37,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan.
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank.
*/
/*
@ -47,8 +53,8 @@ the original file and m of the files are encoded based on
the given coding technique. The format of the created files
is the file name with "_k#" or "_m#" and then the extension.
(For example, inputfile test.txt would yield file "test_k1.txt".)
*/
*/
#include <sys/time.h>
#include <sys/stat.h>
#include <string.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,7 +37,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan.
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank.
*/
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,6 +37,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan.
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank.
*/
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,7 +37,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan.
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank.
*/
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,7 +37,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan.
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,12 +37,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan.
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank.
*/
/*
revised by S. Simmerman
2/25/08
*/
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,11 +37,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
revised by S. Simmerman
2/25/08
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan.
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,12 +37,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan.
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank.
*/
/*
revised by S. Simmerman
2/25/08
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,7 +37,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan.
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,12 +37,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan.
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank.
*/
/*
revised by S. Simmerman
2/25/08
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,8 +37,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
/* Part of this code was revised by Scott Simmerman 2/25/08 */
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan.
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank.
*/
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,6 +37,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan.
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,12 +37,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan.
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank.
*/
/*
revised by S. Simmerman
2/25/08
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,6 +37,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan.
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank.
*/
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,7 +37,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan.
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,6 +37,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan.
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

7
README
View File

@ -7,13 +7,12 @@ External Documentation:
See technical report CS-08-627 for a description of the main interfaces (Version 1.2)
See http://web.eecs.utk.edu/~plank/plank/papers/CS-13-703.html for information
on GF-Complete and the tarball needed to install it.
Custom usgae of GF-Complete is explained in this file (see below).
See https://bitbucket.org/jimplank/gf-complete for GF-Complete.
NOTE: You must have GF-Complete installed in order to use Jerasure 2.0.
Custom usage of GF-Complete is explained in this file (see below).
There are two directories of source code:
The src directory contains the jerasure code.

View File

@ -1,21 +1,21 @@
This is revision 2.0 of Jerasure. This is pretty much Jerasure 1.2 without the
original Galois Field backend. Version 2.0 links directly to GF-Complete.
original Galois Field backend. Version 2.0 links directly to GF-Complete, which
is more flexible than the original, and *much* faster, because it leverages SIMD
instructions.
External Documentation:
See technical report CS-08-627 for a description of the main interfaces (Version 1.2)
See http://web.eecs.utk.edu/~plank/plank/papers/CS-13-703.html for information
on GF-Complete and the tarball needed to install it.
Custom usgae of GF-Complete is explained in this file (see below).
See https://bitbucket.org/jimplank/gf-complete for GF-Complete.
NOTE: You must have GF-Complete installed in order to use Jerasure 2.0.
There are two directories:
Custom usage of GF-Complete is explained in this file (see below).
There are two directories of source code:
The src directory contains the jerasure code.
The Examples directory contains the example programs.
The makefile assumes that Examples is a subdirectory of the home directory.
@ -33,7 +33,7 @@ Installing:
This will install the examples under PREFIX/bin, the library under PREFIX/lib
and the header files under PREFIX/include
See individual source file to determine what the examples do.
See individual source files to determine what the examples do.
Inclusion of GF-Complete:
@ -44,8 +44,8 @@ determine the default field to use, if one is not specified.
If you would like to explore a using a different Galois Field implementation,
you can dynamically set the backend GF for a given word-size (w).
The new galois.[ch] exports the following functions to be used by applications
for dynamically setting the backend GF:
The new galois.c and galois.h export the following functions to be used by applications
for dynamically setting the back-end GF:
1.) galois_change_technique
@ -53,21 +53,25 @@ for dynamically setting the backend GF:
void galois_change_technique(gf_t *gf, int w);
This is the recommended way for you to change techniques.
This function will take a pointer to a Galois field structure and set it as the
current backend for all operations in GF(2^w). Note that you must specify 'w'
here, since the internal GF structure is mostly opaque to Jerasure. Be sure to
change the technique with the correct structure and word-size.
There are a few ways to get a pointer to a gf_t structure: via GF-Complete or
using the helper functions provided by Jerasure: galois_init_field and
galois_init_composite_field.
There are a few ways to get a pointer to a gf_t structure: GF-Complete gives three
primitives for this -- create_gf_from_argv(), gf_init_easy() and gf_init_hard().
Please read the documentation on GF-Complete for how these work. By far, the
most powerful and easy is create_gf_from_argv(), which parses an argv-style
string. Otherwise, the most flexible is gf_init_hard().
GF-Complete exposes create_gf_from_argv, gf_init_easy and gf_init_hard. See
the GF-Complete documentation for more detail on how to use those functions.
You can definitely create more complicated fields with the GF-Complete
initialization functions, but the two helper functions provided by Jerasure
(galois_init_field and galois_init_composite_field) can be used to create most
of the supported Galois Fields.
In galois.c/galois.h, we have defined galois_init_field(), which is pretty much
identical to gf_init_hard(), except it performs memory allocation with malloc(),
and galois_init_composite_field(), which facilitates creating composite fields.
These are described below, but once again, we recommend using create_gf_from_argv()
or gf_init_hard() if you want to change your Galois field.
2.) galois_init_field
@ -149,10 +153,6 @@ For more information on how to change the backing fields for Jerasure, please re
2.) Examples/reed_sol_time_gf.c: Runs more thorough timing and validation tests
for a backing GF (uses create_gf_from_argv to get gf_t pointer)
3.) Examples/reed_sol_hard_time_gf.c: Runs more thorough timing and validation tests
for a backing GF (uses galois_init_field and galois_init_composite_field to get gf_t
pointer)
Performance:
There are two performance-based test scripts: time_all_gfs_argv_init.sh and
@ -174,3 +174,4 @@ the test run of
is recorded as this in PERF.txt:
_12_3_8_128_65536_-m_SPLIT_8_4_-r_SSE_- 2813.34

View File

@ -7,13 +7,12 @@ External Documentation:
See technical report CS-08-627 for a description of the main interfaces (Version 1.2)
See http://web.eecs.utk.edu/~plank/plank/papers/CS-13-703.html for information
on GF-Complete and the tarball needed to install it.
Custom usgae of GF-Complete is explained in this file (see below).
See https://bitbucket.org/jimplank/gf-complete for GF-Complete.
NOTE: You must have GF-Complete installed in order to use Jerasure 2.0.
Custom usage of GF-Complete is explained in this file (see below).
There are two directories of source code:
The src directory contains the jerasure code.

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,6 +37,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank
*/
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,6 +37,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank
*/
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,6 +37,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank
*/
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,6 +37,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank
*/
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,6 +37,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank
*/
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,5 +1,5 @@
/* *
* Copyright (c) 2013, James S. Plank and Kevin Greenan
* Copyright (c) 2014, James S. Plank and Kevin Greenan
* All rights reserved.
*
* Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure
@ -37,11 +37,18 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Jerasure's authors:
Revision 2.x - 2014: James S. Plank and Kevin M. Greenan
Revision 1.2 - 2008: James S. Plank, Scott Simmerman and Catherine D. Schuman.
Revision 1.0 - 2007: James S. Plank
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gf_complete.h>
#include "galois.h"
#include "jerasure.h"
#include "reed_sol.h"
@ -91,118 +98,52 @@ int *reed_sol_vandermonde_coding_matrix(int k, int m, int w)
return dist;
}
static int prim32 = -1;
#define rgw32_mask(v) ((v) & 0x80000000)
void reed_sol_galois_w32_region_multby_2(char *region, int nbytes)
{
int *l1;
int *ltop;
char *ctop;
if (prim32 == -1) prim32 = galois_single_multiply((1 << 31), 2, 32);
ctop = region + nbytes;
ltop = (int *) ctop;
l1 = (int *) region;
while (l1 < ltop) {
*l1 = ((*l1) << 1) ^ ((*l1 & 0x80000000) ? prim32 : 0);
l1++;
}
}
static int prim08 = -1;
static int mask08_1 = -1;
static int mask08_2 = -1;
static gf_t GF08;
void reed_sol_galois_w08_region_multby_2(char *region, int nbytes)
{
unsigned int *l1;
unsigned int *ltop;
char *ctop;
unsigned int tmp, tmp2;
if (prim08 == -1) {
tmp = galois_single_multiply((1 << 7), 2, 8);
prim08 = 0;
while (tmp != 0) {
prim08 |= tmp;
tmp = (tmp << 8);
}
tmp = (1 << 8) - 2;
mask08_1 = 0;
while (tmp != 0) {
mask08_1 |= tmp;
tmp = (tmp << 8);
}
tmp = (1 << 7);
mask08_2 = 0;
while (tmp != 0) {
mask08_2 |= tmp;
tmp = (tmp << 8);
prim08 = galois_single_multiply((1 << 7), 2, 8);
if (!gf_init_hard(&GF08, 8, GF_MULT_BYTWO_b, GF_REGION_DEFAULT, GF_DIVIDE_DEFAULT,
prim08, 0, 0, NULL, NULL)) {
fprintf(stderr, "Error: Can't initialize the GF for reed_sol_galois_w08_region_multby_2\n");
exit(1);
}
}
ctop = region + nbytes;
ltop = (unsigned int *) ctop;
l1 = (unsigned int *) region;
while (l1 < ltop) {
tmp = ((*l1) << 1) & mask08_1;
tmp2 = (*l1) & mask08_2;
tmp2 = ((tmp2 << 1) - (tmp2 >> 7));
*l1 = (tmp ^ (tmp2 & prim08));
l1++;
}
GF08.multiply_region.w32(&GF08, region, region, 2, nbytes, 0);
}
static int prim16 = -1;
static int mask16_1 = -1;
static int mask16_2 = -1;
static gf_t GF16;
void reed_sol_galois_w16_region_multby_2(char *region, int nbytes)
{
unsigned int *l1;
unsigned int *ltop;
char *ctop;
unsigned int tmp, tmp2;
if (prim16 == -1) {
tmp = galois_single_multiply((1 << 15), 2, 16);
prim16 = 0;
while (tmp != 0) {
prim16 |= tmp;
tmp = (tmp << 16);
}
tmp = (1 << 16) - 2;
mask16_1 = 0;
while (tmp != 0) {
mask16_1 |= tmp;
tmp = (tmp << 16);
}
tmp = (1 << 15);
mask16_2 = 0;
while (tmp != 0) {
mask16_2 |= tmp;
tmp = (tmp << 16);
prim16 = galois_single_multiply((1 << 15), 2, 16);
if (!gf_init_hard(&GF16, 16, GF_MULT_BYTWO_b, GF_REGION_DEFAULT, GF_DIVIDE_DEFAULT,
prim16, 0, 0, NULL, NULL)) {
fprintf(stderr, "Error: Can't initialize the GF for reed_sol_galois_w16_region_multby_2\n");
exit(1);
}
}
GF16.multiply_region.w32(&GF16, region, region, 2, nbytes, 0);
}
ctop = region + nbytes;
ltop = (unsigned int *) ctop;
l1 = (unsigned int *) region;
static int prim32 = -1;
static gf_t GF32;
while (l1 < ltop) {
tmp = ((*l1) << 1) & mask16_1;
tmp2 = (*l1) & mask16_2;
tmp2 = ((tmp2 << 1) - (tmp2 >> 15));
*l1 = (tmp ^ (tmp2 & prim16));
l1++;
void reed_sol_galois_w32_region_multby_2(char *region, int nbytes)
{
if (prim32 == -1) {
prim32 = galois_single_multiply((1 << 31), 2, 32);
if (!gf_init_hard(&GF32, 32, GF_MULT_BYTWO_b, GF_REGION_DEFAULT, GF_DIVIDE_DEFAULT,
prim32, 0, 0, NULL, NULL)) {
fprintf(stderr, "Error: Can't initialize the GF for reed_sol_galois_w32_region_multby_2\n");
exit(1);
}
}
GF32.multiply_region.w32(&GF32, region, region, 2, nbytes, 0);
}
int reed_sol_r6_encode(int k, int w, char **data_ptrs, char **coding_ptrs, int size)