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