liberasurecode 1.6.3
Erasure Code API library
Loading...
Searching...
No Matches
isa_l_rs_cauchy.c
Go to the documentation of this file.
1/*
2 * Copyright 2014 Kevin M Greenan
3 * Copyright 2014 Tushar Gohad
4 * Copyright 2016 Kota Tsuyuzaki
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * Redistributions of source code must retain the above copyright notice, this
10 * list of conditions and the following disclaimer.
11 *
12 * Redistributions in binary form must reproduce the above copyright notice, this
13 * list of conditions and the following disclaimer in the documentation and/or
14 * other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY
15 * THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
18 * EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
19 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
22 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
23 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * isa_l_rs_cauchy backend implementation
27 *
28 * vi: set noai tw=79 ts=4 sw=4:
29 */
30
31#include <stdlib.h>
32#include "erasurecode_backend.h"
33#include "isa_l_common.h"
34
35#define ISA_L_RS_CAUCHY_LIB_MAJOR 2
36#define ISA_L_RS_CAUCHY_LIB_MINOR 14
37#define ISA_L_RS_CAUCHY_LIB_REV 1
38#define ISA_L_RS_CAUCHY_LIB_VER_STR "2.14"
39#define ISA_L_RS_CAUCHY_LIB_NAME "isa_l_rs_cauchy"
40#if defined(__MACOS__) || defined(__MACOSX__) || defined(__OSX__) || defined(__APPLE__)
41#define ISA_L_RS_CAUCHY_SO_NAME "libisal" LIBERASURECODE_SO_SUFFIX ".dylib"
42#else
43#define ISA_L_RS_CAUCHY_SO_NAME "libisal" LIBERASURECODE_SO_SUFFIX ".so.2"
44#endif
45
46/* Forward declarations */
47struct ec_backend_op_stubs isa_l_rs_cauchy_ops;
48struct ec_backend isa_l_rs_cauchy;
49struct ec_backend_common backend_isa_l_rs_cauchy;
50
51static void * isa_l_rs_cauchy_init(struct ec_backend_args *args,
52 void *backend_sohandle)
53{
54 return isa_l_common_init(args, backend_sohandle, "gf_gen_cauchy1_matrix");
55}
56
57/*
58 * For the time being, we only claim compatibility with versions that
59 * match exactly
60 */
61static bool isa_l_rs_cauchy_is_compatible_with(uint32_t version) {
62 return version == backend_isa_l_rs_cauchy.ec_backend_version;
63}
64
65struct ec_backend_op_stubs isa_l_rs_cauchy_op_stubs = {
67 .EXIT = isa_l_exit,
68 .ENCODE = isa_l_encode,
69 .DECODE = isa_l_decode,
70 .FRAGSNEEDED = isa_l_min_fragments,
71 .RECONSTRUCT = isa_l_reconstruct,
72 .ELEMENTSIZE = isa_l_element_size,
73 .ISCOMPATIBLEWITH = isa_l_rs_cauchy_is_compatible_with,
74 .GETMETADATASIZE = get_backend_metadata_size_zero,
75 .GETENCODEOFFSET = get_encode_offset_zero,
76};
77
78struct ec_backend_common backend_isa_l_rs_cauchy = {
79 .id = EC_BACKEND_ISA_L_RS_CAUCHY,
82 .soversion = ISA_L_RS_CAUCHY_LIB_VER_STR,
84 .ec_backend_version = _VERSION(ISA_L_RS_CAUCHY_LIB_MAJOR,
87};
int isa_l_encode(void *desc, char **data, char **parity, int blocksize)
int isa_l_exit(void *desc)
int isa_l_decode(void *desc, char **data, char **parity, int *missing_idxs, int blocksize)
int isa_l_reconstruct(void *desc, char **data, char **parity, int *missing_idxs, int destination_idx, int blocksize)
int isa_l_element_size(void *desc)
Return the element-size, which is the number of bits stored on a given device, per codeword.
void * isa_l_common_init(struct ec_backend_args *args, void *backend_sohandle, const char *gen_matrix_func_name)
int isa_l_min_fragments(void *desc, int *missing_idxs, int *fragments_to_exclude, int *fragments_needed)
static void * isa_l_rs_cauchy_init(struct ec_backend_args *args, void *backend_sohandle)
#define ISA_L_RS_CAUCHY_SO_NAME
static bool isa_l_rs_cauchy_is_compatible_with(uint32_t version)
struct ec_backend isa_l_rs_cauchy
#define ISA_L_RS_CAUCHY_LIB_REV
struct ec_backend_common backend_isa_l_rs_cauchy
struct ec_backend_op_stubs isa_l_rs_cauchy_ops
struct ec_backend_op_stubs isa_l_rs_cauchy_op_stubs
#define ISA_L_RS_CAUCHY_LIB_NAME
#define ISA_L_RS_CAUCHY_LIB_VER_STR
#define ISA_L_RS_CAUCHY_LIB_MINOR
#define ISA_L_RS_CAUCHY_LIB_MAJOR