32 #include "erasurecode.h"
33 #include "erasurecode_backend.h"
34 #define NULL_LIB_MAJOR 1
35 #define NULL_LIB_MINOR 0
36 #define NULL_LIB_REV 0
37 #define NULL_LIB_VER_STR "1.0"
38 #define NULL_LIB_NAME "null"
39 #if defined(__MACOS__) || defined(__MACOSX__) || defined(__OSX__) || defined(__APPLE__)
40 #define NULL_SO_NAME "libnullcode.dylib"
42 #define NULL_SO_NAME "libnullcode.so.1"
48 typedef void* (*init_null_code_func)(int, int, int);
80 static int null_encode(
void *desc,
char **data,
char **parity,
int blocksize)
85 static int null_decode(
void *desc,
char **data,
char **parity,
86 int *missing_idxs,
int blocksize)
92 int *missing_idxs,
int destination_idx,
int blocksize)
98 int *fragments_to_exclude,
int *fragments_needed)
113 static void *
null_init(
struct ec_backend_args *args,
void *backend_sohandle)
124 xdesc->
k = args->uargs.k;
125 xdesc->
m = args->uargs.m;
126 xdesc->
w = args->uargs.w;
132 xdesc->
arg1 = args->uargs.priv_args1.null_args.arg1;
139 long long max_symbols;
140 if (xdesc->
w != 8 && xdesc->
w != 16 && xdesc->
w != 32) {
143 max_symbols = 1LL << xdesc->
w;
144 if ((xdesc->
k + xdesc->
m) > max_symbols) {
161 } func_handle = {.vptr = NULL};
164 func_handle.vptr = NULL;
165 func_handle.vptr = dlsym(backend_sohandle,
"null_code_init");
171 func_handle.vptr = NULL;
172 func_handle.vptr = dlsym(backend_sohandle,
"null_code_encode");
178 func_handle.vptr = NULL;
179 func_handle.vptr = dlsym(backend_sohandle,
"null_code_decode");
185 func_handle.vptr = NULL;
186 func_handle.vptr = dlsym(backend_sohandle,
"null_reconstruct");
192 func_handle.vptr = NULL;
193 func_handle.vptr = dlsym(backend_sohandle,
"null_code_fragments_needed");
199 return (
void *) xdesc;
230 .id = EC_BACKEND_NULL,
235 .backend_metadata_size = 0,
null_code_fragments_needed_func null_code_fragments_needed
int(* null_reconstruct_func)(char **, int, uint64_t, int, char *)
struct ec_backend_common backend_null
static int null_exit(void *desc)
static int null_min_fragments(void *desc, int *missing_idxs, int *fragments_to_exclude, int *fragments_needed)
null_reconstruct_func null_reconstruct
void *(* init_null_code_func)(int, int, int)
int(* null_code_decode_func)(void *, char **, char **, int *, int, int)
static bool null_is_compatible_with(uint32_t version)
static int null_element_size(void *desc)
Return the element-size, which is the number of bits stored on a given device, per codeword...
null_code_encode_func null_code_encode
static int null_decode(void *desc, char **data, char **parity, int *missing_idxs, int blocksize)
int(* null_code_encode_func)(void *, char **, char **, int)
null_code_decode_func null_code_decode
static int null_reconstruct(void *desc, char **data, char **parity, int *missing_idxs, int destination_idx, int blocksize)
static void * null_init(struct ec_backend_args *args, void *backend_sohandle)
struct ec_backend_op_stubs null_op_stubs
static int null_encode(void *desc, char **data, char **parity, int blocksize)
struct ec_backend_op_stubs null_ops
int(* null_code_fragments_needed_func)(void *, int *, int *, int *)
init_null_code_func init_null_code