#include "lib/memory.h"
#include "lib/cksum.h"
#include "lib/trace.h"
Go to the source code of this file.
|
M0_INTERNAL int | m0_calculate_md5_inc_context (struct m0_md5_inc_context_pi *pi, struct m0_pi_seed *seed, struct m0_bufvec *bvec, enum m0_pi_calc_flag flag, unsigned char *curr_context, unsigned char *pi_value_without_seed) |
|
M0_INTERNAL uint64_t | m0_calculate_cksum_size (struct m0_generic_pi *pi) |
|
M0_INTERNAL uint64_t | max_cksum_size (void) |
|
int | m0_client_calculate_pi (struct m0_generic_pi *pi, struct m0_pi_seed *seed, struct m0_bufvec *bvec, enum m0_pi_calc_flag flag, unsigned char *curr_context, unsigned char *pi_value_without_seed) |
|
bool | m0_calc_verify_cksum_one_unit (struct m0_generic_pi *pi, struct m0_pi_seed *seed, struct m0_bufvec *bvec) |
|
◆ M0_TRACE_SUBSYSTEM
#define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_LIB |
◆ m0_calc_verify_cksum_one_unit()
Calculates checksum for data sent and compare it with checksum value sent. If newly calculated checksum on data and checksum sent matches, return true else return false.
- Parameters
-
[IN] | pi This ia an already calculated checksum value structure. |
[IN] | seed This seed is required to calculate checksum |
[IN] | bvec buffer vector which contains pointers to data on which checksum is to be calculated. |
Definition at line 194 of file cksum.c.
◆ m0_calculate_cksum_size()
M0_INTERNAL uint64_t m0_calculate_cksum_size |
( |
struct m0_generic_pi * |
pi | ) |
|
Calculate checksum size
- Parameters
-
pi | generic pointer for checksum data structure |
Definition at line 146 of file cksum.c.
◆ m0_calculate_md5_inc_context()
Calculate checksum/protection info for data/KV
- Parameters
-
| pi | pi struct m0_md5_inc_context_pi This function will calculate the checksum and set pi_value field of struct m0_md5_inc_context_pi. |
| seed | seed value (pis_obj_id+pis_data_unit_offset) required to calculate the checksum. If this pointer is NULL that means either this checksum calculation is meant for KV or user does not want seeding. |
| m0_bufvec | - Set of buffers for which checksum is computed. |
| flag | if flag is M0_PI_CALC_UNIT_ZERO, it means this api is called for first data unit and MD5_Init should be invoked. |
[out] | curr_context | context of data unit N, will be required to calculate checksum for next data unit, N+1. Curre_context is calculated and set in this func. |
[out] | pi_value_without_seed | - Caller may need checksum value without seed and with seed. With seed checksum is set in pi_value of PI type struct. Without seed checksum is set in this field. |
Definition at line 30 of file cksum.c.
◆ m0_client_calculate_pi()
Calculate checksum/protection info for data/KV
- Parameters
-
[IN/OUT] | pi Caller will pass Generic pi struct, which will be typecasted to specific PI type struct. API will calculate the checksum and set pi_value of PI type struct. In case of context, caller will send data unit N-1 unit's context via prev_context field in PI type struct. This api will calculate unit N's context and set value in curr_context. IN values - pi_type, pi_size, prev_context OUT values - pi_value, prev_context for first data unit. |
[IN] | seed seed value (pis_obj_id+pis_data_unit_offset) required to calculate the checksum. If this pointer is NULL that means either this checksum calculation is meant for KV or user does not want seeding. NOTE: seed is always NULL, non-null value sent at the last chunk of motr unit |
[IN] | m0_bufvec Set of buffers for which checksum is computed. Normally this set of vectors will make one data unit. It can be NULL as well. |
[IN] | flag If flag is M0_PI_CALC_UNIT_ZERO, it means this api is called for first data unit and init functionality should be invoked such as MD5_Init. |
[OUT] | curr_context context of data unit N, will be required to calculate checksum for next data unit, N+1. This api will calculate and set value for this field. NOTE: curr_context always have unseeded and non finalised context value and sending this parameter is mandatory. |
[OUT] | pi_value_without_seed Caller may need checksum value without seed and with seed. With seed checksum is set in pi_value of PI type struct. Without seed checksum is set in this field. Caller has to allocate memory for this filed. |
Definition at line 168 of file cksum.c.
◆ max_cksum_size()
M0_INTERNAL uint64_t max_cksum_size |
( |
void |
| ) |
|
Return max cksum size possible
Definition at line 162 of file cksum.c.