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
isa_l_rs_vand_init(struct ec_backend_args * args,void * backend_sohandle)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 */
isa_l_rs_vand_is_compatible_with(uint32_t version)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 };
74
75 struct ec_backend_common backend_isa_l_rs_vand = {
76 .id = EC_BACKEND_ISA_L_RS_VAND,
77 .name = ISA_L_RS_VAND_LIB_NAME,
78 .soname = ISA_L_RS_VAND_SO_NAME,
79 .soversion = ISA_L_RS_VAND_LIB_VER_STR,
80 .ops = &isa_l_rs_vand_op_stubs,
81 .backend_metadata_size = 0,
82 .ec_backend_version = _VERSION(ISA_L_RS_VAND_LIB_MAJOR,
83 ISA_L_RS_VAND_LIB_MINOR,
84 ISA_L_RS_VAND_LIB_REV),
85 };
86