backends now support verion checks
This commit is contained in:
@@ -63,6 +63,7 @@ struct ec_backend_args {
|
||||
#define FRAGSNEEDED fragments_needed
|
||||
#define RECONSTRUCT reconstruct
|
||||
#define ELEMENTSIZE element_size
|
||||
#define ISCOMPATIBLEWITH is_compatible_with
|
||||
|
||||
#define FN_NAME(s) str(s)
|
||||
#define str(s) #s
|
||||
@@ -88,6 +89,8 @@ struct ec_backend_op_stubs {
|
||||
char **data, char **parity, int *missing_idxs, int destination_idx,
|
||||
int blocksize);
|
||||
int (*ELEMENTSIZE)(void *desc);
|
||||
|
||||
bool (*ISCOMPATIBLEWITH) (uint32_t version);
|
||||
};
|
||||
|
||||
/* ==~=*=~==~=*=~==~=*=~= backend struct definitions =~=*=~==~=*=~==~=*==~== */
|
||||
@@ -110,6 +113,11 @@ struct ec_backend_common {
|
||||
* metadata_adder bytes are added to
|
||||
* the fragment size when allocating
|
||||
* data/parity fragment buffers */
|
||||
uint32_t ec_backend_version; /* The revision number of this back
|
||||
* end. Is used to determine whether
|
||||
* a specific instance of this backend
|
||||
* accepts fragments generated by
|
||||
* another version */
|
||||
};
|
||||
|
||||
/* EC backend definition */
|
||||
|
||||
@@ -33,9 +33,21 @@
|
||||
#include "erasurecode_backend.h"
|
||||
#include "erasurecode_helpers.h"
|
||||
|
||||
#define ISA_L_RS_VAND_LIB_MAJOR 2
|
||||
#define ISA_L_RS_VAND_LIB_MINOR 0
|
||||
#define ISA_L_RS_VAND_LIB_REV 0
|
||||
#define ISA_L_RS_VAND_LIB_VER_STR "2.0"
|
||||
#define ISA_L_RS_VAND_LIB_NAME "isa_l_rs_vand"
|
||||
#if defined(__MACOS__) || defined(__MACOSX__) || defined(__OSX__) || defined(__APPLE__)
|
||||
#define ISA_L_RS_VAND_SO_NAME "isa-l.dylib"
|
||||
#else
|
||||
#define ISA_L_RS_VAND_SO_NAME "isa-l.so"
|
||||
#endif
|
||||
|
||||
/* Forward declarations */
|
||||
struct ec_backend_op_stubs isa_l_rs_vand_ops;
|
||||
struct ec_backend isa_l_rs_vand;
|
||||
struct ec_backend_common backend_isa_l_rs_vand;
|
||||
|
||||
typedef void (*ec_encode_data_func)(int, int, int, unsigned char*, unsigned char **, unsigned char **);
|
||||
typedef void (*ec_init_tables_func)(int, int, unsigned char*, unsigned char *);
|
||||
@@ -568,6 +580,14 @@ static int isa_l_rs_vand_exit(void *desc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* For the time being, we only claim compatibility with versions that
|
||||
* match exactly
|
||||
*/
|
||||
static bool isa_l_rs_vand_is_compatible_with(uint32_t version) {
|
||||
return version == backend_isa_l_rs_vand.ec_backend_version;
|
||||
}
|
||||
|
||||
struct ec_backend_op_stubs isa_l_rs_vand_op_stubs = {
|
||||
.INIT = isa_l_rs_vand_init,
|
||||
.EXIT = isa_l_rs_vand_exit,
|
||||
@@ -576,17 +596,17 @@ struct ec_backend_op_stubs isa_l_rs_vand_op_stubs = {
|
||||
.FRAGSNEEDED = isa_l_rs_vand_min_fragments,
|
||||
.RECONSTRUCT = isa_l_rs_vand_reconstruct,
|
||||
.ELEMENTSIZE = isa_l_rs_vand_element_size,
|
||||
.ISCOMPATIBLEWITH = isa_l_rs_vand_is_compatible_with,
|
||||
};
|
||||
|
||||
struct ec_backend_common backend_isa_l_rs_vand = {
|
||||
.id = EC_BACKEND_ISA_L_RS_VAND,
|
||||
.name = "isa_l_rs_vand",
|
||||
#if defined(__MACOS__) || defined(__MACOSX__) || defined(__OSX__) || defined(__APPLE__)
|
||||
.soname = "isa-l.dylib",
|
||||
#else
|
||||
.soname = "isa-l.so",
|
||||
#endif
|
||||
.soversion = "2.0",
|
||||
.name = ISA_L_RS_VAND_LIB_NAME,
|
||||
.soname = ISA_L_RS_VAND_SO_NAME,
|
||||
.soversion = ISA_L_RS_VAND_LIB_VER_STR,
|
||||
.ops = &isa_l_rs_vand_op_stubs,
|
||||
.metadata_adder = 0,
|
||||
.ec_backend_version = _VERSION(ISA_L_RS_VAND_LIB_MAJOR,
|
||||
ISA_L_RS_VAND_LIB_MINOR,
|
||||
ISA_L_RS_VAND_LIB_REV),
|
||||
};
|
||||
|
||||
@@ -33,9 +33,21 @@
|
||||
#include "erasurecode_backend.h"
|
||||
#include "erasurecode_helpers.h"
|
||||
|
||||
#define JERASURE_RS_CAUCHY_LIB_MAJOR 2
|
||||
#define JERASURE_RS_CAUCHY_LIB_MINOR 0
|
||||
#define JERASURE_RS_CAUCHY_LIB_REV 0
|
||||
#define JERASURE_RS_CAUCHY_LIB_VER_STR "2.0"
|
||||
#define JERASURE_RS_CAUCHY_LIB_NAME "jerasure_rs_cauchy"
|
||||
#if defined(__MACOS__) || defined(__MACOSX__) || defined(__OSX__) || defined(__APPLE__)
|
||||
#define JERASURE_RS_CAUCHY_SO_NAME "libJerasure.dylib"
|
||||
#else
|
||||
#define JERASURE_RS_CAUCHY_SO_NAME "libJerasure.so"
|
||||
#endif
|
||||
|
||||
/* Forward declarations */
|
||||
struct ec_backend_op_stubs jerasure_rs_cauchy_ops;
|
||||
struct ec_backend jerasure_rs_cauchy;
|
||||
struct ec_backend_common backend_jerasure_rs_cauchy;
|
||||
|
||||
typedef int* (*cauchy_original_coding_matrix_func)(int, int, int);
|
||||
typedef int* (*jerasure_matrix_to_bitmatrix_func)(int, int, int, int *);
|
||||
@@ -364,6 +376,15 @@ static int jerasure_rs_cauchy_exit(void *desc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* For the time being, we only claim compatibility with versions that
|
||||
* match exactly
|
||||
*/
|
||||
static bool jerasure_rs_cauchy_is_compatible_with(uint32_t version) {
|
||||
return version == backend_jerasure_rs_cauchy.ec_backend_version;
|
||||
}
|
||||
|
||||
|
||||
struct ec_backend_op_stubs jerasure_rs_cauchy_op_stubs = {
|
||||
.INIT = jerasure_rs_cauchy_init,
|
||||
.EXIT = jerasure_rs_cauchy_exit,
|
||||
@@ -372,17 +393,18 @@ struct ec_backend_op_stubs jerasure_rs_cauchy_op_stubs = {
|
||||
.FRAGSNEEDED = jerasure_rs_cauchy_min_fragments,
|
||||
.RECONSTRUCT = jerasure_rs_cauchy_reconstruct,
|
||||
.ELEMENTSIZE = jerasure_rs_cauchy_element_size,
|
||||
.ISCOMPATIBLEWITH = jerasure_rs_cauchy_is_compatible_with,
|
||||
|
||||
};
|
||||
|
||||
struct ec_backend_common backend_jerasure_rs_cauchy = {
|
||||
.id = EC_BACKEND_JERASURE_RS_CAUCHY,
|
||||
.name = "jerasure_rs_cauchy",
|
||||
#if defined(__MACOS__) || defined(__MACOSX__) || defined(__OSX__) || defined(__APPLE__)
|
||||
.soname = "libJerasure.dylib",
|
||||
#else
|
||||
.soname = "libJerasure.so",
|
||||
#endif
|
||||
.soversion = "2.0",
|
||||
.name = JERASURE_RS_CAUCHY_LIB_NAME,
|
||||
.soname = JERASURE_RS_CAUCHY_SO_NAME,
|
||||
.soversion = JERASURE_RS_CAUCHY_LIB_VER_STR,
|
||||
.ops = &jerasure_rs_cauchy_op_stubs,
|
||||
.metadata_adder = 0,
|
||||
.ec_backend_version = _VERSION(JERASURE_RS_CAUCHY_LIB_MAJOR,
|
||||
JERASURE_RS_CAUCHY_LIB_MINOR,
|
||||
JERASURE_RS_CAUCHY_LIB_REV),
|
||||
};
|
||||
|
||||
@@ -33,9 +33,21 @@
|
||||
#include "erasurecode_backend.h"
|
||||
#include "erasurecode_helpers.h"
|
||||
|
||||
#define JERASURE_RS_VAND_LIB_MAJOR 2
|
||||
#define JERASURE_RS_VAND_LIB_MINOR 0
|
||||
#define JERASURE_RS_VAND_LIB_REV 0
|
||||
#define JERASURE_RS_VAND_LIB_VER_STR "2.0"
|
||||
#define JERASURE_RS_VAND_LIB_NAME "jerasure_rs_vand"
|
||||
#if defined(__MACOS__) || defined(__MACOSX__) || defined(__OSX__) || defined(__APPLE__)
|
||||
#define JERASURE_RS_VAND_SO_NAME "libJerasure.dylib"
|
||||
#else
|
||||
#define JERASURE_RS_VAND_SO_NAME "libJerasure.so"
|
||||
#endif
|
||||
|
||||
/* Forward declarations */
|
||||
struct ec_backend_op_stubs jerasure_rs_vand_ops;
|
||||
struct ec_backend jerasure_rs_vand;
|
||||
struct ec_backend_common backend_jerasure_rs_vand;
|
||||
|
||||
typedef int* (*reed_sol_vandermonde_coding_matrix_func)(int, int, int);
|
||||
typedef void (*jerasure_matrix_encode_func)(int, int, int, int*, char **, char **, int);
|
||||
@@ -305,6 +317,14 @@ static int jerasure_rs_vand_exit(void *desc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* For the time being, we only claim compatibility with versions that
|
||||
* match exactly
|
||||
*/
|
||||
static bool jerasure_rs_vand_is_compatible_with(uint32_t version) {
|
||||
return version == backend_jerasure_rs_vand.ec_backend_version;
|
||||
}
|
||||
|
||||
struct ec_backend_op_stubs jerasure_rs_vand_op_stubs = {
|
||||
.INIT = jerasure_rs_vand_init,
|
||||
.EXIT = jerasure_rs_vand_exit,
|
||||
@@ -313,17 +333,17 @@ struct ec_backend_op_stubs jerasure_rs_vand_op_stubs = {
|
||||
.FRAGSNEEDED = jerasure_rs_vand_min_fragments,
|
||||
.RECONSTRUCT = jerasure_rs_vand_reconstruct,
|
||||
.ELEMENTSIZE = jerasure_rs_vand_element_size,
|
||||
.ISCOMPATIBLEWITH = jerasure_rs_vand_is_compatible_with,
|
||||
};
|
||||
|
||||
struct ec_backend_common backend_jerasure_rs_vand = {
|
||||
.id = EC_BACKEND_JERASURE_RS_VAND,
|
||||
.name = "jerasure_rs_vand",
|
||||
#if defined(__MACOS__) || defined(__MACOSX__) || defined(__OSX__) || defined(__APPLE__)
|
||||
.soname = "libJerasure.dylib",
|
||||
#else
|
||||
.soname = "libJerasure.so",
|
||||
#endif
|
||||
.soversion = "2.0",
|
||||
.name = JERASURE_RS_VAND_LIB_NAME,
|
||||
.soname = JERASURE_RS_VAND_SO_NAME,
|
||||
.soversion = JERASURE_RS_VAND_LIB_VER_STR,
|
||||
.ops = &jerasure_rs_vand_op_stubs,
|
||||
.metadata_adder = 0,
|
||||
.ec_backend_version = _VERSION(JERASURE_RS_VAND_LIB_MAJOR,
|
||||
JERASURE_RS_VAND_LIB_MINOR,
|
||||
JERASURE_RS_VAND_LIB_REV),
|
||||
};
|
||||
|
||||
@@ -31,7 +31,16 @@
|
||||
|
||||
#include "erasurecode.h"
|
||||
#include "erasurecode_backend.h"
|
||||
|
||||
#define NULL_LIB_MAJOR 1
|
||||
#define NULL_LIB_MINOR 0
|
||||
#define NULL_LIB_REV 0
|
||||
#define NULL_LIB_VER_STR "1.0"
|
||||
#define NULL_LIB_NAME "null"
|
||||
#if defined(__MACOS__) || defined(__MACOSX__) || defined(__OSX__) || defined(__APPLE__)
|
||||
#define NULL_SO_NAME "libnullcode.dylib"
|
||||
#else
|
||||
#define NULL_SO_NAME "libnullcode.so"
|
||||
#endif
|
||||
/* Forward declarations */
|
||||
struct ec_backend null;
|
||||
struct ec_backend_op_stubs null_ops;
|
||||
@@ -203,6 +212,9 @@ static int null_exit(void *desc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool null_is_compatible_with(uint32_t version) {
|
||||
return true;
|
||||
}
|
||||
struct ec_backend_op_stubs null_op_stubs = {
|
||||
.INIT = null_init,
|
||||
.EXIT = null_exit,
|
||||
@@ -211,18 +223,17 @@ struct ec_backend_op_stubs null_op_stubs = {
|
||||
.FRAGSNEEDED = null_min_fragments,
|
||||
.RECONSTRUCT = null_reconstruct,
|
||||
.ELEMENTSIZE = null_element_size,
|
||||
.ISCOMPATIBLEWITH = null_is_compatible_with,
|
||||
};
|
||||
|
||||
struct ec_backend_common backend_null = {
|
||||
.id = EC_BACKEND_NULL,
|
||||
.name = "null",
|
||||
#if defined(__MACOS__) || defined(__MACOSX__) || defined(__OSX__) || defined(__APPLE__)
|
||||
.soname = "libnullcode.dylib",
|
||||
#else
|
||||
.soname = "libnullcode.so",
|
||||
#endif
|
||||
.soversion = "1.0",
|
||||
.name = NULL_LIB_NAME,
|
||||
.soname = NULL_SO_NAME,
|
||||
.soversion = NULL_LIB_VER_STR,
|
||||
.ops = &null_op_stubs,
|
||||
.metadata_adder = 0,
|
||||
.ec_backend_version = _VERSION(NULL_LIB_MAJOR, NULL_LIB_MINOR,
|
||||
NULL_LIB_REV),
|
||||
};
|
||||
|
||||
|
||||
@@ -33,9 +33,22 @@
|
||||
#include "erasurecode.h"
|
||||
#include "erasurecode_backend.h"
|
||||
|
||||
#define FLAT_XOR_LIB_MAJOR 1
|
||||
#define FLAT_XOR_LIB_MINOR 0
|
||||
#define FLAT_XOR_LIB_REV 0
|
||||
#define FLAT_XOR_LIB_VER_STR "1.0"
|
||||
#define FLAT_XOR_LIB_NAME "flat_xor_hd"
|
||||
#if defined(__MACOS__) || defined(__MACOSX__) || defined(__OSX__) || defined(__APPLE__)
|
||||
#define FLAT_XOR_SO_NAME "libXorcode.dylib"
|
||||
#else
|
||||
#define FLAT_XOR_SO_NAME "libXorcode.so"
|
||||
#endif
|
||||
#define DEFAULT_W 32
|
||||
|
||||
/* Forward declarations */
|
||||
struct ec_backend_op_stubs flat_xor_hd_ops;
|
||||
struct ec_backend flat_xor_hd;
|
||||
struct ec_backend_common backend_flat_xor_hd;
|
||||
|
||||
typedef xor_code_t* (*init_xor_hd_code_func)(int, int, int);
|
||||
typedef void (*xor_code_encode_func)(xor_code_t *, char **, char **, int);
|
||||
@@ -50,8 +63,6 @@ struct flat_xor_hd_descriptor {
|
||||
xor_hd_fragments_needed_func xor_hd_fragments_needed;
|
||||
};
|
||||
|
||||
#define DEFAULT_W 32
|
||||
|
||||
static int flat_xor_hd_encode(void *desc,
|
||||
char **data, char **parity, int blocksize)
|
||||
{
|
||||
@@ -150,6 +161,14 @@ static int flat_xor_hd_exit(void *desc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* For the time being, we only claim compatibility with versions that
|
||||
* match exactly
|
||||
*/
|
||||
static bool flat_xor_is_compatible_with(uint32_t version) {
|
||||
return version == backend_flat_xor_hd.ec_backend_version;
|
||||
}
|
||||
|
||||
struct ec_backend_op_stubs flat_xor_hd_op_stubs = {
|
||||
.INIT = flat_xor_hd_init,
|
||||
.EXIT = flat_xor_hd_exit,
|
||||
@@ -158,18 +177,18 @@ struct ec_backend_op_stubs flat_xor_hd_op_stubs = {
|
||||
.FRAGSNEEDED = flat_xor_hd_min_fragments,
|
||||
.RECONSTRUCT = flat_xor_hd_reconstruct,
|
||||
.ELEMENTSIZE = flar_xor_hd_element_size,
|
||||
.ISCOMPATIBLEWITH = flat_xor_is_compatible_with,
|
||||
};
|
||||
|
||||
struct ec_backend_common backend_flat_xor_hd = {
|
||||
.id = EC_BACKEND_FLAT_XOR_HD,
|
||||
.name = "flat_xor_hd",
|
||||
#if defined(__MACOS__) || defined(__MACOSX__) || defined(__OSX__) || defined(__APPLE__)
|
||||
.soname = "libXorcode.dylib",
|
||||
#else
|
||||
.soname = "libXorcode.so",
|
||||
#endif
|
||||
.soversion = "1.0",
|
||||
.name = FLAT_XOR_LIB_NAME,
|
||||
.soname = FLAT_XOR_SO_NAME,
|
||||
.soversion = FLAT_XOR_LIB_VER_STR,
|
||||
.ops = &flat_xor_hd_op_stubs,
|
||||
.metadata_adder = 0,
|
||||
.ec_backend_version = _VERSION(FLAT_XOR_LIB_MAJOR,
|
||||
FLAT_XOR_LIB_MINOR,
|
||||
FLAT_XOR_LIB_REV),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user