|
liberasurecode 1.8.0
Erasure Code API library
|
#include <assert.h>#include <stdio.h>#include <stdarg.h>#include <zlib.h>#include "erasurecode_backend.h"#include "erasurecode_helpers.h"#include "erasurecode_helpers_ext.h"#include "erasurecode_stdinc.h"#include "erasurecode_version.h"#include "alg_sig.h"#include "erasurecode_log.h"Go to the source code of this file.
Functions | |
| static bool | is_fragment (char *buf) |
| __attribute__ ((visibility("internal"))) | |
| Memory Management Methods. | |
| void * | alloc_and_set_buffer (int size, int value) |
| Allocate a buffer of a specific size and set its' contents to the specified value. | |
| char * | get_data_ptr_from_fragment (char *buf) |
| int | get_libec_version (char *buf, uint32_t *ver) |
| int | get_backend_id (char *buf, ec_backend_id_t *id) |
| int | get_backend_version (char *buf, uint32_t *version) |
| __attribute__ | ( | (visibility("internal")) | ) |
Memory Management Methods.
Compute a size aligned to the number of data and the underlying wordsize of the EC algorithm.
Return total fragment length (on-disk, on-wire)
Deallocate memory buffer if it's not NULL.
Allocate a zero-ed buffer of a specific size.
The following methods provide wrappers for allocating and deallocating memory.
| size | integer size in bytes of buffer to allocate |
This methods returns NULL so that you can free and reset a buffer using a single line as follows:
my_ptr = check_and_free_buffer(my_ptr);
| buf | - pointer to fragment buffer |
| instance | - ec_backend_t instance (to extract args) |
| data_len | - integer length of data in bytes |
Ensure all memory is aligned to 16-byte boundaries to support 128-bit operations
Definition at line 61 of file erasurecode_helpers.c.
| void * alloc_and_set_buffer | ( | int | size, |
| int | value | ||
| ) |
Allocate a buffer of a specific size and set its' contents to the specified value.
| size | integer size in bytes of buffer to allocate |
| value |
Definition at line 99 of file erasurecode_helpers.c.
Referenced by liberasurecode_decode(), and liberasurecode_reconstruct_fragment().
| int get_backend_id | ( | char * | buf, |
| ec_backend_id_t * | id | ||
| ) |
Definition at line 452 of file erasurecode_helpers.c.
References is_fragment().
| int get_backend_version | ( | char * | buf, |
| uint32_t * | version | ||
| ) |
Definition at line 473 of file erasurecode_helpers.c.
References is_fragment().
| char * get_data_ptr_from_fragment | ( | char * | buf | ) |
Definition at line 218 of file erasurecode_helpers.c.
Referenced by __attribute__(), and liberasurecode_get_fragment_metadata().
| int get_libec_version | ( | char * | buf, |
| uint32_t * | ver | ||
| ) |
Definition at line 431 of file erasurecode_helpers.c.
References is_fragment().
Referenced by is_invalid_fragment().
|
static |
Definition at line 43 of file erasurecode_helpers.c.
Referenced by get_backend_id(), get_backend_version(), and get_libec_version().