liberasurecode  1.6.2
Erasure Code API library
Data Structures | Macros | Typedefs | Functions | Variables
flat_xor_hd.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <xor_code.h>
#include "erasurecode.h"
#include "erasurecode_backend.h"

Go to the source code of this file.

Data Structures

struct  flat_xor_hd_descriptor
 

Macros

#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"
 
#define FLAT_XOR_SO_NAME   "libXorcode.so.1"
 
#define DEFAULT_W   32
 

Typedefs

typedef xor_code_t *(* init_xor_hd_code_func) (int, int, int)
 
typedef void(* xor_code_encode_func) (xor_code_t *, char **, char **, int)
 
typedef int(* xor_code_decode_func) (xor_code_t *, char **, char **, int *, int, int)
 
typedef int(* xor_hd_fragments_needed_func) (xor_code_t *, int *, int *, int *)
 

Functions

static int flat_xor_hd_encode (void *desc, char **data, char **parity, int blocksize)
 
static int flat_xor_hd_decode (void *desc, char **data, char **parity, int *missing_idxs, int blocksize)
 
static int flat_xor_hd_reconstruct (void *desc, char **data, char **parity, int *missing_idxs, int destination_idx, int blocksize)
 
static int flat_xor_hd_min_fragments (void *desc, int *missing_idxs, int *fragments_to_exclude, int *fragments_needed)
 
static int flar_xor_hd_element_size (void *desc)
 Return the element-size, which is the number of bits stored on a given device, per codeword. More...
 
static void * flat_xor_hd_init (struct ec_backend_args *args, void *sohandle)
 
static int flat_xor_hd_exit (void *desc)
 
static bool flat_xor_is_compatible_with (uint32_t version)
 

Variables

struct ec_backend_op_stubs flat_xor_hd_ops
 
struct ec_backend flat_xor_hd
 
struct ec_backend_common backend_flat_xor_hd
 
struct ec_backend_op_stubs flat_xor_hd_op_stubs
 

Macro Definition Documentation

◆ DEFAULT_W

#define DEFAULT_W   32

Definition at line 46 of file flat_xor_hd.c.

◆ FLAT_XOR_LIB_MAJOR

#define FLAT_XOR_LIB_MAJOR   1

Definition at line 36 of file flat_xor_hd.c.

◆ FLAT_XOR_LIB_MINOR

#define FLAT_XOR_LIB_MINOR   0

Definition at line 37 of file flat_xor_hd.c.

◆ FLAT_XOR_LIB_NAME

#define FLAT_XOR_LIB_NAME   "flat_xor_hd"

Definition at line 40 of file flat_xor_hd.c.

◆ FLAT_XOR_LIB_REV

#define FLAT_XOR_LIB_REV   0

Definition at line 38 of file flat_xor_hd.c.

◆ FLAT_XOR_LIB_VER_STR

#define FLAT_XOR_LIB_VER_STR   "1.0"

Definition at line 39 of file flat_xor_hd.c.

◆ FLAT_XOR_SO_NAME

#define FLAT_XOR_SO_NAME   "libXorcode.so.1"

Definition at line 44 of file flat_xor_hd.c.

Typedef Documentation

◆ init_xor_hd_code_func

typedef xor_code_t*(* init_xor_hd_code_func) (int, int, int)

Definition at line 53 of file flat_xor_hd.c.

◆ xor_code_decode_func

typedef int(* xor_code_decode_func) (xor_code_t *, char **, char **, int *, int, int)

Definition at line 55 of file flat_xor_hd.c.

◆ xor_code_encode_func

typedef void(* xor_code_encode_func) (xor_code_t *, char **, char **, int)

Definition at line 54 of file flat_xor_hd.c.

◆ xor_hd_fragments_needed_func

typedef int(* xor_hd_fragments_needed_func) (xor_code_t *, int *, int *, int *)

Definition at line 56 of file flat_xor_hd.c.

Function Documentation

◆ flar_xor_hd_element_size()

static int flar_xor_hd_element_size ( void *  desc)
static

Return the element-size, which is the number of bits stored on a given device, per codeword.

This is usually just 'w'.

Definition at line 118 of file flat_xor_hd.c.

References DEFAULT_W.

◆ flat_xor_hd_decode()

static int flat_xor_hd_decode ( void *  desc,
char **  data,
char **  parity,
int *  missing_idxs,
int  blocksize 
)
static

Definition at line 77 of file flat_xor_hd.c.

References flat_xor_hd_descriptor::xor_desc.

◆ flat_xor_hd_encode()

static int flat_xor_hd_encode ( void *  desc,
char **  data,
char **  parity,
int  blocksize 
)
static

Definition at line 66 of file flat_xor_hd.c.

References flat_xor_hd_descriptor::xor_desc.

◆ flat_xor_hd_exit()

static int flat_xor_hd_exit ( void *  desc)
static

Definition at line 154 of file flat_xor_hd.c.

References flat_xor_hd_descriptor::xor_desc.

◆ flat_xor_hd_init()

static void* flat_xor_hd_init ( struct ec_backend_args *  args,
void *  sohandle 
)
static

Definition at line 123 of file flat_xor_hd.c.

References DEFAULT_W, init_xor_hd_code(), and flat_xor_hd_descriptor::xor_desc.

◆ flat_xor_hd_min_fragments()

static int flat_xor_hd_min_fragments ( void *  desc,
int *  missing_idxs,
int *  fragments_to_exclude,
int *  fragments_needed 
)
static

Definition at line 101 of file flat_xor_hd.c.

References flat_xor_hd_descriptor::xor_desc.

◆ flat_xor_hd_reconstruct()

static int flat_xor_hd_reconstruct ( void *  desc,
char **  data,
char **  parity,
int *  missing_idxs,
int  destination_idx,
int  blocksize 
)
static

Definition at line 88 of file flat_xor_hd.c.

References flat_xor_hd_descriptor::xor_desc, and xor_reconstruct_one().

◆ flat_xor_is_compatible_with()

static bool flat_xor_is_compatible_with ( uint32_t  version)
static

Definition at line 168 of file flat_xor_hd.c.

References backend_flat_xor_hd.

Variable Documentation

◆ backend_flat_xor_hd

struct ec_backend_common backend_flat_xor_hd
Initial value:
= {
.id = EC_BACKEND_FLAT_XOR_HD,
.soname = FLAT_XOR_SO_NAME,
.soversion = FLAT_XOR_LIB_VER_STR,
.ec_backend_version = _VERSION(FLAT_XOR_LIB_MAJOR,
}

Definition at line 51 of file flat_xor_hd.c.

Referenced by flat_xor_is_compatible_with().

◆ flat_xor_hd

struct ec_backend flat_xor_hd

Definition at line 50 of file flat_xor_hd.c.

◆ flat_xor_hd_op_stubs

struct ec_backend_op_stubs flat_xor_hd_op_stubs
Initial value:
= {
.ENCODE = flat_xor_hd_encode,
.DECODE = flat_xor_hd_decode,
.FRAGSNEEDED = flat_xor_hd_min_fragments,
.RECONSTRUCT = flat_xor_hd_reconstruct,
.ELEMENTSIZE = flar_xor_hd_element_size,
.ISCOMPATIBLEWITH = flat_xor_is_compatible_with,
.GETMETADATASIZE = get_backend_metadata_size_zero,
.GETENCODEOFFSET = get_encode_offset_zero,
}

Definition at line 172 of file flat_xor_hd.c.

◆ flat_xor_hd_ops

struct ec_backend_op_stubs flat_xor_hd_ops

Definition at line 49 of file flat_xor_hd.c.

flat_xor_hd_init
static void * flat_xor_hd_init(struct ec_backend_args *args, void *sohandle)
Definition: flat_xor_hd.c:123
FLAT_XOR_LIB_NAME
#define FLAT_XOR_LIB_NAME
Definition: flat_xor_hd.c:40
flat_xor_hd_op_stubs
struct ec_backend_op_stubs flat_xor_hd_op_stubs
Definition: flat_xor_hd.c:172
FLAT_XOR_LIB_MINOR
#define FLAT_XOR_LIB_MINOR
Definition: flat_xor_hd.c:37
FLAT_XOR_SO_NAME
#define FLAT_XOR_SO_NAME
Definition: flat_xor_hd.c:44
flat_xor_hd_encode
static int flat_xor_hd_encode(void *desc, char **data, char **parity, int blocksize)
Definition: flat_xor_hd.c:66
flar_xor_hd_element_size
static int flar_xor_hd_element_size(void *desc)
Return the element-size, which is the number of bits stored on a given device, per codeword.
Definition: flat_xor_hd.c:118
FLAT_XOR_LIB_REV
#define FLAT_XOR_LIB_REV
Definition: flat_xor_hd.c:38
flat_xor_hd_reconstruct
static int flat_xor_hd_reconstruct(void *desc, char **data, char **parity, int *missing_idxs, int destination_idx, int blocksize)
Definition: flat_xor_hd.c:88
flat_xor_hd_min_fragments
static int flat_xor_hd_min_fragments(void *desc, int *missing_idxs, int *fragments_to_exclude, int *fragments_needed)
Definition: flat_xor_hd.c:101
flat_xor_is_compatible_with
static bool flat_xor_is_compatible_with(uint32_t version)
Definition: flat_xor_hd.c:168
flat_xor_hd_decode
static int flat_xor_hd_decode(void *desc, char **data, char **parity, int *missing_idxs, int blocksize)
Definition: flat_xor_hd.c:77
FLAT_XOR_LIB_VER_STR
#define FLAT_XOR_LIB_VER_STR
Definition: flat_xor_hd.c:39
flat_xor_hd_exit
static int flat_xor_hd_exit(void *desc)
Definition: flat_xor_hd.c:154
FLAT_XOR_LIB_MAJOR
#define FLAT_XOR_LIB_MAJOR
Definition: flat_xor_hd.c:36