-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathzcode.h
More file actions
41 lines (34 loc) · 917 Bytes
/
Copy pathzcode.h
File metadata and controls
41 lines (34 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef ZCODE_h
#define ZCODE_h
#include "common.h"
#include "mat.h"
typedef struct {
gfmat_t *pmat; // only the parity mat
int m; // parity chunk size
int k; // data chunk size
int datasize; // total datasize
int packetsize;
int blocksize;
} z_info_t;
/**
* init zcode information.
*/
int z_init(z_info_t *pzinfo, int m, int k, int datasize, int packetsize);
/**
* free zcode information memory.
*/
int z_free(z_info_t *pzinfo);
/**
* encode psrc data and store the parity data to pdes.
*
* psrc, and pdes already alloc enough memory.
*/
int z_encode(z_info_t *pzinfo, unsigned char *psrc, unsigned char *pdes);
/**
* repair node data chunk, store data to pdes.
*
* data in psrc place the same sequence of phelp;
* psrc, and pdes already alloc enough memory.
*/
int z_repair(z_info_t *pzinfo, unsigned char *psrc, blist_t *phelp,int node, unsigned char *pdes);
#endif